Macro APILua Scripting
Lua API Reference
Lua decisions, actions, and deterministic stdlib.
Decisions and Actions
| Function | Kind | Required capabilities | Allowed hooks | Description |
|---|---|---|---|---|
combat.attack(selector) | decision | hook.onCombatActionRequested@1, hook.onEnemySpotted@1 | Combat Action Requested, Enemy Spotted | Choose the attack combat action. |
combat.useAbility(abilityKey, selector) | decision | hook.onCombatActionRequested@1 | Combat Action Requested | Choose a ready combat ability against a target selector. |
combat.drinkPotion() | decision | hook.onCombatActionRequested@1, hook.onEnemySpotted@1 | Combat Action Requested, Enemy Spotted | Choose the life consumable combat action. |
combat.retreat() | decision | hook.onCombatActionRequested@1 | Combat Action Requested | Retreat from the current battle. |
combat.avoid() | decision | hook.onEnemySpotted@1 | Enemy Spotted | Avoid the spotted enemy before combat starts. |
loot.openContainer(timelineEventId) | action | action.openLootContainer@1 | Loot Container Found | Open the found container and return generated loot items with readable item data. |
loot.keepItem(item) | action | action.keepLootItem@1 | Currency Drop Found, Item Drop Found, Loot Container Found | Pick up the current loot item or currency drop. |
loot.leaveItem(item) | action | action.leaveLootItem@1 | Currency Drop Found, Item Drop Found, Loot Container Found | Leave the current loot item or currency drop where it is. |
loot.sellItem(item) | action | action.sellLootItem@1 | Item Drop Found, Loot Container Found | Sell the current loot item for its deterministic vendor value. |
loot.salvageItem(item) | action | action.salvageLootItem@1 | Item Drop Found | Salvage the current loot item into deterministic crafting materials. |
loot.equipItem(item, slot) | action | action.equipLootItem@1 | Item Drop Found, Loot Container Found | Pick up and equip the current loot item in a legal slot, or keep it if it cannot be equipped. |
bank.deposit(playerItemId, destination) | action | action.bankDeposit@1 | Bank Node Reached | Deposit one inventory item into the current bank. |
bank.depositHaul() | action | action.bankDepositHaul@1 | Bank Node Reached | Deposit the current backpack haul into the current bank. |
continue() | decision | None | All hooks | Continue the current run. |
pause() | decision | None | All hooks | Pause the current run. |
Stdlib
| Scope | Function | Description |
|---|---|---|
| math | math.floor(value) | Round a number down to the nearest integer. |
| math | math.ceil(value) | Round a number up to the nearest integer. |
| math | math.abs(value) | Return the absolute value of a number. |
| math | math.min(value, ...) | Return the smallest number from the arguments. |
| math | math.max(value, ...) | Return the largest number from the arguments. |
| math | math.sqrt(value) | Return the square root of a number. |
| string | string.sub(value, start, end) | Return a substring using Lua's one-based indexes. |
| string | string.len(value) | Return the string length. |
| string | string.upper(value) | Return an uppercase copy of a string. |
| string | string.lower(value) | Return a lowercase copy of a string. |
| string | string.rep(value, count) | Repeat a string a fixed number of times. |
| table | table.insert(table, value) | Insert a value into a table array. |
| table | table.remove(table, position) | Remove a value from a table array. |
| table | table.concat(table, separator) | Concatenate string or number array values. |
| global | pairs(table) | Iterate over table keys in deterministic insertion order. |
| global | ipairs(table) | Iterate over table array values in order. |
| global | type(value) | Return the Lua type name for a value. |
| global | tostring(value) | Convert a value to a string. |
| global | tonumber(value) | Convert a string or number to a number. |
| global | print(value, ...) | Write values to the macro trace. |