ZeroBot Documentation
website·Indexed 31 days ago
https://docs.zerobot.netComprehensive documentation for ZeroBot, featuring guides on CaveBot configuration, waypoint management, and a detailed Lua scripting API. The API includes modules for the Engine, Game, Player, Creature, Inventory, HUD, and Map, as well as support for game events and JSON serialization.
What's inside ZeroBot
- ZeroBot is organized into independent modules that can be configured and enabled separately. Because available controls and conditions vary based on the game-client version and the selected OTServer, users should validate any new profile on the target server before unattended use.
Manage Magic Shooter profiles
Use theseEnginefunctions to switch between and retrieve information about Magic Shooter profiles. Profiles are indexed from 0 to 9.-- Switch to a specific profile index (0-9) Engine.magicShooterSwitchProfile(profileIndex) -- Get the index of the currently selected profile local currentProfile = Engine.magicShooterGetProfile() -- Get the name of a profile by its index (0-9) local profileName = Engine.magicShooterGetProfileName(index)Understand CaveBot navigation and waypoint logic
CaveBot manages character navigation by following a sequence of waypoints. A waypoint can be defined as a destination, a floor-change action, a lure transition, a label/jump, or a Lua script. Note that CaveBot only handles movement; combat and survival behaviors (such as healing and equipment) must be configured via separate modules like Healing, Targeting, Magic Shooter, and Equipment.Manage Hunting Tasks using the TaskBoard API
The TaskBoard API (requiring protocol 15.20+) provides methods to interact with Bounty, Weekly, and Shop windows. Because these actions are stateful, you must open the corresponding window and wait for the
Game.Events.TASK_BOARD_DATAevent to receive a complete server snapshot before performing actions. ZeroBot caches these snapshots separately for Bounty, Weekly, and Shop, and clears them upon disconnect.Return values for these methods are
trueif the request was accepted by the packet sender, ornilif the protocol is unsupported, a snapshot is missing, or a state check fails. Atruereturn does not guarantee the server completed the action.local function onHuntingTasksData(data) if not data.complete then return end if data.windowType == Enums.TaskBoardWindow.BOUNTY then for _, task in ipairs(data.bounty.tasks) do -- task.index is the zero-based server index print("bounty", task.index, task.raceId, task.currentKills) end elseif data.windowType == Enums.TaskBoardWindow.WEEKLY then for _, task in ipairs(data.weekly.deliveryTasks) do print("delivery", task.index, task.itemId, task.availableItems) end elseif data.windowType == Enums.TaskBoardWindow.SHOP then print("offer count", data.shop.offerCount) end end Game.registerEvent(Game.Events.TASK_BOARD_DATA, onHuntingTasksData) Game.openTaskBoardBounty()Handle Task Board data events
Listen for
Game.Events.TASK_BOARD_DATA(value22) to receive updates about the Task Board state. The callback provides a table containingwindowType(fromEnums.TaskBoardWindow), acompleteboolean, and a data table specific to the window (bounty,weekly, orshop).Important: Do not process the data if
completeis false.Window Types (
Enums.TaskBoardWindow):BOUNTY= 0WEEKLY= 1SHOP= 2
Access static item and monster data
Retrieve comprehensive data about items and monsters available in the client.Client.getAllItems()returns a table of items withidandflags(useEnums.ThingFlagAttrfor bitwise checks).Client.getAllMonsters()returns a list of all monsters, whileClient.getMonsterByRaceId(raceId)retrieves specific data for a single monster race.-- Check if an item is on the ground local items = Client.getAllItems() for _, item in pairs(items) do local isGround = bit.band(item.flags, Enums.ThingFlagAttr.Ground) ~= 0 end -- Get specific monster info local monster = Client.getMonsterByRaceId(1234) print("Monster Name: " .. monster.name)Query map tiles and items
Retrieve information about tiles and the items (things) located at specific coordinates on the map.-- Get all map tiles on screen -- @return A table of all tiles containing things and their position. Map.getTiles() -- Get the things at a specific map position. -- @param x, y, z (number) - Coordinates -- @return A table of things at the specified position, or nil if tile doesn't exist. Map.getThings(x, y, z) -- Get the count of things at a specific map position. -- @param x, y, z (number) - Coordinates -- @return Things count, or nil if tile doesn't exist. Map.getThingsCount(x, y, z)Retrieve container and item information
Methods to get metadata about the container, its capacity, and the items it contains.local index = container:getIndex() local name = container:getName() local items = container:getItems() -- Returns a table of items local capacity = container:getCapacity() local totalItems = container:getItemCount() local countById = container:getItemCountById(itemId)Use Sell Loot and Refill quick action buttons
The CaveBot Options window includes 'Sell Loot' and 'Refill' buttons. These are helper tools that do not use a unique
Enums.WaypointType; instead, they automatically generate a Node waypoint followed by a Script waypoint.- Sell Loot: Sells non-equipped items matching the current Sell List via an open NPC shop.
- Refill: Uses the current Refill List to replenish items. Refill entries follow the format:
{id=ITEM_ID,min=MIN_COUNT,max=MAX_COUNT}.
Because NPC dialogs, prices, and action limits vary between OT servers, you should review the generated script and test it with the target NPC.
{id=268,min=100,max=500}Move items from a container
TheContainerclass provides three methods to move items out of a container: to the player's inventory, to a specific map coordinate (ground), or to another open container.-- Move to inventory container:moveItemToInventory(containerSlot, inventorySlot, itemCount) -- Move to ground container:moveItemToGround(containerSlot, itemCount, toX, toY, toZ) -- Move to another container container:moveItemToContainer(containerSlot, itemCount, toContainerIndex, toContainerSlot)Manage CaveBot configurations
Use the main control buttons to manage your CaveBot setup:
- Load: Import a saved configuration file.
- Save: Save the current configuration.
- New: Clear the current configuration to start over (unsaved changes will be lost).
- Settings: Access advanced configuration options.
- Special Areas: Open the area editor to define regions the bot should avoid.
- Enable Waypoint Colors: Visually distinguish between different waypoint types.
- Encrypt CaveBot on Save: Encrypts the configuration file. Note: Encrypted files cannot be converted back to readable form; maintain an unencrypted backup.
Register and unregister game events
UseGame.registerEventto attach a callback function to a specific game event andGame.unregisterEventto remove it. You must pass the same function reference to both methods.local function onTalk(authorName, authorLevel, talkType, x, y, z, text, channelId) print(authorName, text) end -- Register the event Game.registerEvent(Game.Events.TALK, onTalk) -- Later: Unregister the event Game.unregisterEvent(Game.Events.TALK, onTalk)