Documentation › Lua

Function reference

Every function a DrenoxBot script can call, grouped by module. Each module is a global table (Player, Game, Map...).

Modules#

ModulePageWhat it has
PlayerPlayerHP, mana, level, skills, states, inventory, party
GameGameSpeaking, walking, attacking, using items, windows, quests, store, forge, imbuements, tasks
Map and CreatureMap and CreatureTiles, items on the ground, creatures, walking to a spot
Container and InventoryContainer and InventoryOpen bags and equipment slots
Spells and NpcSpells and NpcSpell data and cooldown, buying and selling at the NPC
CaveBotCaveBotWaypoints, labels, pause, lure, sell and refill lists
EngineEngineTurning modules on and off, profiles, alarms, scripts
ClientClientGame window, keyboard, messages, login, fight modes
HUD, CustomModalWindow, Timer and utilitiesHUD, windows and utilitiesDrawing on the screen, windows with buttons, timers, wait, JSON, sound, keys
EnumsEnumsAll the constants

Events (Game.registerEvent) have their own page: Game events.

Conventions#

  • Positions go in as three separate numbers, x, y, z, and come out as a table {x = ..., y = ..., z = ...}.
  • Inventory slots start at 1 (Enums.InventorySlot, from CONST_SLOT_HEAD = 1 to CONST_SLOT_AMMO = 10). Container slots start at 0. Container indexes are those of the window open in the client, starting at 0.
  • Waypoints are counted from 0.
  • Amount in item-moving functions: without it, the bot moves the whole stack; the value goes from 1 to 100.
  • nil means "I don't know" or "I didn't find it": creature off screen, container closed, slot empty. Always test before using the result.
  • Functions that send an action to the server return true when they sent it, or nil/false when there was nothing to do (empty slot, unknown tile). true means the request went out, not that the server accepted it.
  • Item counts only look at what the bot sees: the equipment and the open containers. A closed bag does not count.
lua
-- Positions: go in separate, come out as a table
local p = Player.getPosition()
print(p.x, p.y, p.z)
print(Map.isTileWalkable(p.x + 1, p.y, p.z))

Global functions#

FunctionWhat it does
print(...)Writes to the Console as [script name] text
wait(ms)Pauses the script, without stopping its events and timers
destroyTimer(name)Deletes a timer; true if it existed
require, dofile(path), loadfile(path)Load Lua files starting at the scripts/ folder
IsHealFriendEnabled()The same as Engine.isHealFriendEnabled()

Details in HUD, windows and utilities.