POKEXGAMES / PXG Helper
Script Reference
PXG scripts use a bounded, ElfBot-style command language in Hotkeys, Shortkeys, Cavebot Actions and scripts saved with each route. This reference covers the 1.0.125 release.
Published version 1.0.125QUICK START
How scripts look
auto 200 say "Tibia"if [$pokemon.exists && $pokemon.hppc > 50] goto "Hunt"talktonpc("Nurse Joy")auto 100 if [$onDead] { gotolabel "Respawn" | wait 200 }UseTile(100, 200, 7)UseGroundItem(1234)seton ShinyPriorityauto 200 if [$targeting] seton ShinyPrioritysettoggle "shiny priority"seton Targeting | seton Cavebotauto 100 if [$onDead] { setoff ShinyPriority | seton Targeting | gotolabel "Respawn" | wait 200 }COMMANDS & VALUES
Find a script command
Commands do something. Values starting with $ can be used in conditions and expressions.
Flow and variables
auto DELAY COMMANDRepeat the script at the given interval (50–60000 ms). Use in Hotkeys, Shortkeys or Edit Scripts for a route; a waypoint Action runs once and should not use auto.
if [EXPRESSION] COMMANDRun the command only when the expression is true. Expressions support arithmetic, comparisons, &&, || and parentheses.
ifnot [EXPRESSION] COMMANDRun the command only when the expression is false. Uses the same expression syntax as if.
else COMMANDRun an alternative command after a matching if or ifnot when its condition did not pass.
loop COUNT { COMMANDS }Run the block the specified number of times; COUNT must be from 0 to 100.
set $NAME VALUEAssign a numeric expression to a script-local variable.
inc $NAMEAdd 1 to a script-local variable.
dec $NAMESubtract 1 from a script-local variable.
clear $NAMESet a script-local variable back to 0.
wait MSPause the current script for the specified time in milliseconds (0–600000), then continue.
endEnd the current script run.
turnoffStop the running script task.
dontlistHide the script label from the Hotkey HUD list.
listas NAMESet the label shown for this script in the Hotkey HUD list.
Game and helper
say TEXTSend TEXT as a chat message through the game client.
gamesay TEXTSend TEXT as a chat message through the game client.
castSpell TEXTSend the supplied spell words through the game client chat.
log TEXTDisplay TEXT in the helper’s Cavebot status output.
statusmessage TEXTDisplay TEXT in the helper’s Cavebot status output.
displaytext TEXTDisplay TEXT in the helper’s Cavebot status output.
moveTo X Y ZAsk the client to auto-walk to the map coordinates X, Y, Z.
useItem IDUse an inventory item by its numeric item ID.
UseGroundItem(ID)Use the nearest visible ground item with this ID on the player’s floor, within the current 15 × 11 map view. Uses the map item, not an inventory item. Missing items and invalid arguments report an action error. The client still controls proximity and whether use is allowed.
UseTile(X, Y, Z)Use the tile’s top usable item at these coordinates. Missing items, unavailable tiles and invalid arguments report an action error instead of waiting indefinitely. The client still controls proximity and whether use is allowed.
UseTile(Position(X, Y, Z))Equivalent coordinate form of UseTile(X, Y, Z).
useOnSelf IDUse the inventory item ID on your character.
useItemOnSelf IDAlias of useOnSelf: use the inventory item ID on your character.
useFishingRod(X, Y, Z)When the Fishing-slot rod is inactive, cast it on the water tile at X, Y, Z without a crosshair. When that slot holds the active rod (ID 6300), use the rod directly to reel in. Automatic Fishing watches bite effect 390 on the selected tile.
useFishingRood(X, Y, Z)Compatibility alias for useFishingRod(): use the current Fishing-slot item on the selected map tile.
setfishingon()Enable automatic Fishing at the selected position. Requires an online game, a saved position and a usable Fishing-slot item.
setfishingoff()Stop automatic Fishing and clear the Enable Fishing checkbox. Does not remove saved positions or bait.
setfishingtoggle()Toggle automatic Fishing: start it when off, or stop it when on. The checkbox stays in sync.
setfishing on | off | toggleAlternative syntax for setfishingon(), setfishingoff() and setfishingtoggle().
stopAttackCancel the current attack.
setTargeting VALUEEnable or disable the Targeting module; use 1/on to enable and 0/off to disable.
startTargetingResume the Targeting module.
stopTargetingPause the Targeting module.
setCavebot VALUEEnable or disable Cavebot; use 1/on to enable and 0/off to disable.
setFollowWaypoints VALUEAlias of setCavebot: enable or disable Cavebot waypoint following.
setStance "atk" | "bal" | "def"Set the Pokémon fight mode: "atk" = Offensive, "bal" = Balanced, "def" = Defensive. Other accepted names: offensive/off/attack, balanced/balance, defensive/defence/defense. Values are case-insensitive. Use names, not 1/2/3. The alias "off" means Offensive, not disabled. Examples: setStance "atk" and setStance("def").
stance "atk" | "bal" | "def"Alias of setStance: set the Pokémon fight mode to Offensive (atk), Balanced (bal), or Defensive (def). Accepts the same named aliases. Example: stance "def".
talktonpc("NPC NAME")Use the client’s Talk action on a visible NPC with this name. The game server still applies its own interaction-range check.
CallPokemon("1" … "6")Call the selected team slot in the new Pokémon interface. Requires that interface; the helper warns and stops this script in Legacy mode.
CallPokemonLegacy("Primary")Call the primary Pokémon in Legacy mode. Requires Legacy; the helper warns and stops this script in the new interface. Secondary is not supported.
goto "WAYPOINT LABEL"Jump Cavebot to the first waypoint whose custom label matches the given name, without case sensitivity. Function syntax goto("Respawn") is also supported. Create the named waypoint before using it.
gotolabel "WAYPOINT LABEL"Alias of goto: jump to a waypoint with this custom label. Example: gotolabel "Respawn".
Module controls
seton MODULEEnable ShinyPriority, Targeting or Cavebot. FollowWaypoints is an alias of Cavebot. Enabling an already enabled module leaves it enabled. Command and module names are case-insensitive. Example: seton ShinyPriority.
setoff MODULEDisable ShinyPriority, Targeting or Cavebot; FollowWaypoints also selects Cavebot. Disabling an already disabled module leaves it disabled. Example: setoff ShinyPriority.
settoggle MODULESwitch ShinyPriority, Targeting or Cavebot once each time this command runs; FollowWaypoints also selects Cavebot. Example: settoggle ShinyPriority. Use it in a one-shot Action or shortcut.
seton("shiny priority")Function-style and quoted names are supported by seton, setoff and settoggle. ShinyPriority also accepts shiny priority, shiny-priority and shiny_priority. Examples: setoff("ShinyPriority") and settoggle("Cavebot").
Module control contextsUse the same commands in Cavebot Actions, Hotkeys, Shortkeys and Cavebot Edit Scripts saved with a route. These commands change the named helper module; they do not execute arbitrary Lua. Existing setTargeting and setCavebot commands remain available.
Repeated module commandsUse seton or setoff in repeating auto scripts and other persistent route scripts. A repeated settoggle changes the state on every iteration instead of keeping a chosen state.
Turning Cavebot offsetoff Cavebot also stops future runs of its saved route scripts. Enable Cavebot again through its checkbox, a Hotkey or a Shortkey; a stopped route script cannot enable itself on a later iteration.
Scripts saved with a route
Edit ScriptsOpen Edit Scripts in the Cavebot header beside Close, enter one independent persistent script per line, then choose Save with route. Each route keeps its own scripts in the same .cavebot file as its waypoints; no separate profile or global script file is created.
Route script intervalA line without auto uses a 100 ms interval. An explicit auto DELAY prefix accepts 50–60000 ms. Up to 32 scripts and 32000 bytes total are allowed; comment and blank lines are ignored.
Route script lifecycleRoute scripts run only with Cavebot enabled and honor the helper’s global pause. Loading a legacy route without saved scripts clears scripts from the previous route. Empty editor text removes the route’s scripts.
Save with route / CancelSave with route saves scripts and waypoints together atomically. Cancel leaves the route unchanged. A failed save keeps the editor open and retains its text.
Player death exampleCreate a waypoint named Respawn, then add: auto 100 if [$onDead] { gotolabel "Respawn" | wait 200 }. Put the death condition at the beginning of the script line.
Use Tile buttonRecord a UseTile Action at the position selected by Direction: Center uses the player’s tile; North, South, East and West select the adjacent tile. Recording does not use the item. Add a Stand waypoint first when the object requires proximity.
Empty ActionAn empty or whitespace-only Action stays in the route for later editing. Cavebot advances past it without stopping or adding the normal Action cooldown. Invalid nonempty code still reports an error.
Blocked movement waypointCavebot skips a movement waypoint after eight active seconds without an observed position change, or two active minutes of movement oscillation. Combat, loot, catch, revive, global pause and intentional Action waits do not consume the stationary timeout.
Pokémon automation
waitForPokemons(MIN, RANGE)Wait until the requested number of eligible hunt targets are within RANGE SQM. MIN is optional; when omitted, the script waits for all targets found in the current scan. The wait has a 5-second timeout; the default range is 3 SQM.
waitForAllSpells()Wait until every available Pokémon move is ready to cast (not on cooldown or otherwise unavailable).
waitAllSpells()Alias of waitForAllSpells(): wait for every available Pokémon move to be ready.
waitForMoves()Alias of waitForAllSpells(): wait for every available Pokémon move to be ready.
waitAllMoves()Alias of waitForAllSpells(): wait for every available Pokémon move to be ready.
hunt(MIN, RANGE, REVIVE_MODE)Run a managed hunt cycle: wait for hunt targets, defeat them, process loot/catch, then perform the requested recovery step.
huntCycle(MIN, RANGE, REVIVE_MODE)Alias of hunt(): run the managed wait, kill, loot/catch and recovery sequence.
killPokemons(WITH_LOOT, ATTACK_ALL, RANGE)Start or continue attacking eligible nearby Pokémon targets. WITH_LOOT and ATTACK_ALL are optional true/false flags; RANGE is the optional maximum target distance.
killAllPokemons()Run the kill action with broad target selection enabled, using the helper’s current loot and range settings.
setCombo(SLOT, ...)Select move-bar slots for the next combo. Calling with no valid slots clears the configured combo.
setKillCombo(SLOT, ...)Alias of setCombo(): configure the move-bar slots used by the combo.
setMoves(SLOT, ...)Alias of setCombo(): configure the move-bar slots used by the combo.
killCombo(SLOT, ...)Execute the configured or supplied move-slot combo against the current eligible target.
combo(SLOT, ...)Alias of killCombo(): execute a move-slot combo.
killMoves(SLOT, ...)Alias of killCombo(): execute a move-slot combo.
collectLoot()Process the next eligible corpse in Cavebot’s loot queue.
processCatch([CORPSE_ID])Use the configured catch item on the next eligible Pokémon corpse, or on CORPSE_ID when supplied.
reviveIfDead()Start the strict revive workflow only when the helper detects that the Pokémon is dead.
refreshPokemon()Run the helper’s Pokémon recovery/refresh workflow.
processRevive()Alias of refreshPokemon(): run the helper’s Pokémon recovery workflow.
Read-only values
$connectedPlayer connection state: 1 when connected to the game, otherwise 0.
$onDeadA single player-death event delivered once after the trainer is alive again. It describes the trainer, not a dead Pokémon, and does not stay true while the trainer is dead. Put if [$onDead] at the beginning of its route-script line. Route scripts require Cavebot enabled and respect the global pause.
$hpPlayer’s current absolute HP.
$maxhpPlayer’s maximum HP.
$hppcPlayer’s current HP as a percentage. This is the player value in PXG.
$posxPlayer’s current map X coordinate.
$posyPlayer’s current map Y coordinate.
$poszPlayer’s current map floor (Z coordinate).
$targetingTargeting module state: 1 when enabled, otherwise 0.
$cavebotCavebot state: 1 when enabled, otherwise 0.
$pokemonBoolean-style presence check for your currently summoned Pokémon (1/0).
$pokemon.exists1 when your own Pokémon is currently summoned, otherwise 0.
$pokemon.hppcActive summon’s current HP percentage. Returns 0 if no summon is available.
$pokemon.hpActive summon’s absolute HP value as exposed by the reviewed PXG client panel.
$pokemon.maxhpActive summon’s maximum HP value as exposed by the reviewed PXG client panel.
$pokemon.idClient creature ID of your active summon; 0 when unavailable.
$pokemon.posxActive summon’s current map X coordinate; 0 when unavailable.
$pokemon.posyActive summon’s current map Y coordinate; 0 when unavailable.
$pokemon.poszActive summon’s current map floor (Z coordinate); 0 when unavailable.
$pokemon.order(X, Y, Z)Use the Order item on the top usable map target at X, Y, Z. The summon and Order item must be available.
$pokemon.order(Position(X, Y, Z))Equivalent coordinate form using the Position constructor. The summon, Order item and usable map target must be available.
$pokemon.order("self")Use the Order item on your own character. The summon and Order item must be available.
$pokemon.turn("north" | "east" | "south" | "west")Turn your active summon to the requested direction. Requires an active summon.
$pokemon.standstill()Tell your active summon to stop moving. Requires an active summon.
No matching commands in this helper.
PXG does not use $self.hppc; use $hppc for player HP or $pokemon.hppc for the summon. Pokémon actions require an online character and an active summon. CallPokemonLegacy("Secondary") is not supported yet.