Update of "Menu Item"

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.


Artifact ID: 8c96ce0469080d0413f7d8eaab8ad40252eab10b
Page Name:Menu Item
Date: 2017-04-23 17:43:32
Original User: Entomy
Parent: 4f3d4faf57ca936377125547fa5544d12cf90ca3


There are certain advantages to tipmenus existing inside of an app or bot. One such thing used to implement tipmenus is the menuitem class, which represents individual items in the menu.


Instances of this class are used to fill a Menu Section with items.

This class can optionally hold a handler function, which is to be called when the item is tipped for, as well as parameters for the handler function.



The name of the menu item; what it is displayed as.


The cost of the menu item; how many tokens it requires.


If the menu item has an associated handler, call it. This should be called somewhere in cb.onTip() after a match has been made, on the match.


New menu items are created through new menuitem(). At the absolute simplest, both a name and cost must be declared, like new menuitem("example", 10), which creates an item called example which costs 10 tokens. Optionally, a handler function can be declared and passed, with optional paramters, like so new menuitem("example", 10, handler, param1, param2). The handler and parameters are stored with the item.