← PXG Helper

POKEXGAMES / PXG Helper

Dokumentacja skryptów

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.

Opublikowana wersja 1.0.125

SZYBKI START

Jak wyglądają skrypty

Auto hotkeyauto 200 say "Tibia"
Cavebot Actionif [$pokemon.exists && $pokemon.hppc > 50] goto "Hunt"
NPCtalktonpc("Nurse Joy")
Route death scriptauto 100 if [$onDead] { gotolabel "Respawn" | wait 200 }
Use map tileUseTile(100, 200, 7)
Use ground itemUseGroundItem(1234)
Action: enable shiny priorityseton ShinyPriority
Hotkey: keep shiny priority enabledauto 200 if [$targeting] seton ShinyPriority
Shortkey: toggle shiny prioritysettoggle "shiny priority"
Shortkey: enable Targeting and Cavebotseton Targeting | seton Cavebot
Route script: restore Targeting after deathauto 100 if [$onDead] { setoff ShinyPriority | seton Targeting | gotolabel "Respawn" | wait 200 }

KOMENDY I WARTOŚCI

Znajdź komendę skryptu

Komendy wykonują działania. Wartości zaczynające się od $ można stosować w warunkach i wyrażeniach.

Flow and variables

auto DELAY COMMAND

Repeat 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] COMMAND

Run the command only when the expression is true. Expressions support arithmetic, comparisons, &&, || and parentheses.

ifnot [EXPRESSION] COMMAND

Run the command only when the expression is false. Uses the same expression syntax as if.

else COMMAND

Run 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 VALUE

Assign a numeric expression to a script-local variable.

inc $NAME

Add 1 to a script-local variable.

dec $NAME

Subtract 1 from a script-local variable.

clear $NAME

Set a script-local variable back to 0.

wait MS

Pause the current script for the specified time in milliseconds (0–600000), then continue.

end

End the current script run.

turnoff

Stop the running script task.

dontlist

Hide the script label from the Hotkey HUD list.

listas NAME

Set the label shown for this script in the Hotkey HUD list.

Game and helper

say TEXT

Send TEXT as a chat message through the game client.

gamesay TEXT

Send TEXT as a chat message through the game client.

castSpell TEXT

Send the supplied spell words through the game client chat.

log TEXT

Display TEXT in the helper’s Cavebot status output.

statusmessage TEXT

Display TEXT in the helper’s Cavebot status output.

displaytext TEXT

Display TEXT in the helper’s Cavebot status output.

moveTo X Y Z

Ask the client to auto-walk to the map coordinates X, Y, Z.

useItem ID

Use 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 ID

Use the inventory item ID on your character.

useItemOnSelf ID

Alias 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 | toggle

Alternative syntax for setfishingon(), setfishingoff() and setfishingtoggle().

stopAttack

Cancel the current attack.

setTargeting VALUE

Enable or disable the Targeting module; use 1/on to enable and 0/off to disable.

startTargeting

Resume the Targeting module.

stopTargeting

Pause the Targeting module.

setCavebot VALUE

Enable or disable Cavebot; use 1/on to enable and 0/off to disable.

setFollowWaypoints VALUE

Alias 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 MODULE

Enable 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 MODULE

Disable ShinyPriority, Targeting or Cavebot; FollowWaypoints also selects Cavebot. Disabling an already disabled module leaves it disabled. Example: setoff ShinyPriority.

settoggle MODULE

Switch 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 contexts

Use 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 commands

Use 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 off

setoff 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 Scripts

Open 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 interval

A 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 lifecycle

Route 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 / Cancel

Save 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 example

Create 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 button

Record 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 Action

An 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 waypoint

Cavebot 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

$connected

Player connection state: 1 when connected to the game, otherwise 0.

$onDead

A 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.

$hp

Player’s current absolute HP.

$maxhp

Player’s maximum HP.

$hppc

Player’s current HP as a percentage. This is the player value in PXG.

$posx

Player’s current map X coordinate.

$posy

Player’s current map Y coordinate.

$posz

Player’s current map floor (Z coordinate).

$targeting

Targeting module state: 1 when enabled, otherwise 0.

$cavebot

Cavebot state: 1 when enabled, otherwise 0.

$pokemon

Boolean-style presence check for your currently summoned Pokémon (1/0).

$pokemon.exists

1 when your own Pokémon is currently summoned, otherwise 0.

$pokemon.hppc

Active summon’s current HP percentage. Returns 0 if no summon is available.

$pokemon.hp

Active summon’s absolute HP value as exposed by the reviewed PXG client panel.

$pokemon.maxhp

Active summon’s maximum HP value as exposed by the reviewed PXG client panel.

$pokemon.id

Client creature ID of your active summon; 0 when unavailable.

$pokemon.posx

Active summon’s current map X coordinate; 0 when unavailable.

$pokemon.posy

Active summon’s current map Y coordinate; 0 when unavailable.

$pokemon.posz

Active 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.

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.