Your first macro
LUAmacro(5000, "My first macro", function()
info("MauBot macro is running.")
end)5000 is the interval in milliseconds. The function contains the code that runs each time.
Create your first macro, understand the essentials, then find the functions you need.
Create or open a Lua file in your macro configuration and paste the example below.
Save the file, reload your macros and find My first macro in the macro list.
Enable the macro. It writes a message to the macro info log every five seconds. Turn it off when finished.
macro(5000, "My first macro", function()
info("MauBot macro is running.")
end)5000 is the interval in milliseconds. The function contains the code that runs each time.
macro(...)storagedelay(...)nilIf a macro fails, read its error message and check the function signature, argument order and return value in the reference.
Complete scripts you can copy, read and adapt. Choose a task to get started.
Store settings, expose setup fields, and cast only when conditions match.
local key = "example_heal"
storage[key] = storage[key] or {
spell = "exura",
hp = 80,
mana = 10,
hotkey = ""
}
local config = storage[key]
local heal = macro(100, "Example Heal", config.hotkey, function()
if hppercent() <= tonumber(config.hp) and manapercent() >= tonumber(config.mana) and canCast(config.spell) then
castSpell(config.spell)
delay(1000)
end
end)
heal:setSetup(function()
UI.Section("Heal Settings")
UI.Field("Spell", config.spell, function(value)
config.spell = value
end)
UI.NumberField("HP <=", config.hp, function(value)
config.hp = math.max(1, math.min(100, tonumber(value) or 80))
end)
UI.NumberField("Mana >=", config.mana, function(value)
config.mana = math.max(0, math.min(100, tonumber(value) or 10))
end)
UI.HotkeyField("Hotkey", config.hotkey, function(combo)
config.hotkey = combo
heal:setHotkey(combo)
end)
end)Link a movable screen icon to a macro and let users show or hide it.
local key = "example_icon_heal"
storage[key] = storage[key] or {
showIcon = true,
iconItemId = 3160,
iconText = "Heal"
}
local config = storage[key]
local icon
local heal = macro(100, "Icon Heal", function()
if hppercent() <= 70 and canCast("exura gran") then
castSpell("exura gran")
delay(1000)
end
end)
local function setIconVisible()
if icon and icon.setVisible then
icon:setVisible(config.showIcon == true)
end
end
icon = addIcon("example_icon_heal", {
item = { id = config.iconItemId, count = 1 },
text = config.iconText,
movable = true
}, function(_, isOn)
if isOn then
heal:setOn()
else
heal:setOff()
end
end)
setIconVisible()
heal:setSetup(function()
UI.Switch("Show Icon", config.showIcon, function(enabled)
config.showIcon = enabled
setIconVisible()
end)
UI.IconFields(icon, config, { itemId = 3160, text = "Heal" })
end)Keep haste active while respecting mana, target, paralysis, and cooldown checks.
local config = {
spell = "utani hur",
mana = 20,
cooldown = 2000,
onlyWithoutTarget = false
}
local nextCast = 0
macro(250, "Safe Haste", function()
if now < nextCast then return end
if manapercent() < config.mana then return end
if isParalyzed() then return end
if hasHaste() then return end
if config.onlyWithoutTarget and target() then return end
say(config.spell)
nextCast = now + config.cooldown
end)React to paralysis quickly without spamming the spell every tick.
local config = {
spell = "utani hur",
mana = 15,
cooldown = 1200
}
local nextCast = 0
macro(100, "Anti Paralyze", function()
if not isParalyzed() then return end
if manapercent() < config.mana then return end
if now < nextCast then return end
say(config.spell)
nextCast = now + config.cooldown
end)Scan spectators, choose the best monster, and attack it automatically.
local config = {
range = 6,
preferLowHp = true
}
macro(250, "Attack Closest", function()
if target() then return end
local playerPos = pos()
local best, bestScore
for _, creature in ipairs(getSpectators()) do
if creature:isMonster() then
local creaturePos = creature:getPosition()
local distance = getDistanceBetween(playerPos, creaturePos)
if creaturePos.z == playerPos.z and distance <= config.range then
local score = distance * 100
if config.preferLowHp then
score = score + creature:getHealthPercent()
end
if not bestScore or score < bestScore then
best = creature
bestScore = score
end
end
end
end
if best then
g_game.attack(best)
end
end)Use an area rune only when it is safe, otherwise fall back to a single target rune.
local config = {
singleRune = 3155, -- SD
areaRune = 3161, -- Avalanche
areaRange = 5
}
macro(200, "Safe Rune", function()
local creature = g_game.getAttackingCreature()
if not creature then return end
local distance = getDistanceBetween(pos(), creature:getPosition())
if distance <= config.areaRange and isSafe(8) then
useWith(config.areaRune, creature)
else
useWith(config.singleRune, creature)
end
delay(900)
end)Listen to chat, validate the nearby player, and invite them to party.
local inviteWords = {
["party"] = true,
["pt"] = true,
["invite"] = true
}
onTalk(function(name, level, mode, text)
if not inviteWords[text:lower()] then return end
for _, creature in ipairs(getSpectators()) do
if creature:isPlayer() and creature:getName():lower() == name:lower() then
if not creature:isPartyMember() then
g_game.partyInvite(creature:getId())
end
return
end
end
end)Remember a player position from events and walk to the last known tile.
local followName = "Leader"
local lastSeen = {}
onCreaturePositionChange(function(creature, newPos, oldPos)
if creature:getName():lower() ~= followName:lower() then return end
if newPos then
lastSeen[newPos.z] = newPos
end
end)
macro(500, "Follow Last Seen", function()
local creature = getCreatureByName(followName)
if creature then
g_game.follow(creature)
return
end
local playerPos = pos()
local knownPos = lastSeen[playerPos.z]
if knownPos and getDistanceBetween(playerPos, knownPos) > 1 then
autoWalk(knownPos, 50, {
ignoreNonPathable = true,
precision = 1
})
end
end)Scan nearby tiles and use matching items when they appear on screen.
local useIds = {
[1948] = true, -- lever
[435] = true, -- hole
[386] = true -- rope spot
}
macro(500, "Use Nearby Items", function()
local base = pos()
for x = -1, 1 do
for y = -1, 1 do
local tile = g_map.getTile({
x = base.x + x,
y = base.y + y,
z = base.z
})
local item = tile and tile:getTopUseThing()
if item and useIds[item:getId()] then
use(item)
delay(500)
return
end
end
end
end)Select a creature and destination tile with a hotkey, then move or rune the target.
local state = {
target = nil,
destination = nil,
pushRune = 3188
}
local function getCreatureFromTile(tile)
if not tile then return nil end
for _, thing in ipairs(tile:getThings()) do
if thing:isCreature() then
return thing
end
end
end
onKeyDown(function(key)
local tile = getTileUnderCursor()
if key == "F8" then
state.target = getCreatureFromTile(tile)
info("Push target selected.")
elseif key == "F9" and tile then
state.destination = tile:getPosition()
info("Push destination selected.")
elseif key == "F10" and state.target and state.destination then
if state.pushRune and state.pushRune > 0 then
useWith(state.pushRune, state.target)
end
g_game.move(state.target, state.destination)
end
end)State and logging values available in every macro file.
storageconfigNameconfigDirnowtimeplayerpanelmainTabMauBotvBotsaveConfigreloadinfowarnerrorlogInfostandTimescheduledelaystoragestorage[key]Persistent table saved per character and config.
configNameconfigNameCurrent macro config name.
configDirconfigDirFull path to the current macro config folder.
nownowCurrent macro timestamp in milliseconds.
timetimeAlias for now.
playerplayerCurrent local player object.
panelpanelCurrent panel used by UI helpers.
mainTabmainTabMain macro panel tab.
MauBotMauBotShared compatibility state table.
vBotvBotAlias for MauBot.
saveConfigsaveConfig()Marks storage for saving.
reloadreload()Reloads the current config.
infoinfo(text)Writes to the macro info log.
warnwarn(text)Writes to the macro warning log.
errorerror(text)Writes to the macro error log.
logInfologInfo(text)Writes a terminal-style info line.
standTimestandTime()Milliseconds since the local player last moved.
scheduleschedule(timeoutMs, callback)Runs callback once after the delay.
delaydelay(durationMs)Pauses the current macro, hotkey, or event callback.
Create repeating macros, hotkeys, setup windows, and screen icons.
macromacromacromacro:isOnmacro:isOffmacro:setOnmacro:setOffmacro:togglemacro:setTooltipmacro:setHotkeymacro:setSetupmacro:openSetuphotkeysinglehotkeyhotkey:setTooltiphotkey:setHotkeyhotkey:setSetuphotkey:openSetupaddIconmacromacro(timeoutMs, name, callback)Creates a named macro row.
macromacro(timeoutMs, name, hotkey, callback)Creates a named macro row with a hotkey label.
macromacro(timeoutMs, callback)Creates a background macro without a row.
macro:isOnmacro:isOn()True when enabled.
macro:isOffmacro:isOff()True when disabled.
macro:setOnmacro:setOn([value])Enables the macro. Passing false disables it.
macro:setOffmacro:setOff([value])Disables the macro. Passing false enables it.
macro:togglemacro:toggle()Toggles enabled state.
macro:setTooltipmacro:setTooltip(text)Sets the row tooltip.
macro:setHotkeymacro:setHotkey(combo)Updates the displayed hotkey combo.
macro:setSetupmacro:setSetup(function(panel, macro) end)Adds a setup button and builds the setup window on click.
macro:openSetupmacro:openSetup()Opens the setup window.
hotkeyhotkey(keys, name, callback)Runs callback when the key combo is pressed.
singlehotkeysinglehotkey(keys, name, callback)Hotkey variant for single key-down actions.
hotkey:setTooltiphotkey:setTooltip(text)Sets the row tooltip.
hotkey:setHotkeyhotkey:setHotkey(combo)Changes the key combo if it is not duplicated.
hotkey:setSetuphotkey:setSetup(function(panel, hotkey) end)Adds a setup button to the hotkey row.
hotkey:openSetuphotkey:openSetup()Opens the setup window.
addIconaddIcon(id, options, callbackOrMacro)Creates a movable screen icon. Options: item, outfit, text, hotkey, movable, switchable, phantom, x, y.
Build controls in the macro panel or inside setSetup.
addTabsetDefaultTabsetupUIcreateWidgetaddSwitchaddButtonaddLabeladdTextEditaddSeparatorUI.SectionUI.FieldUI.NumberFieldUI.HotkeyFieldUI.SwitchUI.IconFieldsUI.ContainerUI.ContainerFieldUI.LabelUI.ButtonUI.TextEditUI.SeparatorUI.EditorWindowUI.SinglelineEditorWindowUI.MultilineEditorWindowUI.ConfirmationWindowUI.createWidgetUI.createWindowUI.createMiniWindowUI.ConfigUI.DualScrollPanelUI.DualScrollItemPanelUI.TwoItemsAndSlotPanelUI.DualLabelUI.LabelAndTextEditUI.SwitchAndButtonPanels.AttackLeaderTargetaddTabaddTab(name)Creates or selects a macro panel tab.
setDefaultTabsetDefaultTab(name)Sets where future UI helpers place widgets.
setupUIsetupUI(otml, parent)Loads an OTML widget string into a panel.
createWidgetcreateWidget(name, parent)Creates and tracks a widget.
addSwitchaddSwitch(id, text, onClick, parent)Creates a switch row.
addButtonaddButton(id, text, onClick, parent)Creates a button.
addLabeladdLabel(id, text, parent)Creates a label.
addTextEditaddTextEdit(id, text, onTextChange, parent)Creates a text input. Callback receives widget and text.
addSeparatoraddSeparator(id, parent)Creates a separator.
UI.SectionUI.Section(title, parent)Creates a setup section header.
UI.FieldUI.Field(label, value, callback, parent)Creates a labeled text field. Callback receives text, widget, row.
UI.NumberFieldUI.NumberField(label, value, callback, parent)Same as UI.Field, intended for numeric values.
UI.HotkeyFieldUI.HotkeyField(label, value, callback, parent)Creates a key combo capture field.
UI.SwitchUI.Switch(label, value, callback, parent)Creates a labeled setup switch. Callback receives boolean, widget, row.
UI.IconFieldsUI.IconFields(icon, config, defaults, parent)Creates icon item and icon text fields.
UI.ContainerUI.Container(callback, unique, parent, widget)Creates an item list editor with setItems and getItems.
UI.ContainerFieldUI.ContainerField(label, items, callback, unique, parent, height)Creates a labeled item list editor.
UI.LabelUI.Label(text, parent)Creates a label with automatic id.
UI.ButtonUI.Button(text, callback, parent)Creates a button with automatic id.
UI.TextEditUI.TextEdit(text, callback, parent)Creates a text edit with automatic id.
UI.SeparatorUI.Separator(parent)Creates a separator with automatic id.
UI.EditorWindowUI.EditorWindow(text, options, callback)Opens an editor window.
UI.SinglelineEditorWindowUI.SinglelineEditorWindow(text, options, callback)Opens a single-line editor.
UI.MultilineEditorWindowUI.MultilineEditorWindow(text, options, callback)Opens a multiline editor.
UI.ConfirmationWindowUI.ConfirmationWindow(title, question, callback)Opens a yes/no confirmation window.
UI.createWidgetUI.createWidget(name, parent)Creates and tracks a widget.
UI.createWindowUI.createWindow(name, parent)Creates, shows, raises, and focuses a window.
UI.createMiniWindowUI.createMiniWindow(name, parent)Creates a mini window.
UI.ConfigUI.Config(parent)Creates a small config panel.
UI.DualScrollPanelUI.DualScrollPanel(params, callback, parent)Creates a two-slider percent range control.
UI.DualScrollItemPanelUI.DualScrollItemPanel(params, callback, parent)Creates a two-slider range control with an item selector.
UI.TwoItemsAndSlotPanelUI.TwoItemsAndSlotPanel(params, callback, parent)Creates a two-item and slot selector panel.
UI.DualLabelUI.DualLabel(left, right, params, parent)Creates a left/right label row.
UI.LabelAndTextEditUI.LabelAndTextEdit(params, callback, parent)Creates a label plus text input row.
UI.SwitchAndButtonUI.SwitchAndButton(params, callbackSwitch, callbackButton, callback, parent)Creates a switch plus button row.
Panels.AttackLeaderTargetPanels.AttackLeaderTarget(parent)Creates a panel that attacks the target hit by a configured leader.
Read character stats, position, equipment, outfit, and conditions.
namehpmaxhphppercentmanamaxmanamanapercentcapfreecapmaxcapexplvlmlevsoulstaminavocblessdirectionspeedskulloutfitsetOutfitsetSpeedhasConditionisPoisonedisBurningisEnergizedisDrunkhasManaShieldisParalyzedhasHastehasSwordscanLogoutisInProtectionZonehasPzLockisDrowningisFreezingisDazzledisCursedhasPartyBuffisBleedingisHungryisBuffedkillsToRsnamename()Character name.
hphp()Current health.
maxhpmaxhp()Maximum health.
hppercenthppercent()Current health percent.
manamana()Current mana.
maxmanamaxmana()Maximum mana.
manapercentmanapercent()Current mana percent.
capcap()Current capacity.
freecapfreecap()Free capacity.
maxcapmaxcap()Total capacity.
expexp()Experience.
lvllvl()Level.
mlevmlev()Magic level.
soulsoul()Soul points.
staminastamina()Stamina.
vocvoc()Vocation id.
blessbless()Blessings value.
directiondirection()Facing direction.
speedspeed()Current speed.
skullskull()Skull value.
outfitoutfit()Current outfit table.
setOutfitsetOutfit(outfit)Changes outfit.
setSpeedsetSpeed(value)Changes local speed when supported.
hasConditionhasCondition(condition)Checks a PlayerStates flag.
isPoisonedisPoisoned()Poison condition.
isBurningisBurning()Burn condition.
isEnergizedisEnergized()Energy condition.
isDrunkisDrunk()Drunk condition.
hasManaShieldhasManaShield()Mana shield condition.
isParalyzedisParalyzed()Paralyze condition.
hasHastehasHaste()Haste condition.
hasSwordshasSwords()In-fight condition.
canLogoutcanLogout()True when not in fight.
isInProtectionZoneisInProtectionZone()Protection zone condition.
hasPzLockhasPzLock()PZ lock/block condition.
isDrowningisDrowning()Drowning condition.
isFreezingisFreezing()Freezing condition.
isDazzledisDazzled()Dazzled condition.
isCursedisCursed()Cursed condition.
hasPartyBuffhasPartyBuff()Party buff condition.
isBleedingisBleeding()Bleeding condition.
isHungryisHungry()Hungry condition.
isBuffedisBuffed()Checks active party buff effect.
killsToRskillsToRs()Remaining unjustified kills before red skull.
Positions, walking, turning, pathfinding, and map view helpers.
posposxposyposzgetPoswalkturnfindAllPathstranslateAllPathsToPathfindPathautoWalkdistanceFromPlayergetMapViewzoomInzoomOutpospos()Current player position.
posxposx()Current x coordinate.
posyposy()Current y coordinate.
poszposz()Current floor.
getPosgetPos(x, y, z)Builds a position table.
walkwalk(direction)Walks one direction.
turnturn(direction)Turns to a direction.
findAllPathsfindAllPaths(start, maxDist, params)Finds reachable path nodes.
translateAllPathsToPathtranslateAllPathsToPath(paths, destPos)Converts path nodes into directions.
findPathfindPath(startPos, destPos, maxDist, params)Finds directions to a destination.
autoWalkautoWalk(destination, maxDist, params)Walks to a destination or along a direction list.
distanceFromPlayerdistanceFromPlayer(coords, fromPos)Chebyshev distance from player or another position.
getMapViewgetMapView()Returns the map panel.
zoomInzoomIn()Zooms map panel in.
zoomOutzoomOut()Zooms map panel out.
Targeting, following, chat, channels, spells, and runes.
attackcancelAttackfollowcancelFollowcancelAttackAndFollowtargettargetPossaysayNpcyelltalkChanneltalkPrivategetChannelsgetChannelIdsaySpellsetSpellTimeoutgetSpellDatagetSpellCoolDowncanCastcastcastSpelluseRunescheduleNpcSayisAttSpellattackattack(creature)Attacks a creature.
cancelAttackcancelAttack()Stops attacking.
followfollow(creature)Follows a creature.
cancelFollowcancelFollow()Stops following.
cancelAttackAndFollowcancelAttackAndFollow()Stops attack and follow.
targettarget()Current attack target.
targetPostargetPos([distance])Target position, or distance when distance is true.
saysay(text)Sends normal chat.
sayNpcsayNpc(text)Sends NPC chat.
yellyell(text)Sends yell chat.
talkChanneltalkChannel(channelId, text)Sends channel chat.
talkPrivatetalkPrivate(receiver, text)Sends private chat.
getChannelsgetChannels()Returns known channels.
getChannelIdgetChannelId(name)Finds a channel id by name.
saySpellsaySpell(text, timeoutMs)Says spell words if timeout passed.
setSpellTimeoutsetSpellTimeout()Updates the local spell timeout.
getSpellDatagetSpellData(spell)Returns spell data by words or name.
getSpellCoolDowngetSpellCoolDown(text)True when spell or group cooldown is active.
canCastcanCast(spell, ignoreRL, ignoreCd)Checks cooldown, level, and mana when data exists.
castcast(text, delayMs)Says text with a local cooldown.
castSpellcastSpell(text)Casts only when canCast returns true.
useRuneuseRune(itemId, target, timeoutMs)Uses a rune item on a target with local timeout.
scheduleNpcSayscheduleNpcSay(text, delayMs)Schedules an NPC message.
isAttSpellisAttSpell(text)True when text starts with exori or exevo.
Inventory slots, containers, item use, and ground item helpers.
useusewithfindItemitemAmountgetContainersgetContainergetContainerByNamegetContainerByItemcontainerIsFullgetInventoryItemgetHeadgetNeckgetBackgetBodygetRightgetLeftgetLeggetFeetgetFingergetAmmogetPurseopenPursereopenPursemoveToSlotdropItemgetActiveItemIdgetInactiveItemIdgetNearTilesfindItemOnGroundisOnTileuseGroundItemreachGroundItemuseOnGroundItemuseOnInventoryItemgetTileUnderCursorcanShootisTrappeduseuse(thingOrItemId, subtype)Uses an item, thing, or inventory item id.
usewithusewith(thingOrItemId, target, subtype)Uses an item on a target.
findItemfindItem(itemId, subType)Finds an item in open containers or inventory.
itemAmountitemAmount(itemId)Counts player items by id.
getContainersgetContainers()Returns open containers.
getContainergetContainer(index)Returns a container by index.
getContainerByNamegetContainerByName(name, notFull)Finds an open container by exact name.
getContainerByItemgetContainerByItem(itemId, notFull)Finds an open container by container item id.
containerIsFullcontainerIsFull(container)Checks whether a container is full.
getInventoryItemgetInventoryItem(slot)Returns the item in an inventory slot.
getHeadgetHead()Head slot item.
getNeckgetNeck()Neck slot item.
getBackgetBack()Backpack slot item.
getBodygetBody()Body slot item.
getRightgetRight()Right hand slot item.
getLeftgetLeft()Left hand slot item.
getLeggetLeg()Leg slot item.
getFeetgetFeet()Feet slot item.
getFingergetFinger()Ring slot item.
getAmmogetAmmo()Ammo slot item.
getPursegetPurse()Purse slot item.
openPurseopenPurse()Uses the purse slot item.
reopenPursereopenPurse()Reopens purse-related containers.
moveToSlotmoveToSlot(itemOrId, slot, count)Moves an item to an inventory slot.
dropItemdropItem(itemOrId)Drops an item on the player position.
getActiveItemIdgetActiveItemId(id)Maps inactive ring/amulet ids to active ids when known.
getInactiveItemIdgetInactiveItemId(id)Maps active ring/amulet ids to inactive ids when known.
getNearTilesgetNearTiles(positionOrCreature)Returns the eight neighboring tiles.
findItemOnGroundfindItemOnGround(itemId)Finds a visible ground item by id.
isOnTileisOnTile(itemId, tileOrPos)Checks whether an item id exists on a tile. Also accepts x, y, z.
useGroundItemuseGroundItem(itemId)Uses the first visible ground item with id.
reachGroundItemreachGroundItem(itemId)Walks toward the first visible ground item with id.
useOnGroundItemuseOnGroundItem(toolItemId, groundItemId)Uses an inventory item on a visible ground item.
useOnInventoryItemuseOnInventoryItem(toolItemId, targetItemId)Uses an item on an inventory item.
getTileUnderCursorgetTileUnderCursor()Returns the tile under the mouse cursor.
canShootcanShoot(pos, distance)Checks if a tile can be shot.
isTrappedisTrapped([creature])True when no neighboring tile is walkable.
Find spectators, players, monsters, NPCs, friends, enemies, and safe tiles.
getSpectatorsgetCreatureByIdgetCreatureByNamegetPlayerByNamegetMonstersInRangegetMonstersgetPlayersgetAllPlayersgetNpcsgetCreaturesInAreaisFriendisEnemygetPlayerDistributiongetFriendsgetNeutralsgetEnemiesisBlackListedPlayerInRangegetBestTileByPatternisSafegetSpectatorsgetSpectators([positionOrCreatureOrPattern], [multifloor])Returns visible spectators.
getCreatureByIdgetCreatureById(id, multifloor)Finds a visible creature by id.
getCreatureByNamegetCreatureByName(name, multifloor)Finds a visible creature by exact name.
getPlayerByNamegetPlayerByName(name, multifloor)Finds a visible player by exact name.
getMonstersInRangegetMonstersInRange(position, range)Counts monsters near a position.
getMonstersgetMonsters(range, multifloor)Counts monsters around the player.
getPlayersgetPlayers(range, multifloor)Counts nearby non-party players.
getAllPlayersgetAllPlayers(range, multifloor)Counts all nearby non-local players.
getNpcsgetNpcs(range, multifloor)Counts nearby NPCs.
getCreaturesInAreagetCreaturesInArea(positionOrPattern, patternOrMultifloor, type)Counts spectators, monsters, or players in an area.
isFriendisFriend(creatureOrName)Checks friend list, party, and shared member state.
isEnemyisEnemy(creatureOrName)Checks enemy list, marks, and emblem state.
getPlayerDistributiongetPlayerDistribution()Splits visible players into three lists.
getFriendsgetFriends()Returns visible friends.
getNeutralsgetNeutrals()Returns visible neutral players.
getEnemiesgetEnemies()Returns visible enemies.
isBlackListedPlayerInRangeisBlackListedPlayerInRange(range)Checks storage.playerList.blackList around the player.
getBestTileByPatterngetBestTileByPattern(pattern, specType, maxDist, safe)Finds the best shootable and walkable tile for an area pattern.
isSafeisSafe(range, multifloor, padding)True when no non-friend player is inside the range.
Load scripts, import styles, read custom configs, and encode data.
loaddofiledofilesloadScriptloadRemoteScriptimportStylefileExistsencodedecodeConfig.existConfig.createConfig.listConfig.parseConfig.loadConfig.loadRawConfig.saveConfig.removeConfig.setuploadload(source)Loads Lua source in the macro context.
dofiledofile(relativePath)Runs a Lua file from the current config folder.
dofilesdofiles(path)Runs all Lua files in a config subfolder recursively.
loadScriptloadScript(pathOrUrl, onLoad)Loads a local or remote script.
loadRemoteScriptloadRemoteScript(url, onLoad)Downloads and runs a remote script.
importStyleimportStyle(otuiPathOrString)Imports an OTUI style from file or string.
fileExistsfileExists(path)Checks whether a mapped macro file exists.
encodeencode(data, indent)Serializes data to text.
decodedecode(text)Parses serialized text. Returns empty table on failure.
Config.existConfig.exist(dir)Checks whether a config directory exists.
Config.createConfig.create(dir)Creates a config directory.
Config.listConfig.list(dir)Lists config names in a directory.
Config.parseConfig.parse(data)Parses saved config text.
Config.loadConfig.load(dir, name)Loads a saved config.
Config.loadRawConfig.loadRaw(dir, name)Loads raw config text.
Config.saveConfig.save(dir, name, value, forcedExtension)Saves table data.
Config.removeConfig.remove(dir, name)Deletes saved files for a config.
Config.setupConfig.setup(dir, widget, extension, callback)Connects config list UI controls to load, save, add, edit, and remove actions.
Register callbacks for client events. Each registration returns a handle with remove().
callbackonKeyDownonKeyUponKeyPressonTalklistenonTextMessageonPlayerPositionChangeonPlayerHealthChangeonPlayerInventoryChangeonCreatureAppearonCreatureDisappearonCreaturePositionChangeonCreatureHealthPercentChangeonAttackingCreatureChangeonTurnonWalkonUseonUseWithonContainerOpenonContainerCloseonContainerUpdateItemonAddItemonRemoveItemonManaChangeonStatesChangeonInventoryChangeonSpellCooldownonGroupSpellCooldownonModalDialogonAddThingonRemoveThingonMissleonAnimatedTextonStaticTextonChannelListonOpenChannelonCloseChannelonChannelEventonLoginAdviceonImbuementWindowonGameEditTextcallbackcallback(type, function(...) end)Low-level event registration.
onKeyDownonKeyDown(function(keyDesc) end)Key down event.
onKeyUponKeyUp(function(keyDesc) end)Key up event.
onKeyPressonKeyPress(function(keyDesc, autoRepeatTicks) end)Key press event.
onTalkonTalk(function(name, level, mode, text, channelId, pos) end)Chat message event.
listenlisten(name, function(text, channelId, pos) end)onTalk filtered by speaker name.
onTextMessageonTextMessage(function(mode, text) end)Text message event.
onPlayerPositionChangeonPlayerPositionChange(function(newPos, oldPos) end)Local player position event.
onPlayerHealthChangeonPlayerHealthChange(function(healthPercent) end)Local player health event.
onPlayerInventoryChangeonPlayerInventoryChange(function(slot, item, oldItem) end)Local player inventory event.
onCreatureAppearonCreatureAppear(function(creature) end)Creature appear event.
onCreatureDisappearonCreatureDisappear(function(creature) end)Creature disappear event.
onCreaturePositionChangeonCreaturePositionChange(function(creature, newPos, oldPos) end)Creature movement event.
onCreatureHealthPercentChangeonCreatureHealthPercentChange(function(creature, percent) end)Creature health percent event.
onAttackingCreatureChangeonAttackingCreatureChange(function(creature, oldCreature) end)Attack target change event.
onTurnonTurn(function(creature, direction) end)Creature turn event.
onWalkonWalk(function(creature, oldPos, newPos) end)Creature walk event.
onUseonUse(function(pos, itemId, stackPos, subType) end)Use action event.
onUseWithonUseWith(function(pos, itemId, target, subType) end)Use-with action event.
onContainerOpenonContainerOpen(function(container, previous) end)Container open event.
onContainerCloseonContainerClose(function(container) end)Container close event.
onContainerUpdateItemonContainerUpdateItem(function(container, slot, item, oldItem) end)Container slot update event.
onAddItemonAddItem(function(container, slot, item) end)Container item added event.
onRemoveItemonRemoveItem(function(container, slot, item) end)Container item removed event.
onManaChangeonManaChange(function(player, mana, maxMana, oldMana, oldMaxMana) end)Mana change event.
onStatesChangeonStatesChange(function(player, states, oldStates) end)Player states change event.
onInventoryChangeonInventoryChange(function(player, slot, item, oldItem) end)Inventory slot change event.
onSpellCooldownonSpellCooldown(function(spellId, delay) end)Spell cooldown event.
onGroupSpellCooldownonGroupSpellCooldown(function(groupId, delay) end)Group cooldown event.
onModalDialogonModalDialog(function(id, title, message, buttons, enter, escape, choices, priority) end)Modal dialog event.
onAddThingonAddThing(function(tile, thing) end)Thing added to tile event.
onRemoveThingonRemoveThing(function(tile, thing) end)Thing removed from tile event.
onMissleonMissle(function(missile) end)Missile event.
onAnimatedTextonAnimatedText(function(...) end)Animated text event.
onStaticTextonStaticText(function(...) end)Static text event.
onChannelListonChannelList(function(...) end)Channel list event.
onOpenChannelonOpenChannel(function(...) end)Open channel event.
onCloseChannelonCloseChannel(function(...) end)Close channel event.
onChannelEventonChannelEvent(function(...) end)Channel event.
onLoginAdviceonLoginAdvice(function(message) end)Login advice event.
onImbuementWindowonImbuementWindow(function(...) end)Imbuement window event.
onGameEditTextonGameEditText(function(...) end)Game edit text event.
NPC trade helpers and simple bot toggles.
NPC.talkNPC.isTradingNPC.getSellItemsNPC.getBuyItemsNPC.getSellQuantityNPC.canTradeItemNPC.sellNPC.buyNPC.sellAllNPC.closeTradeCaveBot.setOnCaveBot.setOffCaveBot.isOnCaveBot.isOffCaveBot.delayTargetBot.setOnTargetBot.setOffTargetBot.isOnTargetBot.isOffBotServer.initBotServer.terminateBotServer.listenBotServer.sendBotServer.isConnectedBotServer.hasListenBotServer.resetReconnectNPC.talkNPC.talk(text)Sends NPC chat.
NPC.isTradingNPC.isTrading()True when NPC trade is open.
NPC.getSellItemsNPC.getSellItems()Returns current NPC sell items.
NPC.getBuyItemsNPC.getBuyItems()Returns current NPC buy items.
NPC.getSellQuantityNPC.getSellQuantity(itemOrId)Returns sellable amount.
NPC.canTradeItemNPC.canTradeItem(itemOrId)Checks whether the item can be traded.
NPC.sellNPC.sell(itemOrId, count, ignoreEquipped)Sells an item.
NPC.buyNPC.buy(itemOrId, count, ignoreCapacity, withBackpack)Buys an item.
NPC.sellAllNPC.sellAll()Runs sell all.
NPC.closeTradeNPC.closeTrade()Closes NPC trade.
CaveBot.setOnCaveBot.setOn()Enables CaveBot.
CaveBot.setOffCaveBot.setOff()Disables CaveBot.
CaveBot.isOnCaveBot.isOn()True when CaveBot is enabled.
CaveBot.isOffCaveBot.isOff()True when CaveBot is disabled.
CaveBot.delayCaveBot.delay(durationMs)Alias for delay.
TargetBot.setOnTargetBot.setOn()Enables TargetBot.
TargetBot.setOffTargetBot.setOff()Disables TargetBot.
TargetBot.isOnTargetBot.isOn()True when TargetBot is enabled.
TargetBot.isOffTargetBot.isOff()True when TargetBot is disabled.
BotServer.initBotServer.init(name, channel)Connects to the bot server.
BotServer.terminateBotServer.terminate()Disconnects and clears listeners.
BotServer.listenBotServer.listen(topic, callback)Listens to a bot server topic.
BotServer.sendBotServer.send(topic, message)Sends a bot server message.
BotServer.isConnectedBotServer.isConnected()Connection status.
BotServer.hasListenBotServer.hasListen(topic)Checks whether a topic has listeners.
BotServer.resetReconnectBotServer.resetReconnect()Stops reconnect attempts.
Small helpers for text, tables, dialogs, screenshots, sounds, and status messages.
getDistanceBetweengetFirstNumberInTextrelogOnCharacterburstDamageValuereindexTablewhiteInfoMessagestatusMessagebroadcastMessagedisplayGeneralBoxdoScreenshotgetVersiongetSoundChannelmauSoundExistsplaySoundstopSoundplayAlarmpingteststring.explodestring.startstable.findtable.isListgetDistanceBetweengetDistanceBetween(p1, p2)Chebyshev distance between two positions.
getFirstNumberInTextgetFirstNumberInText(text)Returns the first integer in text.
relogOnCharacterrelogOnCharacter(namePart)Attempts to login a character matching text.
burstDamageValueburstDamageValue()Recent incoming damage per second estimate.
reindexTablereindexTable(values)Assigns sequential index fields to table entries.
whiteInfoMessagewhiteInfoMessage(text)Displays a white game message or logs info.
statusMessagestatusMessage(text, logInConsole)Displays a status/failure message or logs info.
broadcastMessagebroadcastMessage(text)Displays a broadcast message or warning.
displayGeneralBoxdisplayGeneralBox(title, message, buttons, onEnter, onEscape)Shows a dialog when available.
doScreenshotdoScreenshot(filename)Takes a screenshot.
getVersiongetVersion()Runtime version string.
getSoundChannelgetSoundChannel()Bot sound channel.
mauSoundExistsmauSoundExists(file)Checks whether a sound file exists.
playSoundplaySound(file)Plays a sound.
stopSoundstopSound()Stops sound playback.
playAlarmplayAlarm()Plays the alarm sound.
pingping()Current ping.
testtest()Writes test to the info log.
string.explodestring.explode(text, separator)Splits text by separator.
string.startsstring.starts(text, prefix)Checks a text prefix.
table.findtable.find(list, value, ignoreCase)Finds a value in a table.
table.isListtable.isList(value)True for sequential numeric tables.
Named values available in your macro context.
North0East1South2West3NorthEast4SouthEast5SouthWest6NorthWest7Named values available in your macro context.
SlotOther0SlotHead1SlotNeck2SlotBack3SlotBody4SlotRight5SlotLeft6SlotLeg7SlotFeet8SlotFinger9SlotAmmo10SlotPurse11InventorySlotFirst1InventorySlotLast10Named values available in your macro context.
PlayerStates.Poison1PlayerStates.Burn2PlayerStates.Energy4PlayerStates.Drunk8PlayerStates.ManaShield16PlayerStates.Paralyze32PlayerStates.Haste64PlayerStates.Swords128PlayerStates.Drowning256PlayerStates.Freezing512PlayerStates.Dazzled1024PlayerStates.Cursed2048PlayerStates.PartyBuff4096PlayerStates.PzBlock8192PlayerStates.Pz16384PlayerStates.Bleeding32768PlayerStates.Hungry65536PlayerStates.Rooted524288PlayerStates.Feared1048576PlayerStates.NewManaShield67108864PlayerStates.Agony134217728No matches. Try a function name, an alias or a shorter search.