MiniMenu¶
Overview¶
The MiniMenu is the primary mechanism for interacting with the game.
Each element in the game, whether a 2D Interface Component or a 3D game world NPC Entity, will add MiniMenuEntries to the MiniMenu when the cursor, or a tap, is positioned over them. These entries are recalculated on every Client Logic tick, so long as the MiniMenu remains closed.
When the MiniMenu is opened, by right-click or long-press, the current list of available entries is shown. The list is sorted by priority, with the higher priority entries shown at the top.
Info
When accessing the MiniMenu via the API, higher priority entries are instead at the end of the list.
The highest priority entry in the list is activated when you left-click or tap while the MiniMenu is closed. This is also the entry which interface tooltips are generated for, and which affects the current Cursor sprite.
Accessing the MiniMenu¶
As the MiniMenu's list of MiniMenuEntries is in constant flux, access and making changes to the MiniMenu is restricted to within specific Events.
The principal event for managing the MiniMenu is Event.MiniMenuReady. This event provides access to the full list of entries, as well as the ability to Swap entries.
Additional events Event.MiniMenuOpened and Event.MiniMenuClosed provide read-only access to the presented list of entries.
Event.MiniMenuEntryAdded is called when each new entry is added, providing access only to that entry.
Event.MiniMenuEntrySelected is called when a MiniMenu entry is chosen. This can be from a left-click or tap on a game element, or from selecting an entry from the open MiniMenu.
The only MiniMenu state available outside of these events is MiniMenu.IsOpen().
MiniMenuEntry¶
A MiniMenuEntry contains information about a specific action from a specific source, which should occur when the entry is selected.
The entry source, like an NPC entity or Interface Component, is indicated by MiniMenuEntryType, which covers all the places where actions can be gathered.
Entries also provide additional data, depending on the MiniMenuEntryType. This can be things like access to a source NPCEntity or a ground CoordGrid.
See MiniMenuEntry properties for additional information.
Actions and Ops¶
There is a fixed number of possible actions available, shown in MiniMenuActionType. These actions can be handled by the Client, sent to the Server, or both at the same time.
The legacy name for these actions is called an Op. Each source, like an NPC or Component, has a set of numbered Ops which are individually referred to as Op1, Op2, etc.
Each type also has a Target Op, referred to as OpT. This is used to apply one entity to another - such as a Spell or Ability to an in-game NPC.
Verbs and Subjects¶
Most entries have a Verb, like "Chop down", and a Subject, like "Oak Tree". Some simpler entries have only a Verb, such as "Walk" or "Cancel".
There are a few common verb types, shown in MiniMenuActionVerbType.
These are used to present display strings for common Ops like MiniMenuActionVerbType.ATTACK or MiniMenuActionVerbType.EXAMINE, while MiniMenuActionVerbType.OP covers all custom Ops.
Custom Ops are found in entity configs, or are manually defined in Component OP configs.
For entities, the Subject display string comes from the entity config's displayName while the Verb string depends on each individual Op found in the entity config.
Sorting¶
Entries are sorted within the MiniMenu in the following order:
- Entity distance to camera
- Subject, which groups entries belonging to the same entity or Component
- Action Priority
Enumerations¶
MiniMenuEntryType¶
A list of all the possible source types for each MiniMenuEntry.
| Name | Value |
|---|---|
| NONE | 0 |
| INTERFACE | 1 |
| OBJ | 2 |
| LOC | 3 |
| NPC | 4 |
| OTHER | 5 |
| MINIMENU | 6 |
| PLAYER | 7 |
| SELF | 8 |
| MAP | 9 |
| PLUGIN | 10 |
MiniMenuActionVerbType¶
The type of action for each entry.
MiniMenuActionVerbType.OP is the most common.
| Name | Value |
|---|---|
| ATTACK | 0 |
| EXAMINE | 1 |
| OP | 2 |
| UNSPECIFIED | 3 |
MiniMenuActionType¶
All available types of action that can be found in a MiniMenuEntry.
Entity sources have individual actions for each numbered Op, such as OP_LOC1 or OP_OBJ6.
Component Ops use IF_BUTTONX1 and IF_BUTTONX2 with the Op number found in MiniMenuEntry.componentData.opIndex.
The entry source type, and the related property data for the source, are also provided.
| Name | Value | MiniMenuEntryType | Data Property |
|---|---|---|---|
| TGT_LOC | 2 | LOC | LocData |
| OP_LOC1 | 3 | LOC | LocData |
| OP_LOC2 | 4 | LOC | LocData |
| OP_LOC3 | 5 | LOC | LocData |
| OP_LOC4 | 6 | LOC | LocData |
| TGT_NPC | 8 | NPC | NPCData |
| OP_NPC1 | 9 | NPC | NPCData |
| OP_NPC2 | 10 | NPC | NPCData |
| OP_NPC3 | 11 | NPC | NPCData |
| OP_NPC4 | 12 | NPC | NPCData |
| OP_NPC5 | 13 | NPC | NPCData |
| TGT_PLAYER | 15 | PLAYER | PlayerData |
| TGT_SELF | 16 | SELF | PlayerData |
| TGT_OBJ | 17 | OBJ | ObjData |
| OP_OBJ1 | 18 | OBJ | ObjData |
| OP_OBJ2 | 19 | OBJ | ObjData |
| OP_OBJ3 | 20 | OBJ | ObjData |
| OP_OBJ4 | 21 | OBJ | ObjData |
| OP_OBJ5 | 22 | OBJ | ObjData |
| WALK | 23 | NONE | GroundData |
| TGT_BUTTON | 25 | INTERFACE | ComponentData |
| PAUSE_BUTTON | 30 | INTERFACE | ComponentData |
| OP_PLAYER1 | 44 | PLAYER | PlayerData |
| OP_PLAYER2 | 45 | PLAYER | PlayerData |
| OP_PLAYER3 | 46 | PLAYER | PlayerData |
| OP_PLAYER4 | 47 | PLAYER | PlayerData |
| OP_PLAYER5 | 48 | PLAYER | PlayerData |
| OP_PLAYER6 | 49 | PLAYER | PlayerData |
| OP_PLAYER7 | 50 | PLAYER | PlayerData |
| OP_PLAYER8 | 51 | PLAYER | PlayerData |
| OP_PLAYER9 | 52 | PLAYER | PlayerData |
| OP_PLAYER10 | 53 | PLAYER | PlayerData |
| IF_BUTTONX1 | 57 | INTERFACE | ComponentData |
| IF_BUTTONT | 58 | INTERFACE | ComponentData |
| TGT_GROUND | 59 | NONE | GroundData |
| FACE_SQUARE | 60 | NONE | GroundData |
| OP_LOC5 | 1001 | LOC | LocData |
| OP_LOC6 | 1002 | LOC | LocData |
| OP_NPC6 | 1003 | LOC | NPCData |
| OP_OBJ6 | 1004 | LOC | ObjData |
| WIKI | 1005 | NONE | Unsupported |
| CANCEL | 1006 | NONE | None |
| IF_BUTTONX2 | 1007 | INTERFACE | ComponentData |
| OP_MAPELEMENT1 | 1008 | MAP | MapElementData |
| OP_MAPELEMENT2 | 1009 | MAP | MapElementData |
| OP_MAPELEMENT3 | 1010 | MAP | MapElementData |
| OP_MAPELEMENT4 | 1011 | MAP | MapElementData |
| OP_MAPELEMENT5 | 1012 | MAP | MapElementData |
| OP_NPC1_LOWPRIORITY | 2009 | NPC | NPCData |
| OP_NPC2_LOWPRIORITY | 2010 | NPC | NPCData |
| OP_NPC3_LOWPRIORITY | 2011 | NPC | NPCData |
| OP_NPC4_LOWPRIORITY | 2012 | NPC | NPCData |
| OP_NPC5_LOWPRIORITY | 2013 | NPC | NPCData |
| OP_PLAYER1_LOWPRIORITY | 2044 | PLAYER | PlayerData |
| OP_PLAYER2_LOWPRIORITY | 2045 | PLAYER | PlayerData |
| OP_PLAYER3_LOWPRIORITY | 2046 | PLAYER | PlayerData |
| OP_PLAYER4_LOWPRIORITY | 2047 | PLAYER | PlayerData |
| OP_PLAYER5_LOWPRIORITY | 2048 | PLAYER | PlayerData |
| OP_PLAYER6_LOWPRIORITY | 2049 | PLAYER | PlayerData |
| OP_PLAYER7_LOWPRIORITY | 2050 | PLAYER | PlayerData |
| OP_PLAYER8_LOWPRIORITY | 2051 | PLAYER | PlayerData |
| OP_PLAYER9_LOWPRIORITY | 2052 | PLAYER | PlayerData |
| OP_PLAYER10_LOWPRIORITY | 2053 | PLAYER | PlayerData |
| OP_NPC6_LOWPRIORITY | 3003 | NPC | NPCData |
MiniMenu Functions¶
IsOpen¶
Returns whether the MiniMenu is currently open. This static method be called at any time.
| Returns | Description |
|---|---|
| Boolean | Whether the MiniMenu is currently open. |
MiniMenu Methods¶
Add¶
Adds a MiniMenuEntry to the end of the current list of minimenu entries.
It will be displayed with the label specified and call the Lua function specified, with any additional arguments provided in order.
Warning
This method is only available during Event.MiniMenuEntryAdded and Event.MiniMenuReady.
When called during Event.MiniMenuEntryAdded the new entry will be added immediately after the current entry.
When called during Event.MiniMenuReady the new entry will be added at the bottom of MiniMenu.entries.
| Parameter | Type | Description |
|---|---|---|
| label | String | The text displayed for the entry in the minimenu. |
| action | Function | A Lua function that can take any number of arguments, including none. |
| ... | Args | A comma-separated list of arguments that will be passed to the function specified in the action parameter. |
Example
Swap¶
Swaps MiniMenuEntries found at the two provided indices of MiniMenu.entries.
Info
The index values are 1-based.
Warning
This method is only available during Event.MiniMenuReady.
| Parameter | Type | Description |
|---|---|---|
| indexA | Integer | The index of the first MiniMenuEntry in MiniMenu.entries. |
| indexB | Integer | The index of the second MiniMenuEntry in MiniMenu.entries. |
Example
function onMiniMenuReady(miniMenuEvent)
-- Get the available entries
local entries = miniMenuEvent.miniMenu.entries
-- Store the index of entries we find
local idxA = 0
local idxB = 0
-- Loop all the entries
for i,entry in ipairs(entries) do
-- If we find the Lumbridge Market bank chest, make a note of the Op indices
-- NOTE: The tile coords in entry.locData should ideally be compared here, to make sure the entities match
if entry.actionType == MiniMenuActionType.OP_LOC2 and entry.locData.config == config.Loc.CBTV2CA_DEPOSIT_BOX then
idxA = i
elseif entry.actionType == MiniMenuActionType.OP_LOC4 and entry.locData.config == config.Loc.CBTV2CA_DEPOSIT_BOX then
idxB = i
end
end
-- If we found a bank chest, and stored the indices, swap them
if idxA ~= 0 and idxB ~= 0 then
miniMenuEvent.miniMenu:Swap(idxA, idxB)
end
end
Event.MiniMenuReady.Subscribe("myEvent", onMiniMenuReady)
MiniMenu Properties¶
| Name | Type | Writeable | Description |
|---|---|---|---|
| isOpen | Boolean | Whether the MiniMenu is currently open. | |
| entryCount | Integer | How many entries are in the MiniMenu. | |
| entries | [ MiniMenuEntry ] | A list of current entries available in the MiniMenu. |
MiniMenuEntry Properties¶
| Name | Type | Writeable | Description |
|---|---|---|---|
| actionType | MiniMenuActionType | The action type of this entry. | |
| actionEntryType | MiniMenuEntryType | The entry source type of this entry. | |
| actionVerbType | MiniMenuActionVerbType | The verb type of this entry. | |
| verbText | String | The verb name of the entry. | |
| subjectText | String | The subject name of the entry. | |
| extraText | String | An additional string appended to the entry. | |
| fullText | String | The full text displayed when the entry is shown in the MiniMenu if overrideText has not been set.Combines verbText, subjectText and extraText in that order. |
|
| overrideText | String | Override text for an entry supplied by a plugin. This is displayed in place of an entry's fullText if set. |
|
| cursorID | Integer | The Cursor config ID shown when this entry is active.Use config.Cursor.FromID(cursorID) to obtain the config. |
|
| iconSpriteIDs | [ Integer ] | An array of sprite IDs which are drawn next to the entry text.Empty if none are drawn. | |
| subjectOnOtherLevel | Boolean | Whether the source entity is on a different level from the Player Character.NOTE: Not always correct. | |
| subjectHash | Integer | A (sort of) unique identifier for the entry.This identifier is only unique for entries that share the same actionEntryType. |
|
| npcData? | NPCData | A collection of data related to this entry.Will be nil if unavailable. |
|
| locData? | LocData | A collection of data related to this entry.Will be nil if unavailable. |
|
| objData? | ObjData | A collection of data related to this entry.Will be nil if unavailable. |
|
| playerData? | PlayerData | A collection of data related to this entry.Will be nil if unavailable. |
|
| groundData? | GroundData | A collection of data related to this entry.Will be nil if unavailable. |
|
| mapElementData? | MapElementData | A collection of data related to this entry.Will be nil if unavailable. |
|
| componentData? | ComponentData | A collection of data related to this entry.Will be nil if unavailable. |
NPCData Properties¶
| Name | Type | Writeable | Description |
|---|---|---|---|
| entity | NPCEntity | The NPC entity source for this entry. |
LocData Properties¶
| Name | Type | Writeable | Description |
|---|---|---|---|
| coordGridX | Integer | The south-west tile X coordinate the Loc entity is positioned at. | |
| coordGridZ | Integer | The south-west tile Z coordinate the Loc entity is positioned at. | |
| config | LocType | The config for the Loc entity. |
ObjData Properties¶
| Name | Type | Writeable | Description |
|---|---|---|---|
| entity | ObjStackEntity | The ObjStack entity source for this entry. | |
| stackIndex | Integer | The specific object within the source ObjStackEntity that this MiniMenuEntry relates to.Use this with ObjStackEntity:GetEntry(). | |
| config | ObjType | The config for the specific object that this MiniMenuEntry relates to. |
PlayerData Properties¶
| Name | Type | Writeable | Description |
|---|---|---|---|
| entity | PlayerEntity | The Player entity source for this entry. |
GroundData Properties¶
| Name | Type | Writeable | Description |
|---|---|---|---|
| coordGridX | Integer | The tile X coordinate this entry is focused at. | |
| coordGridZ | Integer | The tile Z coordinate this entry is focused at. | |
| fromMiniMap | Boolean | true if this entry was created from the MiniMap.false if this entry was created from the 3D world view. |
MapElementData Properties¶
| Name | Type | Writeable | Description |
|---|---|---|---|
| mapElementID | Integer | The MapElement config ID shown when this entry is active.Use config.MapElement.FromID(mapElementID) to obtain the config.TODO: MapElement configs are not available yet. |
|
| categoryID | Integer | The Category ID belonging to this map element. |
ComponentData Properties¶
| Name | Type | Writeable | Description |
|---|---|---|---|
| opIndex | Integer | The op index for this entry.Valid values are 1 -> 10. |
|
| objConfig? | ObjType | Some Components allow ObjType IDs to be assigned to them, such as Sprites and Models.This property provides the config, if set on the source Component.Will be nil if unavailable. |
|
| component | Component | The Component source for this entry. |