getOption
getOption: (MenuEntry) -> stringThe option text: "Walk here", "Attack", ...
client:createMenuEntry(…)
client:getMenu():createMenuEntry(…)| Method | Returns | Description |
|---|---|---|
getOption() | string | The option text: "Walk here", "Attack", ... |
setOption(string) | MenuEntry | Set the option text. |
getTarget() | string | The target text, with its colour tags (<col=ffff00>Goblin<col=ff00> (level-2)); empty when the option has no target. |
setTarget(string) | MenuEntry | Set the target text. |
getIdentifier() | number | The identifier: the loc, NPC index, item, player index or widget op the action targets, depending on its type. |
setIdentifier(number) | MenuEntry | Set the identifier. On a client entry it is what the action then uses. |
getType() | MenuAction | The action, without the deprioritize offset (isDeprioritized() says that). |
setType(MenuAction) | MenuEntry | Set the action, keeping the deprioritize state. Within the entry's own action (an NPC op for another NPC op) the client's own action runs t… |
getParam0() | number | The first parameter: a scene x, a widget child index, ... |
setParam0(number) | MenuEntry | Set the first parameter. |
getParam1() | number | The second parameter: a scene y, a packed widget id, ... |
setParam1(number) | MenuEntry | Set the second parameter. |
isForceLeftClick() | boolean | Whether a left click runs it even where the client would open the menu (shift click). |
setForceLeftClick(boolean) | MenuEntry | Set whether a left click runs it even where the client would open the menu. |
getWorldViewId() | number | The world view the entry belongs to; -1 for none. |
setWorldViewId(number) | MenuEntry | Set the world view id. |
isDeprioritized() | boolean | Whether it is deprioritized (+2000 on its opcode): an "Attack" the attack-option setting demotes, a low-priority follower op, a player opti… |
setDeprioritized(boolean) | MenuEntry | Deprioritize it (or stop): it sorts below every entry that is not. A change made before the client's last sort places it. |
onClick((MenuEntry) -> ()) | MenuEntry | Run callback(entry) when the entry is clicked: after every MenuOptionClicked subscriber, whether or not one consumed the click. Replace… |
copyOnClick(MenuEntry) | MenuEntry | Copy from's onClick callback onto this entry: clone:copyOnClick(entry). A member cannot hand back a Luau function, so onClick has n… |
isItemOp() | boolean | Whether it is an inventory item op ("Use" and "Examine" are not). |
getItemOp() | number | The item op 1-5 of an inventory item op, else -1. The shift-click op (identifier 1) is the op of the item in the widget slot the entry name… |
getItemId() | number | The item id, or -1. |
setItemId(number) | MenuEntry | Set the item id. |
getWidget() | Widget? | The widget the entry acts on (a CC_OP, WIDGET_TARGET, WIDGET_CONTINUE, ...): client:getWidget(getParam1()), or its dynamic child `g… |
getNpc() | NPC? | The NPC the entry targets (an NPC option, a use on an NPC, Examine), by index getIdentifier() in the entry's world view, or nil. |
getPlayer() | Player? | The player the entry targets (a player option, a use on a player, a CLIENT_PLAYER entry) by index getIdentifier(); for WALK, the hove… |
getActor() | Actor? | getNpc(), else getPlayer(). |
getSubMenu() | Menu? | The entry's submenu, or nil when it has none. |
createSubMenu() | Menu | A new, empty submenu for the entry, replacing any. Raises where the client's menu cannot hold one. |
deleteSubMenu() | () | Remove the entry's submenu. |
equals(any) | boolean | Whether other is this same MenuEntry, as == answers it (false for a value of another class). |
| Method | Returns | Description |
|---|---|---|
Client.createMenuEntry | MenuEntry | Add an entry at idx (getMenu():createMenuEntry(idx); -1 is the top). |
Client.getMenuEntries | {MenuEntry} | The menu's entries, in the client's order (getMenu():getMenuEntries()). |
Menu.createMenuEntry | MenuEntry | Create a new entry at idx (a negative index counts from the end: -1 puts it on top) and return it: option and target empty, type `MenuAct… |
Menu.getMenuEntries | {MenuEntry} | The menu's entries, bottom first: a 1-based array whose last element is the top entry. |
MenuEntryAdded.getMenuEntry | MenuEntry | The entry the client added, live. From a legacy delivery (a build without the menu sites), a detached, read-only entry with the event's fie… |
MenuOpened.getFirstEntry | MenuEntry? | The entry shown at the top (the array's last), or nil for an empty menu. |
MenuOpened.getMenuEntries | {MenuEntry} | The menu's entries, bottom first: the last is shown at the top. |
MenuOptionClicked.getMenuEntry | MenuEntry | The clicked entry, live. From a legacy delivery (a build without the menu sites), a detached, read-only entry with the event's fields: the… |
getOptiongetOption: (MenuEntry) -> stringThe option text: "Walk here", "Attack", ...
setOptionsetOption: (MenuEntry, string) -> MenuEntrySet the option text.
getTargetgetTarget: (MenuEntry) -> stringThe target text, with its colour tags (<col=ffff00>Goblin<col=ff00> (level-2)); empty when the option has no target.
setTargetsetTarget: (MenuEntry, string) -> MenuEntrySet the target text.
getIdentifiergetIdentifier: (MenuEntry) -> numberThe identifier: the loc, NPC index, item, player index or widget op the action targets, depending on its type.
setIdentifiersetIdentifier: (MenuEntry, number) -> MenuEntrySet the identifier. On a client entry it is what the action then uses.
getTypegetType: (MenuEntry) -> MenuActionThe action, without the deprioritize offset (isDeprioritized() says that).
setTypesetType: (MenuEntry, MenuAction) -> MenuEntrySet the action, keeping the deprioritize state. Within the entry's own action (an NPC op for another NPC op) the client's own action runs the new op; any other type runs through Bento's intent for it when the entry is clicked (a CLIENT type runs nothing but onClick; WALK walks to the hovered tile, whatever the params).
getParam0getParam0: (MenuEntry) -> numberThe first parameter: a scene x, a widget child index, ...
setParam0setParam0: (MenuEntry, number) -> MenuEntrySet the first parameter.
getParam1getParam1: (MenuEntry) -> numberThe second parameter: a scene y, a packed widget id, ...
setParam1setParam1: (MenuEntry, number) -> MenuEntrySet the second parameter.
isForceLeftClickisForceLeftClick: (MenuEntry) -> booleanWhether a left click runs it even where the client would open the menu (shift click).
setForceLeftClicksetForceLeftClick: (MenuEntry, boolean) -> MenuEntrySet whether a left click runs it even where the client would open the menu.
getWorldViewIdgetWorldViewId: (MenuEntry) -> numberThe world view the entry belongs to; -1 for none.
setWorldViewIdsetWorldViewId: (MenuEntry, number) -> MenuEntrySet the world view id.
isDeprioritizedisDeprioritized: (MenuEntry) -> booleanWhether it is deprioritized (+2000 on its opcode): an "Attack" the attack-option setting demotes, a low-priority follower op, a player option with a priority, or one a plugin deprioritized. A type that is low by itself (loc op 5, Examine, CC_OP_LOW_PRIORITY) is not.
setDeprioritizedsetDeprioritized: (MenuEntry, boolean) -> MenuEntryDeprioritize it (or stop): it sorts below every entry that is not. A change made before the client's last sort places it.
onClickonClick: (MenuEntry, (MenuEntry) -> ()) -> MenuEntryRun callback(entry) when the entry is clicked: after every MenuOptionClicked subscriber, whether or not one consumed the click. Replaces an earlier callback; returns the entry.
copyOnClickcopyOnClick: (MenuEntry, MenuEntry) -> MenuEntryCopy from's onClick callback onto this entry: clone:copyOnClick(entry). A member cannot hand back a Luau function, so onClick has no getter to read it with. The callback still runs in the plugin that put it on from; a from with none takes this entry's off. Returns this entry.
isItemOpisItemOp: (MenuEntry) -> booleanWhether it is an inventory item op ("Use" and "Examine" are not).
getItemOpgetItemOp: (MenuEntry) -> numberThe item op 1-5 of an inventory item op, else -1. The shift-click op (identifier 1) is the op of the item in the widget slot the entry names.
getItemIdgetItemId: (MenuEntry) -> numberThe item id, or -1.
setItemIdsetItemId: (MenuEntry, number) -> MenuEntrySet the item id.
getWidgetgetWidget: (MenuEntry) -> Widget?The widget the entry acts on (a CC_OP, WIDGET_TARGET, WIDGET_CONTINUE, ...): client:getWidget(getParam1()), or its dynamic child getParam0() when that is not -1. nil for other types, an interface that is not loaded, or an empty slot.
getNpcgetNpc: (MenuEntry) -> NPC?The NPC the entry targets (an NPC option, a use on an NPC, Examine), by index getIdentifier() in the entry's world view, or nil.
getPlayergetPlayer: (MenuEntry) -> Player?The player the entry targets (a player option, a use on a player, a CLIENT_PLAYER entry) by index getIdentifier(); for WALK, the hovered player at getIdentifier() - 1. nil when there is none.
getActorgetActor: (MenuEntry) -> Actor?getNpc(), else getPlayer().
getSubMenugetSubMenu: (MenuEntry) -> Menu?The entry's submenu, or nil when it has none.
createSubMenucreateSubMenu: (MenuEntry) -> MenuA new, empty submenu for the entry, replacing any. Raises where the client's menu cannot hold one.
deleteSubMenudeleteSubMenu: (MenuEntry) -> ()Remove the entry's submenu.
equalsequals: (MenuEntry, any) -> booleanWhether other is this same MenuEntry, as == answers it (false for a value of another class).