Documentation › Lua
Function reference
Every function a DrenoxBot script can call, grouped by module. Each module is a global table (Player, Game, Map...).
Modules#
| Module | Page | What it has |
|---|---|---|
Player | Player | HP, mana, level, skills, states, inventory, party |
Game | Game | Speaking, walking, attacking, using items, windows, quests, store, forge, imbuements, tasks |
Map and Creature | Map and Creature | Tiles, items on the ground, creatures, walking to a spot |
Container and Inventory | Container and Inventory | Open bags and equipment slots |
Spells and Npc | Spells and Npc | Spell data and cooldown, buying and selling at the NPC |
CaveBot | CaveBot | Waypoints, labels, pause, lure, sell and refill lists |
Engine | Engine | Turning modules on and off, profiles, alarms, scripts |
Client | Client | Game window, keyboard, messages, login, fight modes |
HUD, CustomModalWindow, Timer and utilities | HUD, windows and utilities | Drawing on the screen, windows with buttons, timers, wait, JSON, sound, keys |
Enums | Enums | All 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, fromCONST_SLOT_HEAD = 1toCONST_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.
nilmeans "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
truewhen they sent it, ornil/falsewhen there was nothing to do (empty slot, unknown tile).truemeans 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.
-- 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#
| Function | What 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.
Comments
to comment.