Trainer’s Field Manual

PROCatchem Lua API

Every global function and callback for your capture scripts — sorted by type, rendered on an LCD screen, and ready to copy straight into your next route.

Functions
Categories
Callbacks
Docs coverage
Open the Script Builder

Pick a farm mode, a route and a battle plan — the builder writes the Lua and checks every call against this reference before you copy it.

Introduction

PROCatchem exposes a Lua API for script authors. This Slate-style page documents every Lua global function and callback from the current API description.

These are Lua functions, not HTTP endpoints. The included openapi.yaml is retained as source metadata.

name = "Example Script"
author = "YourName"
description = "Simple PROCatchem script."

function onPathAction()
    if getMapName() == "Viridian City" then
        moveToGrass()
    end
end

function onBattleAction()
    attack()
end

PC storage updates are asynchronous. After deposit, withdraw, swap, internal box swap, or release, wait for the server update and re-check PC/team state before issuing the next dependent action.

Every API entry includes a practical Lua scenario, the callback where it belongs, and action/async safety notes.

Script metadata

name()

Signature
result = name()

Script display name shown in the tool.

Practical scenario

Set this metadata once at the top of the Lua file so the Scripts tab displays a recognizable name.

Returns

string example: "value"

GET /lua/metadata/name

name = "Viridian Training Route"

author()

Signature
result = author()

Script author displayed in the tool.

Practical scenario

Set this metadata once at the top of the Lua file so users know who maintains the script.

Returns

string example: "value"

GET /lua/metadata/author

author = "Iron Stark"

description()

Signature
result = description()

Short script description displayed in the tool.

Practical scenario

Use this metadata to explain the route, requirements, and intended behavior before the script starts.

Returns

string example: "value"

GET /lua/metadata/description

description = "Trains in Viridian Forest and returns to the Pokécenter below 25% HP."

Lifecycle callbacks

onStart()

Signature
onStart()

Called when the script starts.

Practical scenario

Initialize counters and log the starting state when the user starts the script.

Returns

void

POST /lua/callbacks/onStart

local encounters = 0

function onStart()
    encounters = 0
    log("Training script started on " .. getMapName())
end

onStop()

Signature
onStop()

Called when the script stops.

Practical scenario

Persist or report final state before the runtime finishes the script.

Returns

void

POST /lua/callbacks/onStop

function onStop()
    log("Script stopped safely.")
end

onPause()

Signature
onPause()

Called when the script is paused.

Practical scenario

Use this callback for status logging or pausing your own timers.

Returns

void

POST /lua/callbacks/onPause

function onPause()
    log("Lua automation paused.")
end

onResume()

Signature
onResume()

Called when the script resumes.

Practical scenario

Re-check game state because the player may have moved or changed the team while paused.

Returns

void

POST /lua/callbacks/onResume

function onResume()
    log("Lua automation resumed on " .. getMapName())
end

onPathAction()

Signature
onPathAction()

Called repeatedly while the player is outside battle. Execute at most one path action per frame.

Practical scenario

This is the main overworld decision callback. Perform no more than one path action per call.

Returns

void

POST /lua/callbacks/onPathAction

function onPathAction()
    if getPokemonHealthPercent(1) < 25 then
        usePokecenter()
        return
    end

    moveToGrass()
end

onBattleAction()

Signature
onBattleAction()

Called repeatedly while the player is in battle. Execute at most one battle action per frame.

Practical scenario

This is the main battle decision callback. Perform no more than one battle action per call.

Returns

void

POST /lua/callbacks/onBattleAction

function onBattleAction()
    if isOpponentShiny() or not isAlreadyCaught() then
        weakAttack()
        return
    end

    attack()
end

onDialogMessage()

Signature
onDialogMessage(message)

Called when a dialog message is received.

Practical scenario

Inspect NPC text to track quests or diagnose unexpected dialog branches.

Parameters

NameTypeRequiredDescription
messagestringyesMessage text provided by the game or sent by the script.

Returns

void

POST /lua/callbacks/onDialogMessage

function onDialogMessage(message)
    if stringContains(message, "badge") then
        log("Badge requirement detected: " .. message)
    end
end

onBattleMessage()

Signature
onBattleMessage(message)

Called when a battle message is received.

Practical scenario

Inspect battle text for events that are not exposed as dedicated state helpers.

Parameters

NameTypeRequiredDescription
messagestringyesMessage text provided by the game or sent by the script.

Returns

void

POST /lua/callbacks/onBattleMessage

function onBattleMessage(message)
    if stringContains(message, "fainted") then
        log("A Pokémon fainted: " .. message)
    end
end

onSystemMessage()

Signature
onSystemMessage(message)

Called when a system message is received.

Practical scenario

Use system messages to confirm server-side actions such as catches, releases, or item usage.

Parameters

NameTypeRequiredDescription
messagestringyesMessage text provided by the game or sent by the script.

Returns

void

POST /lua/callbacks/onSystemMessage

function onSystemMessage(message)
    log("SYSTEM: " .. message)
end

onWarningMessage()

Signature
onWarningMessage(differentMap, distance)

Called when a warning message is received; distance can be -1 when unavailable.

Practical scenario

Record warnings so a long-running script can be diagnosed later.

Parameters

NameTypeRequiredDescription
differentMapbooleanyesValue passed to the `differentMap` parameter.
distanceintegeryesValue passed to the `distance` parameter.

Returns

void

POST /lua/callbacks/onWarningMessage

function onWarningMessage(message)
    logToFile("logs/warnings.txt", message)
end

onLearningMove()

Signature
onLearningMove(moveName, pokemonIndex)

Called when a Pokémon is learning a move.

Practical scenario

Choose which move to forget when the game asks a Pokémon to learn a new move.

Parameters

NameTypeRequiredDescription
moveNamestringyesExact move name as shown by the game.
pokemonIndexintegeryesOne-based Pokémon index in the current team.

Returns

void

POST /lua/callbacks/onLearningMove

function onLearningMove(moveName, pokemonIndex)
    if moveName == "Thunderbolt" then
        forgetAnyMoveExcept("Thunderbolt")
    else
        forgetMove(1)
    end
end

Core utilities

log()

Signature
log(message)

Displays the specified message to the message log.

Practical scenario

Write concise diagnostics that identify the current map, Pokémon, or decision branch.

Parameters

NameTypeRequiredDescription
messagestringyesMessage text provided by the game or sent by the script.

Returns

void

POST /lua/core-utilities/log

function onStart()
    log("Script started on " .. getMapName())
end

fatal()

Signature
fatal(message)

Displays the specified message to the message log and stop the bot.

Practical scenario

Stop immediately when a required precondition is missing and explain how the user can fix it.

Parameters

NameTypeRequiredDescription
messagestringyesMessage text provided by the game or sent by the script.

Returns

void

POST /lua/core-utilities/fatal

function onStart()
    if getTeamSize() == 0 then
        fatal("A Pokémon team is required before this script can run.")
    end
end

logout()

Signature
logout(message)

Displays the specified message to the message log and logs out.

Practical scenario

Use a guarded condition so the script does not request logout on every frame.

Parameters

NameTypeRequiredDescription
messagestringyesMessage text provided by the game or sent by the script.

Returns

void

POST /lua/core-utilities/logout

function onPathAction()
    if getMoney() < 100 then
        logout("Stopping: not enough money to continue safely.")
        return
    end
end

relog()

Signature
relog(delay, message)

Logs out and logs back in after the specified number of seconds.

Practical scenario

Schedule a reconnect only from a guarded branch, such as recovering from a known server state.

Parameters

NameTypeRequiredDescription
delaynumberyesValue passed to the `delay` parameter.
messagestringyesMessage text provided by the game or sent by the script.

Returns

void

POST /lua/core-utilities/relog

function onWarningMessage(differentMap, distance)
    if differentMap then
        relog(15, "Map synchronization failed; reconnecting.")
    end
end

restart()

Signature
restart(delay, message)

Start the script.

Practical scenario

Restart a script only after detecting a state that cannot be recovered inside the current run.

Parameters

NameTypeRequiredDescription
delayintegeryesValue passed to the `delay` parameter.
messagestringyesMessage text provided by the game or sent by the script.

Returns

void

POST /lua/core-utilities/restart

function onWarningMessage(differentMap, distance)
    if distance > 10 then
        restart(5, "Player position is too far from the expected route.")
    end
end

stringContains()

Signature
result = stringContains(haystack, needle)

Returns true if the string contains the specified part, ignoring the case.

Practical scenario

Use case-insensitive message checks to recognize dialog, battle, or system text.

Parameters

NameTypeRequiredDescription
haystackstringyesValue passed to the `haystack` parameter.
needlestringyesValue passed to the `needle` parameter.

Returns

boolean example: true

POST /lua/core-utilities/stringcontains

function onDialogMessage(message)
    if stringContains(message, "other badges") then
        log("This NPC is blocking progress until more badges are earned.")
    end
end

playSound()

Signature
playSound(file)

Returns playing a custom sound.

Practical scenario

Use this helper for diagnostics or lifecycle control. Avoid calling restart/logout helpers repeatedly every frame.

Parameters

NameTypeRequiredDescription
filestringyesPath relative to the script/tool data directory.

Returns

void

POST /lua/core-utilities/playsound

function onStart()
    function onStart()
    playSound("logs/script.txt")
end
end

registerHook()

Signature
registerHook(eventName, callback)

Calls the specified function when the specified event occurs.

Practical scenario

Register a callback once, usually from `onStart`, rather than registering it every frame.

Parameters

NameTypeRequiredDescription
eventNamestringyesValue passed to the `eventName` parameter.
callbackLuaValueyesAny Lua value.

Returns

void

POST /lua/core-utilities/registerhook

function onStart()
    registerHook("battle", function(message)
        log("Battle hook: " .. tostring(message))
    end)
end

Workflow

executeSteps()

Signature
executeSteps(steps, options)

Runs a list of steps (other Lua functions/APIs) as one ordered action. Each step is a function, a { "name", function } pair, or a { name, run, args, continueOnError } table. Honours the one-bot-action-per-frame rule via stopOnAction (default true): it stops at the first step that performs a bot action and returns nextIndex to resume next frame.

Practical scenario

Group query/helper work and stop at the first real bot action, then resume from `nextIndex` on a later frame.

Parameters

NameTypeRequiredDescription
stepsarray<object>yesOrdered Lua functions/step descriptors to execute.
optionsobjectnoOptional execution settings table.

Returns

object

POST /lua/workflow/execute-steps

local nextStep = 1

function onPathAction()
    local result = executeSteps({
        { "log map", function() log(getMapName()) end },
        { "move", moveToGrass }
    }, { stopOnAction = true, logProgress = true, startIndex = nextStep })

    nextStep = result.nextIndex or 1
end

Map and NPC

getPlayerX()

Signature
result = getPlayerX()

Returns the X-coordinate of the current cell.

Practical scenario

Use this query in overworld logic to choose a safe destination or NPC interaction.

Returns

integer example: 1

POST /lua/map-and-npc/getplayerx

function onPathAction()
    function onPathAction()
    local result = getPlayerX()
    log("getPlayerX: " .. tostring(result))
end
    log("getPlayerX: " .. tostring(result))
end

getPlayerY()

Signature
result = getPlayerY()

Returns the Y-coordinate of the current cell.

Practical scenario

Use this query in overworld logic to choose a safe destination or NPC interaction.

Returns

integer example: 1

POST /lua/map-and-npc/getplayery

function onPathAction()
    function onPathAction()
    local result = getPlayerY()
    log("getPlayerY: " .. tostring(result))
end
    log("getPlayerY: " .. tostring(result))
end

getMapName()

Signature
result = getMapName()

Returns the name of the current map.

Practical scenario

Use this query in overworld logic to choose a safe destination or NPC interaction.

Returns

string example: "value"

POST /lua/map-and-npc/getmapname

function onPathAction()
    function onPathAction()
    local result = getMapName()
    log("getMapName: " .. tostring(result))
end
    log("getMapName: " .. tostring(result))
end

getActiveBattlers()

Signature
result = getActiveBattlers()

API return an array of all NPCs that can be challenged on the current map. format : {"npcName" = {"x" = x, "y" = y}}

Practical scenario

Use this query in overworld logic to choose a safe destination or NPC interaction.

Returns

object example: {}

POST /lua/map-and-npc/getactivebattlers

function onPathAction()
    function onPathAction()
    local result = getActiveBattlers()
    log("getActiveBattlers: " .. tostring(result))
end
    log("getActiveBattlers: " .. tostring(result))
end

getActiveDigSpots()

Signature
result = getActiveDigSpots()

API return an array of all usable Dig Spots on the currrent map. format : {index = {"x" = x, "y" = y}}

Practical scenario

Use this query in overworld logic to choose a safe destination or NPC interaction.

Returns

array<object> example: {}

POST /lua/map-and-npc/getactivedigspots

function onPathAction()
    function onPathAction()
    local result = getActiveDigSpots()
    log("getActiveDigSpots: " .. tostring(result))
end
    log("getActiveDigSpots: " .. tostring(result))
end

getActiveHeadbuttTrees()

Signature
result = getActiveHeadbuttTrees()

API return an array of all usable Headbutt trees on the currrent map. format : {index = {"x" = x, "y" = y}}

Practical scenario

Use this query in overworld logic to choose a safe destination or NPC interaction.

Returns

array<object> example: {}

POST /lua/map-and-npc/getactiveheadbutttrees

function onPathAction()
    function onPathAction()
    local result = getActiveHeadbuttTrees()
    log("getActiveHeadbuttTrees: " .. tostring(result))
end
    log("getActiveHeadbuttTrees: " .. tostring(result))
end

getActiveBerryTrees()

Signature
result = getActiveBerryTrees()

API return an array of all harvestable berry trees on the currrent map. format : {index = {"x" = x, "y" = y}}

Practical scenario

Use this query in overworld logic to choose a safe destination or NPC interaction.

Returns

array<object> example: {}

POST /lua/map-and-npc/getactiveberrytrees

function onPathAction()
    function onPathAction()
    local result = getActiveBerryTrees()
    log("getActiveBerryTrees: " .. tostring(result))
end
    log("getActiveBerryTrees: " .. tostring(result))
end

getDiscoverableItems()

Signature
result = getDiscoverableItems()

API return an array of all discoverable items on the currrent map. format : {index = {"x" = x, "y" = y}}

Practical scenario

Use this query in overworld logic to choose a safe destination or NPC interaction.

Returns

array<object> example: {}

POST /lua/map-and-npc/getdiscoverableitems

function onPathAction()
    function onPathAction()
    local result = getDiscoverableItems()
    log("getDiscoverableItems: " .. tostring(result))
end
    log("getDiscoverableItems: " .. tostring(result))
end

getDiscoverablePokestops()

Signature
result = getDiscoverablePokestops()

API return an array of all pokestops on the current map. format : {index = {"x" = x, "y" = y}}

Practical scenario

Use this query in overworld logic to choose a safe destination or NPC interaction.

Returns

array<object> example: {}

POST /lua/map-and-npc/getdiscoverablepokestops

function onPathAction()
    function onPathAction()
    local result = getDiscoverablePokestops()
    log("getDiscoverablePokestops: " .. tostring(result))
end
    log("getDiscoverablePokestops: " .. tostring(result))
end

getDiscoverableAbandonedPokemon()

Signature
result = getDiscoverableAbandonedPokemon()

API return an array of all Abandoned Pokemon on the current map. format : {index = {"x" = x, "y" = y}}

Practical scenario

Use this query in overworld logic to choose a safe destination or NPC interaction.

Returns

array<object> example: {}

POST /lua/map-and-npc/getdiscoverableabandonedpokemon

function onPathAction()
    function onPathAction()
    local result = getDiscoverableAbandonedPokemon()
    log("getDiscoverableAbandonedPokemon: " .. tostring(result))
end
    log("getDiscoverableAbandonedPokemon: " .. tostring(result))
end

getNpcData()

Signature
result = getNpcData()

Returns npc data on current map, format : { { "x" = x , "y" = y, "type" = type }, {...}, ... }

Practical scenario

Use this query in overworld logic to choose a safe destination or NPC interaction.

Returns

array<object> example: {}

POST /lua/map-and-npc/getnpcdata

function onPathAction()
    function onPathAction()
    local result = getNpcData()
    log("getNpcData: " .. tostring(result))
end
    log("getNpcData: " .. tostring(result))
end

getMapWidth()

Signature
result = getMapWidth()

The number of cells on the current map in the x direction.

Practical scenario

Use this query in overworld logic to choose a safe destination or NPC interaction.

Returns

integer example: 1

POST /lua/map-and-npc/getmapwidth

function onPathAction()
    function onPathAction()
    local result = getMapWidth()
    log("getMapWidth: " .. tostring(result))
end
    log("getMapWidth: " .. tostring(result))
end

getMapHeight()

Signature
result = getMapHeight()

The number of cells on the current map in the y direction.

Practical scenario

Use this query in overworld logic to choose a safe destination or NPC interaction.

Returns

integer example: 1

POST /lua/map-and-npc/getmapheight

function onPathAction()
    function onPathAction()
    local result = getMapHeight()
    log("getMapHeight: " .. tostring(result))
end
    log("getMapHeight: " .. tostring(result))
end

getCellType()

Signature
result = getCellType(x, y)

Returns the cell type of the specified cell on the current map.

Practical scenario

Use this query in overworld logic to choose a safe destination or NPC interaction.

Parameters

NameTypeRequiredDescription
xintegeryesMap X coordinate.
yintegeryesMap Y coordinate.

Returns

string example: "value"

POST /lua/map-and-npc/getcelltype

function onPathAction()
    function onPathAction()
    local result = getCellType(10, 15)
    log("getCellType: " .. tostring(result))
end
    log("getCellType: " .. tostring(result))
end

isNpcVisible()

Signature
result = isNpcVisible(npcName)

Returns true if there is a visible NPC with the specified name on the map.

Practical scenario

Use this query in overworld logic to choose a safe destination or NPC interaction.

Parameters

NameTypeRequiredDescription
npcNamestringyesExact or documented NPC name.

Returns

boolean example: true

POST /lua/map-and-npc/isnpcvisible

function onPathAction()
    function onPathAction()
    local result = isNpcVisible("Nurse Joy")
    log("isNpcVisible: " .. tostring(result))
end
    log("isNpcVisible: " .. tostring(result))
end

isNpcOnCell()

Signature
result = isNpcOnCell(cellX, cellY)

Returns true if there is a visible NPC the specified coordinates.

Practical scenario

Use this query in overworld logic to choose a safe destination or NPC interaction.

Parameters

NameTypeRequiredDescription
cellXintegeryesValue passed to the `cellX` parameter.
cellYintegeryesValue passed to the `cellY` parameter.

Returns

boolean example: true

POST /lua/map-and-npc/isnpconcell

function onPathAction()
    function onPathAction()
    local result = isNpcOnCell(10, 15)
    log("isNpcOnCell: " .. tostring(result))
end
    log("isNpcOnCell: " .. tostring(result))
end

isInArea()

Signature
result = isInArea(text)

Check condition list cell

Practical scenario

Use the condition-string syntax expected by the tool to test whether the current coordinates satisfy a route region.

Parameters

NameTypeRequiredDescription
textstringyesValue passed to the `text` parameter.

Returns

boolean example: true

POST /lua/map-and-npc/isinarea

function onPathAction()
    local insideRoute = isInArea(">=:10->=:15?&&,<=:20-<=:25?&&")
    if insideRoute then
        moveToGrass()
        return
    end
end

General state

getAccountName()

Signature
result = getAccountName()

Returns current account name.

Practical scenario

Use this query as a guard before an action that depends on the current global state.

Returns

string example: "value"

POST /lua/general-state/getaccountname

function onPathAction()
    function onPathAction()
    local result = getAccountName()
    log("getAccountName: " .. tostring(result))
end
    log("getAccountName: " .. tostring(result))
end

getPokedexOwned()

Signature
result = getPokedexOwned()

Returns Owned Entry of the pokedex

Practical scenario

Use this query as a guard before an action that depends on the current global state.

Returns

integer example: 1

POST /lua/general-state/getpokedexowned

function onPathAction()
    function onPathAction()
    local result = getPokedexOwned()
    log("getPokedexOwned: " .. tostring(result))
end
    log("getPokedexOwned: " .. tostring(result))
end

getPokedexSeen()

Signature
result = getPokedexSeen()

Returns Seen Entry of the pokedex

Practical scenario

Use this query as a guard before an action that depends on the current global state.

Returns

integer example: 1

POST /lua/general-state/getpokedexseen

function onPathAction()
    function onPathAction()
    local result = getPokedexSeen()
    log("getPokedexSeen: " .. tostring(result))
end
    log("getPokedexSeen: " .. tostring(result))
end

getPokedexEvolved()

Signature
result = getPokedexEvolved()

Returns Evolved Entry of the pokedex

Practical scenario

Use this query as a guard before an action that depends on the current global state.

Returns

integer example: 1

POST /lua/general-state/getpokedexevolved

function onPathAction()
    function onPathAction()
    local result = getPokedexEvolved()
    log("getPokedexEvolved: " .. tostring(result))
end
    log("getPokedexEvolved: " .. tostring(result))
end

getTeamSize()

Signature
result = getTeamSize()

Returns the amount of pokémon in the team.

Practical scenario

Use this query as a guard before an action that depends on the current global state.

Returns

integer example: 1

POST /lua/general-state/getteamsize

function onPathAction()
    function onPathAction()
    local result = getTeamSize()
    log("getTeamSize: " .. tostring(result))
end
    log("getTeamSize: " .. tostring(result))
end

isGameScriptActive()

Signature
result = isGameScriptActive()

Lua function isGameScriptActive.

Practical scenario

Use this query as a guard before an action that depends on the current global state.

Returns

boolean example: true

POST /lua/general-state/isgamescriptactive

function onPathAction()
    function onPathAction()
    local result = isGameScriptActive()
    log("isGameScriptActive: " .. tostring(result))
end
    log("isGameScriptActive: " .. tostring(result))
end

isAccountMember()

Signature
result = isAccountMember()

Returns current account's membership status.

Practical scenario

Use this query as a guard before an action that depends on the current global state.

Returns

boolean example: true

POST /lua/general-state/isaccountmember

function onPathAction()
    function onPathAction()
    local result = isAccountMember()
    log("isAccountMember: " .. tostring(result))
end
    log("isAccountMember: " .. tostring(result))
end

getRemainingPowerPoints()

Signature
result = getRemainingPowerPoints(pokemonIndex, moveName)

Returns the remaining power points of the specified move of the specified pokémon in the team.

Practical scenario

Use this query as a guard before an action that depends on the current global state.

Parameters

NameTypeRequiredDescription
pokemonIndexintegeryesOne-based Pokémon index in the current team.
moveNamestringyesExact move name as shown by the game.

Returns

integer example: 1

POST /lua/general-state/getremainingpowerpoints

function onPathAction()
    function onPathAction()
    local result = getRemainingPowerPoints(1, "Tackle")
    log("getRemainingPowerPoints: " .. tostring(result))
end
    log("getRemainingPowerPoints: " .. tostring(result))
end

isShopOpen()

Signature
result = isShopOpen()

Returns true if there is a shop opened.

Practical scenario

Use this query as a guard before an action that depends on the current global state.

Returns

boolean example: true

POST /lua/general-state/isshopopen

function onPathAction()
    function onPathAction()
    local result = isShopOpen()
    log("isShopOpen: " .. tostring(result))
end
    log("isShopOpen: " .. tostring(result))
end

isRelearningMoves()

Signature
result = isRelearningMoves()

Returns true if the player is relearning the move of a Pokemon from an NPC.

Practical scenario

Use this query as a guard before an action that depends on the current global state.

Returns

boolean example: true

POST /lua/general-state/isrelearningmoves

function onPathAction()
    function onPathAction()
    local result = isRelearningMoves()
    log("isRelearningMoves: " .. tostring(result))
end
    log("isRelearningMoves: " .. tostring(result))
end

getMoney()

Signature
result = getMoney()

Returns the amount of money in the inventory.

Practical scenario

Use this query as a guard before an action that depends on the current global state.

Returns

integer example: 1

POST /lua/general-state/getmoney

function onPathAction()
    function onPathAction()
    local result = getMoney()
    log("getMoney: " .. tostring(result))
end
    log("getMoney: " .. tostring(result))
end

isMounted()

Signature
result = isMounted()

Returns true if the player is riding a mount or the bicycle.

Practical scenario

Use this query as a guard before an action that depends on the current global state.

Returns

boolean example: true

POST /lua/general-state/ismounted

function onPathAction()
    function onPathAction()
    local result = isMounted()
    log("isMounted: " .. tostring(result))
end
    log("isMounted: " .. tostring(result))
end

isSurfing()

Signature
result = isSurfing()

Returns true if the player is surfing

Practical scenario

Use this query as a guard before an action that depends on the current global state.

Returns

boolean example: true

POST /lua/general-state/issurfing

function onPathAction()
    function onPathAction()
    local result = isSurfing()
    log("isSurfing: " .. tostring(result))
end
    log("isSurfing: " .. tostring(result))
end

isPrivateMessageEnabled()

Signature
result = isPrivateMessageEnabled()

Check if the private message from normal users are blocked.

Practical scenario

Use this query as a guard before an action that depends on the current global state.

Returns

boolean example: true

POST /lua/general-state/isprivatemessageenabled

function onPathAction()
    function onPathAction()
    local result = isPrivateMessageEnabled()
    log("isPrivateMessageEnabled: " .. tostring(result))
end
    log("isPrivateMessageEnabled: " .. tostring(result))
end

isPartyInspectionEnabled()

Signature
result = isPartyInspectionEnabled()

Check if party inspections are turned on.

Practical scenario

Use this query as a guard before an action that depends on the current global state.

Returns

boolean example: true

POST /lua/general-state/ispartyinspectionenabled

function onPathAction()
    function onPathAction()
    local result = isPartyInspectionEnabled()
    log("isPartyInspectionEnabled: " .. tostring(result))
end
    log("isPartyInspectionEnabled: " .. tostring(result))
end

isNpcInteractionsEnabled()

Signature
result = isNpcInteractionsEnabled()

Returns true if the bot is checking for npc interactions.

Practical scenario

Use this query as a guard before an action that depends on the current global state.

Returns

boolean example: true

POST /lua/general-state/isnpcinteractionsenabled

function onPathAction()
    function onPathAction()
    local result = isNpcInteractionsEnabled()
    log("isNpcInteractionsEnabled: " .. tostring(result))
end
    log("isNpcInteractionsEnabled: " .. tostring(result))
end

getTime()

Signature
hour, minute = getTime()

Return the current in game hour and minute.

Practical scenario

Read both return values when a route should run only during a specific in-game time window.

Returns

object example: {"hour": 12, "minute": 34}

POST /lua/general-state/gettime

function onPathAction()
    local hour, minute = getTime()

    if hour >= 20 or hour < 5 then
        log(string.format("Night route active at %02d:%02d", hour, minute))
        moveToGrass()
        return
    end
end

isMorning()

Signature
result = isMorning()

Return true if morning time.

Practical scenario

Use this query as a guard before an action that depends on the current global state.

Returns

boolean example: true

POST /lua/general-state/ismorning

function onPathAction()
    function onPathAction()
    local result = isMorning()
    log("isMorning: " .. tostring(result))
end
    log("isMorning: " .. tostring(result))
end

isNoon()

Signature
result = isNoon()

Return true if noon time.

Practical scenario

Use this query as a guard before an action that depends on the current global state.

Returns

boolean example: true

POST /lua/general-state/isnoon

function onPathAction()
    function onPathAction()
    local result = isNoon()
    log("isNoon: " .. tostring(result))
end
    log("isNoon: " .. tostring(result))
end

isNight()

Signature
result = isNight()

Return true if night time.

Practical scenario

Use this query as a guard before an action that depends on the current global state.

Returns

boolean example: true

POST /lua/general-state/isnight

function onPathAction()
    function onPathAction()
    local result = isNight()
    log("isNight: " .. tostring(result))
end
    log("isNight: " .. tostring(result))
end

isOutside()

Signature
result = isOutside()

Return true if the character is outside.

Practical scenario

Use this query as a guard before an action that depends on the current global state.

Returns

boolean example: true

POST /lua/general-state/isoutside

function onPathAction()
    function onPathAction()
    local result = isOutside()
    log("isOutside: " .. tostring(result))
end
    log("isOutside: " .. tostring(result))
end

isAutoEvolve()

Signature
result = isAutoEvolve()

Return the state Auto Evolve

Practical scenario

Use this query as a guard before an action that depends on the current global state.

Returns

boolean example: true

POST /lua/general-state/isautoevolve

function onPathAction()
    function onPathAction()
    local result = isAutoEvolve()
    log("isAutoEvolve: " .. tostring(result))
end
    log("isAutoEvolve: " .. tostring(result))
end

setMount()

Signature
result = setMount(mount)

Configure the ground mount or bike item that the bot should use while moving on outside ground maps. Pass the exact item name, for example Arcanine Mount or Blue Bicycle. Pass an empty string to clear the configured ground mount. The function only configures the item; the tool uses it automatically before movement when appropriate.

Practical scenario

Configure this state deliberately and verify the related query before issuing further movement.

Parameters

NameTypeRequiredDescription
mountstringyesExact mount or bicycle item name; an empty string clears the configuration.

Returns

boolean example: true

POST /lua/general-state/setmount

function onStart()
    function onStart()
    local result = setMount("Arcanine Mount")
    log("Configured setMount.")
end
    log("Configured setMount.")
end

disMount()

Signature
result = disMount()

Disables automatic ground mounting and dismounts the currently active ground mount by toggling the official mount item packet. It affects ground mounts and bicycles only; it does not cancel Surf. The configured ground mount is cleared, so call setMount() again before expecting automatic ground mounting later. Returns true when the configured mount was cleared or a dismount packet was sent, otherwise false when there was nothing to change.

Practical scenario

Use this before entering an area where a ground mount is unwanted. It also clears automatic ground-mount configuration.

Returns

boolean example: true

POST /lua/general-state/dismount

function onPathAction()
    if isMounted() and not isSurfing() then
        disMount()
        return
    end

    moveToCell(10, 15)
end

setWaterMount()

Signature
result = setWaterMount(mount)

Configure an optional water mount item that should be used when the bot needs to start surfing. Call this before a path that may enter water. Most scripts can leave it unset; without a water mount, useSurf() and pathfinding use the normal /surf flow. Pass an empty string to clear the configured water mount.

Practical scenario

Configure this state deliberately and verify the related query before issuing further movement.

Parameters

NameTypeRequiredDescription
mountstringyesExact mount or bicycle item name; an empty string clears the configuration.

Returns

boolean example: true

POST /lua/general-state/setwatermount

function onStart()
    function onStart()
    local result = setWaterMount("Lapras Mount")
    log("Configured setWaterMount.")
end
    log("Configured setWaterMount.")
end

isCurrentPCBoxRefreshed()

Signature
result = isCurrentPCBoxRefreshed()

Returns true when the latest requested PC box action has completed or there is no pending PC box refresh. Use this after usePC(), openPCBox(), or refreshPCBox() before reading PC Pokémon data.

Practical scenario

Use this query as a guard before an action that depends on the current global state.

Returns

boolean example: true

POST /lua/general-state/iscurrentpcboxrefreshed

function onPathAction()
    function onPathAction()
    local result = isCurrentPCBoxRefreshed()
    log("isCurrentPCBoxRefreshed: " .. tostring(result))
end
    log("isCurrentPCBoxRefreshed: " .. tostring(result))
end

getServer()

Signature
result = getServer()

Returns the connected server

Practical scenario

Use this query as a guard before an action that depends on the current global state.

Returns

string example: "value"

POST /lua/general-state/getserver

function onPathAction()
    function onPathAction()
    local result = getServer()
    log("getServer: " .. tostring(result))
end
    log("getServer: " .. tostring(result))
end

Team Pokémon

getPokemonId()

Signature
result = getPokemonId(index)

Returns the ID of the specified pokémon in the team.

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.

Returns

integer example: 1

POST /lua/team-pok-mon/getpokemonid

function onPathAction()
    function onPathAction()
    local result = getPokemonId(1)
    log("getPokemonId: " .. tostring(result))
end
    log("getPokemonId: " .. tostring(result))
end

getPokemonName()

Signature
result = getPokemonName(index)

Returns the name of the specified pokémon in the team.

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.

Returns

string example: "value"

POST /lua/team-pok-mon/getpokemonname

function onPathAction()
    function onPathAction()
    local result = getPokemonName(1)
    log("getPokemonName: " .. tostring(result))
end
    log("getPokemonName: " .. tostring(result))
end

getPokemonHealth()

Signature
result = getPokemonHealth(index)

Returns the current health of the specified pokémon in the team.

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.

Returns

integer example: 1

POST /lua/team-pok-mon/getpokemonhealth

function onPathAction()
    function onPathAction()
    local result = getPokemonHealth(1)
    log("getPokemonHealth: " .. tostring(result))
end
    log("getPokemonHealth: " .. tostring(result))
end

getPokemonHealthPercent()

Signature
result = getPokemonHealthPercent(index)

Returns the percentage of remaining health of the specified pokémon in the team.

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.

Returns

integer example: 1

POST /lua/team-pok-mon/getpokemonhealthpercent

function onPathAction()
    function onPathAction()
    local result = getPokemonHealthPercent(1)
    log("getPokemonHealthPercent: " .. tostring(result))
end
    log("getPokemonHealthPercent: " .. tostring(result))
end

getPokemonMaxHealth()

Signature
result = getPokemonMaxHealth(index)

Returns the maximum health of the specified pokémon in the team.

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.

Returns

integer example: 1

POST /lua/team-pok-mon/getpokemonmaxhealth

function onPathAction()
    function onPathAction()
    local result = getPokemonMaxHealth(1)
    log("getPokemonMaxHealth: " .. tostring(result))
end
    log("getPokemonMaxHealth: " .. tostring(result))
end

getPokemonLevel()

Signature
result = getPokemonLevel(index)

Returns the level of the specified pokémon in the team.

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.

Returns

integer example: 1

POST /lua/team-pok-mon/getpokemonlevel

function onPathAction()
    function onPathAction()
    local result = getPokemonLevel(1)
    log("getPokemonLevel: " .. tostring(result))
end
    log("getPokemonLevel: " .. tostring(result))
end

getPokemonTotalExperience()

Signature
result = getPokemonTotalExperience(index)

Returns the experience total of a pokemon level.

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.

Returns

integer example: 1

POST /lua/team-pok-mon/getpokemontotalexperience

function onPathAction()
    function onPathAction()
    local result = getPokemonTotalExperience(1)
    log("getPokemonTotalExperience: " .. tostring(result))
end
    log("getPokemonTotalExperience: " .. tostring(result))
end

getPokemonRemainingExperience()

Signature
result = getPokemonRemainingExperience(index)

Returns the remaining experience of a pokemon before next level.

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.

Returns

integer example: 1

POST /lua/team-pok-mon/getpokemonremainingexperience

function onPathAction()
    function onPathAction()
    local result = getPokemonRemainingExperience(1)
    log("getPokemonRemainingExperience: " .. tostring(result))
end
    log("getPokemonRemainingExperience: " .. tostring(result))
end

getPokemonStatus()

Signature
result = getPokemonStatus(index)

Returns the status of the specified pokémon in the team.

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.

Returns

string example: "value"

POST /lua/team-pok-mon/getpokemonstatus

function onPathAction()
    function onPathAction()
    local result = getPokemonStatus(1)
    log("getPokemonStatus: " .. tostring(result))
end
    log("getPokemonStatus: " .. tostring(result))
end

getPokemonForm()

Signature
result = getPokemonForm(index)

Returns the form of the specified pokémon in the team (0 if no form).

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.

Returns

integer example: 1

POST /lua/team-pok-mon/getpokemonform

function onPathAction()
    function onPathAction()
    local result = getPokemonForm(1)
    log("getPokemonForm: " .. tostring(result))
end
    log("getPokemonForm: " .. tostring(result))
end

getPokemonHeldItem()

Signature
result = getPokemonHeldItem(index)

Returns the item held by the specified pokemon in the team, null if empty.

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.

Returns

string example: "value"

POST /lua/team-pok-mon/getpokemonhelditem

function onPathAction()
    function onPathAction()
    local result = getPokemonHeldItem(1)
    log("getPokemonHeldItem: " .. tostring(result))
end
    log("getPokemonHeldItem: " .. tostring(result))
end

getPokemonUniqueId()

Signature
result = getPokemonUniqueId(pokemonUid)

PROCatchem unique ID of the pokemon of the current box matching the ID.

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Parameters

NameTypeRequiredDescription
pokemonUidintegeryesStable Pokémon database/unique identifier returned by the corresponding query API.

Returns

integer example: 1

POST /lua/team-pok-mon/getpokemonuniqueid

function onPathAction()
    function onPathAction()
    local result = getPokemonUniqueId(1)
    log("getPokemonUniqueId: " .. tostring(result))
end
    log("getPokemonUniqueId: " .. tostring(result))
end

getPokemonMaxPowerPoints()

Signature
result = getPokemonMaxPowerPoints(index, moveId)

Max move PP of the pokemon of the current box matching the ID.

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.
moveIdintegeryesValue passed to the `moveId` parameter.

Returns

integer example: 1

POST /lua/team-pok-mon/getpokemonmaxpowerpoints

function onPathAction()
    function onPathAction()
    local result = getPokemonMaxPowerPoints(1, "Tackle")
    log("getPokemonMaxPowerPoints: " .. tostring(result))
end
    log("getPokemonMaxPowerPoints: " .. tostring(result))
end

isPokemonShiny()

Signature
result = isPokemonShiny(index)

Returns the shyniness of the specified pokémon in the team.

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.

Returns

boolean example: true

POST /lua/team-pok-mon/ispokemonshiny

function onPathAction()
    function onPathAction()
    local result = isPokemonShiny(1)
    log("isPokemonShiny: " .. tostring(result))
end
    log("isPokemonShiny: " .. tostring(result))
end

getPokemonMoveName()

Signature
result = getPokemonMoveName(index, moveId)

Returns the move of the specified pokémon in the team at the specified index.

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.
moveIdintegeryesValue passed to the `moveId` parameter.

Returns

string example: "value"

POST /lua/team-pok-mon/getpokemonmovename

function onPathAction()
    function onPathAction()
    local result = getPokemonMoveName(1, "Tackle")
    log("getPokemonMoveName: " .. tostring(result))
end
    log("getPokemonMoveName: " .. tostring(result))
end

getPokemonMoveAccuracy()

Signature
result = getPokemonMoveAccuracy(index, moveId)

Returns the move accuracy of the specified pokémon in the team at the specified index.

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.
moveIdintegeryesValue passed to the `moveId` parameter.

Returns

integer example: 1

POST /lua/team-pok-mon/getpokemonmoveaccuracy

function onPathAction()
    function onPathAction()
    local result = getPokemonMoveAccuracy(1, "Tackle")
    log("getPokemonMoveAccuracy: " .. tostring(result))
end
    log("getPokemonMoveAccuracy: " .. tostring(result))
end

getPokemonMovePower()

Signature
result = getPokemonMovePower(index, moveId)

Returns the move power of the specified pokémon in the team at the specified index.

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.
moveIdintegeryesValue passed to the `moveId` parameter.

Returns

integer example: 1

POST /lua/team-pok-mon/getpokemonmovepower

function onPathAction()
    function onPathAction()
    local result = getPokemonMovePower(1, "Tackle")
    log("getPokemonMovePower: " .. tostring(result))
end
    log("getPokemonMovePower: " .. tostring(result))
end

getPokemonMoveType()

Signature
result = getPokemonMoveType(index, moveId)

Returns the move type of the specified pokémon in the team at the specified index.

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.
moveIdintegeryesValue passed to the `moveId` parameter.

Returns

string example: "value"

POST /lua/team-pok-mon/getpokemonmovetype

function onPathAction()
    function onPathAction()
    local result = getPokemonMoveType(1, "Tackle")
    log("getPokemonMoveType: " .. tostring(result))
end
    log("getPokemonMoveType: " .. tostring(result))
end

getPokemonMoveDamageType()

Signature
result = getPokemonMoveDamageType(index, moveId)

Returns the move damage type of the specified pokémon in the team at the specified index.

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.
moveIdintegeryesValue passed to the `moveId` parameter.

Returns

string example: "value"

POST /lua/team-pok-mon/getpokemonmovedamagetype

function onPathAction()
    function onPathAction()
    local result = getPokemonMoveDamageType(1, "Tackle")
    log("getPokemonMoveDamageType: " .. tostring(result))
end
    log("getPokemonMoveDamageType: " .. tostring(result))
end

getPokemonMoveStatus()

Signature
result = getPokemonMoveStatus(index, moveId)

Returns true if the move of the specified pokémon in the team at the specified index can apply a status .

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.
moveIdintegeryesValue passed to the `moveId` parameter.

Returns

boolean example: true

POST /lua/team-pok-mon/getpokemonmovestatus

function onPathAction()
    function onPathAction()
    local result = getPokemonMoveStatus(1, "Tackle")
    log("getPokemonMoveStatus: " .. tostring(result))
end
    log("getPokemonMoveStatus: " .. tostring(result))
end

getPokemonNature()

Signature
result = getPokemonNature(index)

Nature of the pokemon of the current box matching the ID.

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.

Returns

string example: "value"

POST /lua/team-pok-mon/getpokemonnature

function onPathAction()
    function onPathAction()
    local result = getPokemonNature(1)
    log("getPokemonNature: " .. tostring(result))
end
    log("getPokemonNature: " .. tostring(result))
end

getPokemonAbility()

Signature
result = getPokemonAbility(index)

Ability of the pokemon of the current box matching the ID.

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.

Returns

string example: "value"

POST /lua/team-pok-mon/getpokemonability

function onPathAction()
    function onPathAction()
    local result = getPokemonAbility(1)
    log("getPokemonAbility: " .. tostring(result))
end
    log("getPokemonAbility: " .. tostring(result))
end

getPokemonStat()

Signature
result = getPokemonStat(pokemonIndex, statType)

Returns the value for the specified stat of the specified pokémon in the team.

Practical scenario

Read a current team stat by its documented stat key.

Parameters

NameTypeRequiredDescription
pokemonIndexintegeryesOne-based Pokémon index in the current team.
statTypestringyesStat name: `HP`, `ATK`, `DEF`, `SPATK`, `SPDEF`, or `SPD` (speed). The long forms `HEALTH`, `ATTACK`, `DEFENCE`/`DEFENSE`, `SPATTACK`, `SPDEFENCE`/`SPDEFENSE` and `SPEED` also work; anything else stops the script.

Returns

integer example: 1

POST /lua/team-pok-mon/getpokemonstat

function onPathAction()
    local speed = getPokemonStat(1, "SPE")
    log("Lead Pokémon Speed: " .. tostring(speed))
end

getPokemonEffortValue()

Signature
result = getPokemonEffortValue(pokemonIndex, statType)

Returns the effort value for the specified stat of the specified pokémon in the team.

Practical scenario

Inspect a team Pokémon EV before deciding whether to keep training that stat.

Parameters

NameTypeRequiredDescription
pokemonIndexintegeryesOne-based Pokémon index in the current team.
statTypestringyesStat name: `HP`, `ATK`, `DEF`, `SPATK`, `SPDEF`, or `SPD` (speed). The long forms `HEALTH`, `ATTACK`, `DEFENCE`/`DEFENSE`, `SPATTACK`, `SPDEFENCE`/`SPDEFENSE` and `SPEED` also work; anything else stops the script.

Returns

integer example: 1

POST /lua/team-pok-mon/getpokemoneffortvalue

function onPathAction()
    local attackEV = getPokemonEffortValue(1, "ATK")
    if attackEV >= 252 then
        log("Attack EV training is complete.")
    end
end

getPokemonIndividualValue()

Signature
result = getPokemonIndividualValue(pokemonIndex, statType)

Returns the individual value for the specified stat of the specified pokémon in the team.

Practical scenario

Inspect a team Pokémon IV when filtering catches or selecting a lead.

Parameters

NameTypeRequiredDescription
pokemonIndexintegeryesOne-based Pokémon index in the current team.
statTypestringyesStat name: `HP`, `ATK`, `DEF`, `SPATK`, `SPDEF`, or `SPD` (speed). The long forms `HEALTH`, `ATTACK`, `DEFENCE`/`DEFENSE`, `SPATTACK`, `SPDEFENCE`/`SPDEFENSE` and `SPEED` also work; anything else stops the script.

Returns

integer example: 1

POST /lua/team-pok-mon/getpokemonindividualvalue

function onPathAction()
    local speedIV = getPokemonIndividualValue(1, "SPE")
    log("Lead Pokémon Speed IV: " .. tostring(speedIV))
end

getPokemonHappiness()

Signature
result = getPokemonHappiness(index)

Returns the happiness of the specified pokémon in the team.

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.

Returns

integer example: 1

POST /lua/team-pok-mon/getpokemonhappiness

function onPathAction()
    function onPathAction()
    local result = getPokemonHappiness(1)
    log("getPokemonHappiness: " .. tostring(result))
end
    log("getPokemonHappiness: " .. tostring(result))
end

getPokemonRegion()

Signature
result = getPokemonRegion(index)

Returns the region of capture of the specified pokémon in the team.

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.

Returns

string example: "value"

POST /lua/team-pok-mon/getpokemonregion

function onPathAction()
    function onPathAction()
    local result = getPokemonRegion(1)
    log("getPokemonRegion: " .. tostring(result))
end
    log("getPokemonRegion: " .. tostring(result))
end

getPokemonOriginalTrainer()

Signature
result = getPokemonOriginalTrainer(index)

Returns the original trainer of the specified pokémon in the team.

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.

Returns

string example: "value"

POST /lua/team-pok-mon/getpokemonoriginaltrainer

function onPathAction()
    function onPathAction()
    local result = getPokemonOriginalTrainer(1)
    log("getPokemonOriginalTrainer: " .. tostring(result))
end
    log("getPokemonOriginalTrainer: " .. tostring(result))
end

getPokemonGender()

Signature
result = getPokemonGender(index)

Returns the gender of the specified pokémon in the team.

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.

Returns

string example: "value"

POST /lua/team-pok-mon/getpokemongender

function onPathAction()
    function onPathAction()
    local result = getPokemonGender(1)
    log("getPokemonGender: " .. tostring(result))
end
    log("getPokemonGender: " .. tostring(result))
end

getPokemonType()

Signature
result = getPokemonType(index)

Returns the type of the specified pokémon in the team as an array of length 2.

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.

Returns

array<string> example: []

POST /lua/team-pok-mon/getpokemontype

function onPathAction()
    function onPathAction()
    local result = getPokemonType(1)
    log("getPokemonType: " .. tostring(result))
end
    log("getPokemonType: " .. tostring(result))
end

getDamageMultiplier()

Signature
result = getDamageMultiplier(attacker, ...)

Returns the multiplier of the damage type between an attacking type and one or two defending types.

Practical scenario

Compare one attacking type against the opponent's one or two defending types.

Parameters

NameTypeRequiredDescription
attackerstringyesValue passed to the `attacker` parameter.
defenderarray<LuaValue>yesValue passed to the `defender` parameter.

Returns

number example: 1.0

POST /lua/team-pok-mon/getdamagemultiplier

function onBattleAction()
    local opponentTypes = getOpponentType()
    local multiplier = getDamageMultiplier("ELECTRIC", opponentTypes)

    if multiplier >= 2 then
        useMove("Thunderbolt")
    else
        attack()
    end
end

isPokemonUsable()

Signature
result = isPokemonUsable(index)

Returns true if the specified pokémon has is alive and has an offensive attack available.

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.

Returns

boolean example: true

POST /lua/team-pok-mon/ispokemonusable

function onPathAction()
    function onPathAction()
    local result = isPokemonUsable(1)
    log("isPokemonUsable: " .. tostring(result))
end
    log("isPokemonUsable: " .. tostring(result))
end

getUsablePokemonCount()

Signature
result = getUsablePokemonCount()

Returns the amount of usable pokémon in the team.

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Returns

integer example: 1

POST /lua/team-pok-mon/getusablepokemoncount

function onPathAction()
    function onPathAction()
    local result = getUsablePokemonCount()
    log("getUsablePokemonCount: " .. tostring(result))
end
    log("getUsablePokemonCount: " .. tostring(result))
end

hasMove()

Signature
result = hasMove(pokemonIndex, moveName)

Returns true if the specified pokémon has a move with the specified name.

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Parameters

NameTypeRequiredDescription
pokemonIndexintegeryesOne-based Pokémon index in the current team.
moveNamestringyesExact move name as shown by the game.

Returns

boolean example: true

POST /lua/team-pok-mon/hasmove

function onPathAction()
    function onPathAction()
    local result = hasMove(1, "Tackle")
    log("hasMove: " .. tostring(result))
end
    log("hasMove: " .. tostring(result))
end

hasPokemonInTeam()

Signature
result = hasPokemonInTeam(pokemonName)

Returns true if the specified pokémon is present in the team.

Practical scenario

Guard routes that require a specific Pokémon in the current team.

Parameters

NameTypeRequiredDescription
pokemonNamestringyesValue passed to the `pokemonName` parameter.

Returns

boolean example: true

POST /lua/team-pok-mon/haspokemoninteam

function onPathAction()
    if not hasPokemonInTeam("Pikachu") then
        fatal("Put Pikachu in the team before starting this route.")
        return
    end

    moveToGrass()
end

isTeamSortedByLevelAscending()

Signature
result = isTeamSortedByLevelAscending()

Returns true if the team is sorted by level in ascending order.

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Returns

boolean example: true

POST /lua/team-pok-mon/isteamsortedbylevelascending

function onPathAction()
    function onPathAction()
    local result = isTeamSortedByLevelAscending()
    log("isTeamSortedByLevelAscending: " .. tostring(result))
end
    log("isTeamSortedByLevelAscending: " .. tostring(result))
end

isTeamSortedByLevelDescending()

Signature
result = isTeamSortedByLevelDescending()

Returns true if the team is sorted by level in descending order.

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Returns

boolean example: true

POST /lua/team-pok-mon/isteamsortedbyleveldescending

function onPathAction()
    function onPathAction()
    local result = isTeamSortedByLevelDescending()
    log("isTeamSortedByLevelDescending: " .. tostring(result))
end
    log("isTeamSortedByLevelDescending: " .. tostring(result))
end

isTeamRangeSortedByLevelAscending()

Signature
result = isTeamRangeSortedByLevelAscending(fromIndex, toIndex)

Returns true if the specified part of the team is sorted by level in ascending order.

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Parameters

NameTypeRequiredDescription
fromIndexintegeryesValue passed to the `fromIndex` parameter.
toIndexintegeryesValue passed to the `toIndex` parameter.

Returns

boolean example: true

POST /lua/team-pok-mon/isteamrangesortedbylevelascending

function onPathAction()
    function onPathAction()
    local result = isTeamRangeSortedByLevelAscending(10, 10)
    log("isTeamRangeSortedByLevelAscending: " .. tostring(result))
end
    log("isTeamRangeSortedByLevelAscending: " .. tostring(result))
end

isTeamRangeSortedByLevelDescending()

Signature
result = isTeamRangeSortedByLevelDescending(fromIndex, toIndex)

Returns true if the specified part of the team the team is sorted by level in descending order.

Practical scenario

Use this query to make team decisions before selecting a path or battle action.

Parameters

NameTypeRequiredDescription
fromIndexintegeryesValue passed to the `fromIndex` parameter.
toIndexintegeryesValue passed to the `toIndex` parameter.

Returns

boolean example: true

POST /lua/team-pok-mon/isteamrangesortedbyleveldescending

function onPathAction()
    function onPathAction()
    local result = isTeamRangeSortedByLevelDescending(10, 10)
    log("isTeamRangeSortedByLevelDescending: " .. tostring(result))
end
    log("isTeamRangeSortedByLevelDescending: " .. tostring(result))
end

Items and shop

hasItem()

Signature
result = hasItem(itemName)

Returns true if the specified item is in the inventory.

Practical scenario

Use this query to guard an item or shop action and avoid sending requests that cannot succeed.

Parameters

NameTypeRequiredDescription
itemNamestringyesExact item name as shown in the inventory.

Returns

boolean example: true

POST /lua/items-and-shop/hasitem

function onPathAction()
    function onPathAction()
    local result = hasItem("Potion")
    if result then
        log("hasItem condition is true")
    end
end
    if result then
        log("hasItem condition is true")
    end
end

getItemQuantity()

Signature
result = getItemQuantity(itemName)

Returns the quantity of the specified item in the inventory.

Practical scenario

Use this query to guard an item or shop action and avoid sending requests that cannot succeed.

Parameters

NameTypeRequiredDescription
itemNamestringyesExact item name as shown in the inventory.

Returns

integer example: 1

POST /lua/items-and-shop/getitemquantity

function onPathAction()
    function onPathAction()
    local result = getItemQuantity("Potion")
    if result then
        log("getItemQuantity condition is true")
    end
end
    if result then
        log("getItemQuantity condition is true")
    end
end

hasItemId()

Signature
result = hasItemId(itemid)

Returns true if the specified item is in the inventory.

Practical scenario

Use this query to guard an item or shop action and avoid sending requests that cannot succeed.

Parameters

NameTypeRequiredDescription
itemidintegeryesValue passed to the `itemid` parameter.

Returns

boolean example: true

POST /lua/items-and-shop/hasitemid

function onPathAction()
    function onPathAction()
    local result = hasItemId("Potion")
    if result then
        log("hasItemId condition is true")
    end
end
    if result then
        log("hasItemId condition is true")
    end
end

getItemQuantityId()

Signature
result = getItemQuantityId(itemid)

Returns the quantity of the specified item in the inventory.

Practical scenario

Use this query to guard an item or shop action and avoid sending requests that cannot succeed.

Parameters

NameTypeRequiredDescription
itemidintegeryesValue passed to the `itemid` parameter.

Returns

integer example: 1

POST /lua/items-and-shop/getitemquantityid

function onPathAction()
    function onPathAction()
    local result = getItemQuantityId("Potion")
    if result then
        log("getItemQuantityId condition is true")
    end
end
    if result then
        log("getItemQuantityId condition is true")
    end
end

buyItem()

Signature
result = buyItem(itemName, quantity)

Buys the specified item from the opened shop.

Practical scenario

Check inventory/shop state first, perform this action once, then return so the server can update state.

Parameters

NameTypeRequiredDescription
itemNamestringyesExact item name as shown in the inventory.
quantityintegeryesValue passed to the `quantity` parameter.

Returns

boolean example: true

POST /lua/items-and-shop/buyitem

function onPathAction()
    function onPathAction()
    local result = buyItem("Potion", 15)
    return
end
    return
end

hasShopItem()

Signature
result = hasShopItem(itemName)

Lua function hasShopItem.

Practical scenario

Use this query to guard an item or shop action and avoid sending requests that cannot succeed.

Parameters

NameTypeRequiredDescription
itemNamestringyesExact item name as shown in the inventory.

Returns

boolean example: true

POST /lua/items-and-shop/hasshopitem

function onPathAction()
    function onPathAction()
    local result = hasShopItem("Potion")
    if result then
        log("hasShopItem condition is true")
    end
end
    if result then
        log("hasShopItem condition is true")
    end
end

giveItemToPokemon()

Signature
result = giveItemToPokemon(itemName, pokemonIndex)

Give the specified item on the specified pokemon.

Practical scenario

Check inventory/shop state first, perform this action once, then return so the server can update state.

Parameters

NameTypeRequiredDescription
itemNamestringyesExact item name as shown in the inventory.
pokemonIndexintegeryesOne-based Pokémon index in the current team.

Returns

boolean example: true

POST /lua/items-and-shop/giveitemtopokemon

function onPathAction()
    function onPathAction()
    local result = giveItemToPokemon("Potion", 1)
    return
end
    return
end

takeItemFromPokemon()

Signature
result = takeItemFromPokemon(index)

Take the held item from the specified pokemon.

Practical scenario

Check inventory/shop state first, perform this action once, then return so the server can update state.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.

Returns

boolean example: true

POST /lua/items-and-shop/takeitemfrompokemon

function onPathAction()
    function onPathAction()
    local result = takeItemFromPokemon(1)
    return
end
    return
end

useItem()

Signature
result = useItem(itemName)

Uses the specified item.

Practical scenario

Check inventory/shop state first, perform this action once, then return so the server can update state.

Parameters

NameTypeRequiredDescription
itemNamestringyesExact item name as shown in the inventory.

Returns

boolean example: true

POST /lua/items-and-shop/useitem

function onPathAction()
    function onPathAction()
    local result = useItem("Potion")
    return
end
    return
end

useItemOnPokemon()

Signature
result = useItemOnPokemon(itemName, pokemonIndex)

Uses the specified item on the specified pokémon.

Practical scenario

Check inventory/shop state first, perform this action once, then return so the server can update state.

Parameters

NameTypeRequiredDescription
itemNamestringyesExact item name as shown in the inventory.
pokemonIndexintegeryesOne-based Pokémon index in the current team.

Returns

boolean example: true

POST /lua/items-and-shop/useitemonpokemon

function onPathAction()
    function onPathAction()
    local result = useItemOnPokemon("Potion", 1)
    return
end
    return
end

PC storage

getCurrentPCBoxId()

Signature
result = getCurrentPCBoxId()

Get the active PC Box.

Practical scenario

Read this value only after the PC is open and the selected box is refreshed.

Returns

integer example: 1

POST /lua/pc-storage/getcurrentpcboxid

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local result = getCurrentPCBoxId()
    log("getCurrentPCBoxId: " .. tostring(result))
end
    log("getCurrentPCBoxId: " .. tostring(result))
end

isPCOpen()

Signature
result = isPCOpen()

Check if the PC is open. Moving close the PC, usePC() opens it.

Practical scenario

Read this value only after the PC is open and the selected box is refreshed.

Returns

boolean example: true

POST /lua/pc-storage/ispcopen

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local result = isPCOpen()
    log("isPCOpen: " .. tostring(result))
end
    log("isPCOpen: " .. tostring(result))
end

getCurrentPCBoxSize()

Signature
result = getCurrentPCBoxSize()

Returns the number of Pokémon currently cached in the visible PC box. PC boxes can hold up to 30 slots; use this as the safe upper bound for one-based boxPokemonId indexes after the box is refreshed.

Practical scenario

Read this value only after the PC is open and the selected box is refreshed.

Returns

integer example: 1

POST /lua/pc-storage/getcurrentpcboxsize

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local result = getCurrentPCBoxSize()
    log("getCurrentPCBoxSize: " .. tostring(result))
end
    log("getCurrentPCBoxSize: " .. tostring(result))
end

getPCBoxCount()

Signature
result = getPCBoxCount()

Return the number of non-empty boxes in the PC

Practical scenario

Read this value only after the PC is open and the selected box is refreshed.

Returns

integer example: 1

POST /lua/pc-storage/getpcboxcount

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local result = getPCBoxCount()
    log("getPCBoxCount: " .. tostring(result))
end
    log("getPCBoxCount: " .. tostring(result))
end

getPCPokemonCount()

Signature
result = getPCPokemonCount()

Returns the latest known total Pokémon count for the current PC storage view. The value is read from server PC metadata when available and should not be inferred from internal slot IDs.

Practical scenario

Read this value only after the PC is open and the selected box is refreshed.

Returns

integer example: 1

POST /lua/pc-storage/getpcpokemoncount

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local result = getPCPokemonCount()
    log("getPCPokemonCount: " .. tostring(result))
end
    log("getPCPokemonCount: " .. tostring(result))
end

getPokemonIdFromPC()

Signature
result = getPokemonIdFromPC(boxId, boxPokemonId)

Pokedex ID of the pokemon of the current box matching the ID.

Practical scenario

Read this value only after the PC is open and the selected box is refreshed.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.

Returns

integer example: 1

POST /lua/pc-storage/getpokemonidfrompc

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local result = getPokemonIdFromPC(1, 1)
    log("getPokemonIdFromPC: " .. tostring(result))
end
    log("getPokemonIdFromPC: " .. tostring(result))
end

getPokemonNameFromPC()

Signature
result = getPokemonNameFromPC(boxId, boxPokemonId)

Name of the pokemon of the current box matching the ID.

Practical scenario

Read this value only after the PC is open and the selected box is refreshed.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.

Returns

string example: "value"

POST /lua/pc-storage/getpokemonnamefrompc

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local result = getPokemonNameFromPC(1, 1)
    log("getPokemonNameFromPC: " .. tostring(result))
end
    log("getPokemonNameFromPC: " .. tostring(result))
end

getPokemonHealthFromPC()

Signature
result = getPokemonHealthFromPC(boxId, boxPokemonId)

Current HP of the pokemon of the current box matching the ID.

Practical scenario

Read this value only after the PC is open and the selected box is refreshed.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.

Returns

integer example: 1

POST /lua/pc-storage/getpokemonhealthfrompc

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local result = getPokemonHealthFromPC(1, 1)
    log("getPokemonHealthFromPC: " .. tostring(result))
end
    log("getPokemonHealthFromPC: " .. tostring(result))
end

getPokemonHealthPercentFromPC()

Signature
result = getPokemonHealthPercentFromPC(boxId, boxPokemonId)

Returns the percentage of remaining health of the specified pokémon in the team.

Practical scenario

Read this value only after the PC is open and the selected box is refreshed.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.

Returns

integer example: 1

POST /lua/pc-storage/getpokemonhealthpercentfrompc

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local result = getPokemonHealthPercentFromPC(1, 1)
    log("getPokemonHealthPercentFromPC: " .. tostring(result))
end
    log("getPokemonHealthPercentFromPC: " .. tostring(result))
end

getPokemonMaxHealthFromPC()

Signature
result = getPokemonMaxHealthFromPC(boxId, boxPokemonId)

Max HP of the pokemon of the current box matching the ID.

Practical scenario

Read this value only after the PC is open and the selected box is refreshed.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.

Returns

integer example: 1

POST /lua/pc-storage/getpokemonmaxhealthfrompc

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local result = getPokemonMaxHealthFromPC(1, 1)
    log("getPokemonMaxHealthFromPC: " .. tostring(result))
end
    log("getPokemonMaxHealthFromPC: " .. tostring(result))
end

getPokemonLevelFromPC()

Signature
result = getPokemonLevelFromPC(boxId, boxPokemonId)

Level of the pokemon of the current box matching the ID.

Practical scenario

Read this value only after the PC is open and the selected box is refreshed.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.

Returns

integer example: 1

POST /lua/pc-storage/getpokemonlevelfrompc

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local result = getPokemonLevelFromPC(1, 1)
    log("getPokemonLevelFromPC: " .. tostring(result))
end
    log("getPokemonLevelFromPC: " .. tostring(result))
end

getPokemonTotalExperienceFromPC()

Signature
result = getPokemonTotalExperienceFromPC(boxId, boxPokemonId)

Total of experience cost of a level for the pokemon of the current box matching the ID.

Practical scenario

Read this value only after the PC is open and the selected box is refreshed.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.

Returns

integer example: 1

POST /lua/pc-storage/getpokemontotalexperiencefrompc

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local result = getPokemonTotalExperienceFromPC(1, 1)
    log("getPokemonTotalExperienceFromPC: " .. tostring(result))
end
    log("getPokemonTotalExperienceFromPC: " .. tostring(result))
end

getPokemonRemainingExperienceFromPC()

Signature
result = getPokemonRemainingExperienceFromPC(boxId, boxPokemonId)

Remaining experience before the next level of the pokemon of the current box matching the ID.

Practical scenario

Read this value only after the PC is open and the selected box is refreshed.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.

Returns

integer example: 1

POST /lua/pc-storage/getpokemonremainingexperiencefrompc

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local result = getPokemonRemainingExperienceFromPC(1, 1)
    log("getPokemonRemainingExperienceFromPC: " .. tostring(result))
end
    log("getPokemonRemainingExperienceFromPC: " .. tostring(result))
end

getPokemonStatusFromPC()

Signature
result = getPokemonStatusFromPC(boxId, boxPokemonId)

Status of the pokemon of the current box matching the ID.

Practical scenario

Read this value only after the PC is open and the selected box is refreshed.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.

Returns

string example: "value"

POST /lua/pc-storage/getpokemonstatusfrompc

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local result = getPokemonStatusFromPC(1, 1)
    log("getPokemonStatusFromPC: " .. tostring(result))
end
    log("getPokemonStatusFromPC: " .. tostring(result))
end

getPokemonTypeFromPC()

Signature
result = getPokemonTypeFromPC(boxId, boxPokemonId)

Type of the pokemon of the current box matching the ID as an array of length 2.

Practical scenario

Read this value only after the PC is open and the selected box is refreshed.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.

Returns

array<string> example: []

POST /lua/pc-storage/getpokemontypefrompc

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local result = getPokemonTypeFromPC(1, 1)
    log("getPokemonTypeFromPC: " .. tostring(result))
end
    log("getPokemonTypeFromPC: " .. tostring(result))
end

getPokemonHeldItemFromPC()

Signature
result = getPokemonHeldItemFromPC(boxId, boxPokemonId)

Returns the item held by the specified pokemon in the PC, null if empty.

Practical scenario

Read this value only after the PC is open and the selected box is refreshed.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.

Returns

string example: "value"

POST /lua/pc-storage/getpokemonhelditemfrompc

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local result = getPokemonHeldItemFromPC(1, 1)
    log("getPokemonHeldItemFromPC: " .. tostring(result))
end
    log("getPokemonHeldItemFromPC: " .. tostring(result))
end

getPokemonUniqueIdFromPC()

Signature
result = getPokemonUniqueIdFromPC(boxId, boxPokemonId)

PROCatchem custom unique ID of the pokemon of the current box matching the ID.

Practical scenario

Read this value only after the PC is open and the selected box is refreshed.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.

Returns

integer example: 1

POST /lua/pc-storage/getpokemonuniqueidfrompc

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local result = getPokemonUniqueIdFromPC(1, 1)
    log("getPokemonUniqueIdFromPC: " .. tostring(result))
end
    log("getPokemonUniqueIdFromPC: " .. tostring(result))
end

getPokemonRemainingPowerPointsFromPC()

Signature
result = getPokemonRemainingPowerPointsFromPC(boxId, boxPokemonId, moveId)

Current move PP of the pokemon of the current box matching the ID.

Practical scenario

Read this value only after the PC is open and the selected box is refreshed.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.
moveIdintegeryesValue passed to the `moveId` parameter.

Returns

integer example: 1

POST /lua/pc-storage/getpokemonremainingpowerpointsfrompc

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local result = getPokemonRemainingPowerPointsFromPC(1, 1, "Tackle")
    log("getPokemonRemainingPowerPointsFromPC: " .. tostring(result))
end
    log("getPokemonRemainingPowerPointsFromPC: " .. tostring(result))
end

getPokemonMaxPowerPointsFromPC()

Signature
result = getPokemonMaxPowerPointsFromPC(boxId, boxPokemonId, moveId)

Max move PP of the pokemon of the current box matching the ID.

Practical scenario

Read this value only after the PC is open and the selected box is refreshed.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.
moveIdintegeryesValue passed to the `moveId` parameter.

Returns

integer example: 1

POST /lua/pc-storage/getpokemonmaxpowerpointsfrompc

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local result = getPokemonMaxPowerPointsFromPC(1, 1, "Tackle")
    log("getPokemonMaxPowerPointsFromPC: " .. tostring(result))
end
    log("getPokemonMaxPowerPointsFromPC: " .. tostring(result))
end

isPokemonFromPCShiny()

Signature
result = isPokemonFromPCShiny(boxId, boxPokemonId)

Shyniness of the pokemon of the current box matching the ID.

Practical scenario

Read this value only after the PC is open and the selected box is refreshed.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.

Returns

boolean example: true

POST /lua/pc-storage/ispokemonfrompcshiny

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local result = isPokemonFromPCShiny(1, 1)
    log("isPokemonFromPCShiny: " .. tostring(result))
end
    log("isPokemonFromPCShiny: " .. tostring(result))
end

getPokemonMoveNameFromPC()

Signature
result = getPokemonMoveNameFromPC(boxId, boxPokemonId, moveId)

Move of the pokemon of the current box matching the ID.

Practical scenario

Read this value only after the PC is open and the selected box is refreshed.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.
moveIdintegeryesValue passed to the `moveId` parameter.

Returns

string example: "value"

POST /lua/pc-storage/getpokemonmovenamefrompc

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local result = getPokemonMoveNameFromPC(1, 1, "Tackle")
    log("getPokemonMoveNameFromPC: " .. tostring(result))
end
    log("getPokemonMoveNameFromPC: " .. tostring(result))
end

getPokemonMoveAccuracyFromPC()

Signature
result = getPokemonMoveAccuracyFromPC(boxId, boxPokemonId, moveId)

Returns the move accuracy of the specified pokémon in the box at the specified index.

Practical scenario

Read this value only after the PC is open and the selected box is refreshed.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.
moveIdintegeryesValue passed to the `moveId` parameter.

Returns

integer example: 1

POST /lua/pc-storage/getpokemonmoveaccuracyfrompc

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local result = getPokemonMoveAccuracyFromPC(1, 1, "Tackle")
    log("getPokemonMoveAccuracyFromPC: " .. tostring(result))
end
    log("getPokemonMoveAccuracyFromPC: " .. tostring(result))
end

getPokemonMovePowerFromPC()

Signature
result = getPokemonMovePowerFromPC(boxId, boxPokemonId, moveId)

Returns the move power of the specified pokémon in the box at the specified index.

Practical scenario

Read this value only after the PC is open and the selected box is refreshed.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.
moveIdintegeryesValue passed to the `moveId` parameter.

Returns

integer example: 1

POST /lua/pc-storage/getpokemonmovepowerfrompc

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local result = getPokemonMovePowerFromPC(1, 1, "Tackle")
    log("getPokemonMovePowerFromPC: " .. tostring(result))
end
    log("getPokemonMovePowerFromPC: " .. tostring(result))
end

getPokemonMoveTypeFromPC()

Signature
result = getPokemonMoveTypeFromPC(boxId, boxPokemonId, moveId)

Returns the move type of the specified pokémon in the box at the specified index.

Practical scenario

Read this value only after the PC is open and the selected box is refreshed.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.
moveIdintegeryesValue passed to the `moveId` parameter.

Returns

string example: "value"

POST /lua/pc-storage/getpokemonmovetypefrompc

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local result = getPokemonMoveTypeFromPC(1, 1, "Tackle")
    log("getPokemonMoveTypeFromPC: " .. tostring(result))
end
    log("getPokemonMoveTypeFromPC: " .. tostring(result))
end

getPokemonMoveDamageTypeFromPC()

Signature
result = getPokemonMoveDamageTypeFromPC(boxId, boxPokemonId, moveId)

Returns the move damage type of the specified pokémon in the box at the specified index.

Practical scenario

Read this value only after the PC is open and the selected box is refreshed.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.
moveIdintegeryesValue passed to the `moveId` parameter.

Returns

string example: "value"

POST /lua/pc-storage/getpokemonmovedamagetypefrompc

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local result = getPokemonMoveDamageTypeFromPC(1, 1, "Tackle")
    log("getPokemonMoveDamageTypeFromPC: " .. tostring(result))
end
    log("getPokemonMoveDamageTypeFromPC: " .. tostring(result))
end

getPokemonMoveStatusFromPC()

Signature
result = getPokemonMoveStatusFromPC(boxId, boxPokemonId, moveId)

Returns true if the move of the specified pokémon in the box at the specified index can apply a status .

Practical scenario

Read this value only after the PC is open and the selected box is refreshed.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.
moveIdintegeryesValue passed to the `moveId` parameter.

Returns

boolean example: true

POST /lua/pc-storage/getpokemonmovestatusfrompc

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local result = getPokemonMoveStatusFromPC(1, 1, "Tackle")
    log("getPokemonMoveStatusFromPC: " .. tostring(result))
end
    log("getPokemonMoveStatusFromPC: " .. tostring(result))
end

getPokemonNatureFromPC()

Signature
result = getPokemonNatureFromPC(boxId, boxPokemonId)

Nature of the pokemon of the current box matching the ID.

Practical scenario

Read this value only after the PC is open and the selected box is refreshed.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.

Returns

string example: "value"

POST /lua/pc-storage/getpokemonnaturefrompc

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local result = getPokemonNatureFromPC(1, 1)
    log("getPokemonNatureFromPC: " .. tostring(result))
end
    log("getPokemonNatureFromPC: " .. tostring(result))
end

getPokemonAbilityFromPC()

Signature
result = getPokemonAbilityFromPC(boxId, boxPokemonId)

Ability of the pokemon of the current box matching the ID.

Practical scenario

Read this value only after the PC is open and the selected box is refreshed.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.

Returns

string example: "value"

POST /lua/pc-storage/getpokemonabilityfrompc

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local result = getPokemonAbilityFromPC(1, 1)
    log("getPokemonAbilityFromPC: " .. tostring(result))
end
    log("getPokemonAbilityFromPC: " .. tostring(result))
end

getPokemonStatFromPC()

Signature
result = getPokemonStatFromPC(boxId, boxPokemonId, statType)

Returns the value for the specified stat of the specified pokémon in the PC.

Practical scenario

Open and refresh the PC before reading a stored Pokémon stat.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.
statTypestringyesStat name: `HP`, `ATK`, `DEF`, `SPATK`, `SPDEF`, or `SPD` (speed). The long forms `HEALTH`, `ATTACK`, `DEFENCE`/`DEFENSE`, `SPATTACK`, `SPDEFENCE`/`SPDEFENSE` and `SPEED` also work; anything else stops the script.

Returns

integer example: 1

POST /lua/pc-storage/getpokemonstatfrompc

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local speed = getPokemonStatFromPC(1, 1, "SPE")
    log("Box 1 slot 1 Speed: " .. tostring(speed))
end

getPokemonEffortValueFromPC()

Signature
result = getPokemonEffortValueFromPC(boxId, boxPokemonId, statType)

Returns the effort value for the specified stat of the specified pokémon in the PC.

Practical scenario

Read EVs from a refreshed PC entry before selecting a Pokémon to withdraw.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.
statTypestringyesStat name: `HP`, `ATK`, `DEF`, `SPATK`, `SPDEF`, or `SPD` (speed). The long forms `HEALTH`, `ATTACK`, `DEFENCE`/`DEFENSE`, `SPATTACK`, `SPDEFENCE`/`SPDEFENSE` and `SPEED` also work; anything else stops the script.

Returns

integer example: 1

POST /lua/pc-storage/getpokemoneffortvaluefrompc

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local attackEV = getPokemonEffortValueFromPC(1, 1, "ATK")
    log("Stored Pokémon Attack EV: " .. tostring(attackEV))
end

getPokemonIndividualValueFromPC()

Signature
result = getPokemonIndividualValueFromPC(boxId, boxPokemonId, statType)

Returns the individual value for the specified stat of the specified pokémon in the PC.

Practical scenario

Read IVs from a refreshed PC entry when filtering stored catches.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.
statTypestringyesStat name: `HP`, `ATK`, `DEF`, `SPATK`, `SPDEF`, or `SPD` (speed). The long forms `HEALTH`, `ATTACK`, `DEFENCE`/`DEFENSE`, `SPATTACK`, `SPDEFENCE`/`SPDEFENSE` and `SPEED` also work; anything else stops the script.

Returns

integer example: 1

POST /lua/pc-storage/getpokemonindividualvaluefrompc

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local speedIV = getPokemonIndividualValueFromPC(1, 1, "SPE")
    log("Stored Pokémon Speed IV: " .. tostring(speedIV))
end

getPokemonHappinessFromPC()

Signature
result = getPokemonHappinessFromPC(boxId, boxPokemonId)

Happiness of the pokemon of the current box matching the ID.

Practical scenario

Read this value only after the PC is open and the selected box is refreshed.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.

Returns

integer example: 1

POST /lua/pc-storage/getpokemonhappinessfrompc

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local result = getPokemonHappinessFromPC(1, 1)
    log("getPokemonHappinessFromPC: " .. tostring(result))
end
    log("getPokemonHappinessFromPC: " .. tostring(result))
end

getPokemonRegionFromPC()

Signature
result = getPokemonRegionFromPC(boxId, boxPokemonId)

Region of capture of the pokemon of the current box matching the ID.

Practical scenario

Read this value only after the PC is open and the selected box is refreshed.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.

Returns

string example: "value"

POST /lua/pc-storage/getpokemonregionfrompc

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local result = getPokemonRegionFromPC(1, 1)
    log("getPokemonRegionFromPC: " .. tostring(result))
end
    log("getPokemonRegionFromPC: " .. tostring(result))
end

getPokemonOriginalTrainerFromPC()

Signature
result = getPokemonOriginalTrainerFromPC(boxId, boxPokemonId)

Original trainer of the pokemon of the current box matching the ID.

Practical scenario

Read this value only after the PC is open and the selected box is refreshed.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.

Returns

string example: "value"

POST /lua/pc-storage/getpokemonoriginaltrainerfrompc

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local result = getPokemonOriginalTrainerFromPC(1, 1)
    log("getPokemonOriginalTrainerFromPC: " .. tostring(result))
end
    log("getPokemonOriginalTrainerFromPC: " .. tostring(result))
end

getPokemonGenderFromPC()

Signature
result = getPokemonGenderFromPC(boxId, boxPokemonId)

Gender of the pokemon of the current box matching the ID.

Practical scenario

Read this value only after the PC is open and the selected box is refreshed.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.

Returns

string example: "value"

POST /lua/pc-storage/getpokemongenderfrompc

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local result = getPokemonGenderFromPC(1, 1)
    log("getPokemonGenderFromPC: " .. tostring(result))
end
    log("getPokemonGenderFromPC: " .. tostring(result))
end

getPokemonFormFromPC()

Signature
result = getPokemonFormFromPC(boxId, boxPokemonId)

Form of the pokémon in the current box matching the ID. (0 if no form)

Practical scenario

Read this value only after the PC is open and the selected box is refreshed.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.

Returns

integer example: 1

POST /lua/pc-storage/getpokemonformfrompc

function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    function inspectPC()
    if not isPCOpen() or not isCurrentPCBoxRefreshed() then
        return
    end

    local result = getPokemonFormFromPC(1, 1)
    log("getPokemonFormFromPC: " .. tostring(result))
end
    log("getPokemonFormFromPC: " .. tostring(result))
end

usePC()

Signature
result = usePC()

Move next to the map PC when needed, open Pokémon Storage, and request the current PC box. The PC opens using the official storage flow and remains open until closed by movement or another PC action. Use isCurrentPCBoxRefreshed() before relying on the refreshed box contents.

Practical scenario

PC actions are asynchronous. Issue one operation, return, and wait for the next server refresh before making a dependent change.

Returns

boolean example: true

POST /lua/pc-storage/usepc

function onPathAction()
    if not isPCOpen() then
        usePC()
        return
    end

    function onPathAction()
    if not isPCOpen() then
        usePC()
        return
    end

    local result = usePC()
    return
end
    return
end

openPCBox()

Signature
result = openPCBox(boxId)

Open or refresh a PC box by its one-based box number. The visible box order uses one-based boxPokemonId indexes, while the tool internally tracks server database IDs and PC slot IDs. Wait for isCurrentPCBoxRefreshed() before reading the box immediately after opening it.

Practical scenario

PC actions are asynchronous. Issue one operation, return, and wait for the next server refresh before making a dependent change.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.

Returns

boolean example: true

POST /lua/pc-storage/openpcbox

function onPathAction()
    if not isPCOpen() then
        usePC()
        return
    end

    function onPathAction()
    if not isPCOpen() then
        usePC()
        return
    end

    local result = openPCBox(1)
    return
end
    return
end

depositPokemonToPC()

Signature
result = depositPokemonToPC(teamPokemonId)

Send the Pokémon at the one-based team index into the currently open PC box. The tool resolves the selected team Pokémon to its server database ID and waits for the server PC delta update instead of forcing an immediate full refresh. Re-check team/PC state before issuing a dependent action.

Practical scenario

PC actions are asynchronous. Issue one operation, return, and wait for the next server refresh before making a dependent change.

Parameters

NameTypeRequiredDescription
teamPokemonIdintegeryesValue passed to the `teamPokemonId` parameter.

Returns

boolean example: true

POST /lua/pc-storage/depositpokemontopc

function onPathAction()
    if not isPCOpen() then
        usePC()
        return
    end

    function onPathAction()
    if not isPCOpen() then
        usePC()
        return
    end

    local result = depositPokemonToPC(2)
    return
end
    return
end

withdrawPokemonFromPC()

Signature
result = withdrawPokemonFromPC(boxId, boxPokemonId)

Move the Pokémon at the one-based PC box index into the team. The tool resolves the selected PC Pokémon to its server database ID and waits for the normal team update plus PC delta remove response. The target boxId should match the visible/refreshed PC box.

Practical scenario

PC actions are asynchronous. Issue one operation, return, and wait for the next server refresh before making a dependent change.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.

Returns

boolean example: true

POST /lua/pc-storage/withdrawpokemonfrompc

function onPathAction()
    if not isPCOpen() then
        usePC()
        return
    end

    function onPathAction()
    if not isPCOpen() then
        usePC()
        return
    end

    local result = withdrawPokemonFromPC(1, 1)
    return
end
    return
end

swapPokemonFromPC()

Signature
result = swapPokemonFromPC(boxId, boxPokemonId, teamPokemonId)

Swap the Pokémon at the one-based team index with the Pokémon at the one-based index in the selected PC box. The tool sends the official database-ID swap packet and applies the server PC delta update, so the PC Pokémon can be at any position in the box, including the first slot.

Practical scenario

PC actions are asynchronous. Issue one operation, return, and wait for the next server refresh before making a dependent change.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.
teamPokemonIdintegeryesValue passed to the `teamPokemonId` parameter.

Returns

boolean example: true

POST /lua/pc-storage/swappokemonfrompc

function onPathAction()
    if not isPCOpen() then
        usePC()
        return
    end

    function onPathAction()
    if not isPCOpen() then
        usePC()
        return
    end

    local result = swapPokemonFromPC(1, 1, 2)
    return
end
    return
end

swapPokemonWithinPC()

Signature
result = swapPokemonWithinPC(boxId, firstBoxPokemonId, secondBoxPokemonId)

Swap two Pokémon positions inside the same visible PC box. Both PC indexes are one-based. The server returns a position-pair delta, and the tool updates the cached PC slot order without refreshing the full box.

Practical scenario

PC actions are asynchronous. Issue one operation, return, and wait for the next server refresh before making a dependent change.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
firstBoxPokemonIdintegeryesValue passed to the `firstBoxPokemonId` parameter.
secondBoxPokemonIdintegeryesValue passed to the `secondBoxPokemonId` parameter.

Returns

boolean example: true

POST /lua/pc-storage/swappokemonwithinpc

function onPathAction()
    if not isPCOpen() then
        usePC()
        return
    end

    function onPathAction()
    if not isPCOpen() then
        usePC()
        return
    end

    local result = swapPokemonWithinPC(1, 1, 2)
    return
end
    return
end

releasePokemonFromPC()

Signature
result = releasePokemonFromPC(boxId, boxPokemonId)

Permanently release/delete the Pokémon at the one-based index in the selected PC box. This cannot be undone. The tool resolves the Pokémon database ID, sends the official release packet, and waits for the server PC delta remove update.

Practical scenario

Release only after opening the correct box and validating the target. The operation is permanent and asynchronous.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.
boxPokemonIdintegeryesOne-based Pokémon position inside the selected PC box.

Returns

boolean example: true

POST /lua/pc-storage/releasepokemonfrompc

function onPathAction()
    if not isPCOpen() then
        usePC()
        return
    end

    if not isCurrentPCBoxRefreshed() then
        refreshPCBox()
        return
    end

    if getPokemonNameFromPC(1, 1) == "Rattata" then
        releasePokemonFromPC(1, 1)
        return
    end
end

refreshPCBox()

Signature
result = refreshPCBox(boxId)

Request a refresh for the specified PC box. The response can be a full box snapshot, a metadata-only update, or a delta update. Use isCurrentPCBoxRefreshed() before reading the refreshed contents immediately after this call.

Practical scenario

PC actions are asynchronous. Issue one operation, return, and wait for the next server refresh before making a dependent change.

Parameters

NameTypeRequiredDescription
boxIdintegeryesOne-based PC box number.

Returns

boolean example: true

POST /lua/pc-storage/refreshpcbox

function onPathAction()
    if not isPCOpen() then
        usePC()
        return
    end

    function onPathAction()
    if not isPCOpen() then
        usePC()
        return
    end

    local result = refreshPCBox(1)
    return
end
    return
end

Battle state

isOpponentShiny()

Signature
result = isOpponentShiny()

Returns true if the opponent pokémon is shiny.

Practical scenario

Call this only from battle logic. It is a query and can be combined with one battle action in the same callback.

Returns

boolean example: true

POST /lua/battle-state/isopponentshiny

function onBattleAction()
    function onBattleAction()
    local result = isOpponentShiny()
    log("isOpponentShiny: " .. tostring(result))
    attack()
end
    log("isOpponentShiny: " .. tostring(result))
    attack()
end

isAlreadyCaught()

Signature
result = isAlreadyCaught()

Returns true if the opponent pokémon has already been caught and has a pokédex entry.

Practical scenario

Call this only from battle logic. It is a query and can be combined with one battle action in the same callback.

Returns

boolean example: true

POST /lua/battle-state/isalreadycaught

function onBattleAction()
    function onBattleAction()
    local result = isAlreadyCaught()
    log("isAlreadyCaught: " .. tostring(result))
    attack()
end
    log("isAlreadyCaught: " .. tostring(result))
    attack()
end

isWildBattle()

Signature
result = isWildBattle()

Returns true if the current battle is against a wild pokémon.

Practical scenario

Call this only from battle logic. It is a query and can be combined with one battle action in the same callback.

Returns

boolean example: true

POST /lua/battle-state/iswildbattle

function onBattleAction()
    function onBattleAction()
    local result = isWildBattle()
    log("isWildBattle: " .. tostring(result))
    attack()
end
    log("isWildBattle: " .. tostring(result))
    attack()
end

getActivePokemonNumber()

Signature
result = getActivePokemonNumber()

Returns the index of the active team pokémon in the current battle.

Practical scenario

Call this only from battle logic. It is a query and can be combined with one battle action in the same callback.

Returns

integer example: 1

POST /lua/battle-state/getactivepokemonnumber

function onBattleAction()
    function onBattleAction()
    local result = getActivePokemonNumber()
    log("getActivePokemonNumber: " .. tostring(result))
    attack()
end
    log("getActivePokemonNumber: " .. tostring(result))
    attack()
end

getOpponentId()

Signature
result = getOpponentId()

Returns the id of the opponent pokémon in the current battle.

Practical scenario

Call this only from battle logic. It is a query and can be combined with one battle action in the same callback.

Returns

integer example: 1

POST /lua/battle-state/getopponentid

function onBattleAction()
    function onBattleAction()
    local result = getOpponentId()
    log("getOpponentId: " .. tostring(result))
    attack()
end
    log("getOpponentId: " .. tostring(result))
    attack()
end

getOpponentName()

Signature
result = getOpponentName()

Returns the name of the opponent pokémon in the current battle.

Practical scenario

Call this only from battle logic. It is a query and can be combined with one battle action in the same callback.

Returns

string example: "value"

POST /lua/battle-state/getopponentname

function onBattleAction()
    function onBattleAction()
    local result = getOpponentName()
    log("getOpponentName: " .. tostring(result))
    attack()
end
    log("getOpponentName: " .. tostring(result))
    attack()
end

getOpponentHealth()

Signature
result = getOpponentHealth()

Returns the current health of the opponent pokémon in the current battle.

Practical scenario

Call this only from battle logic. It is a query and can be combined with one battle action in the same callback.

Returns

integer example: 1

POST /lua/battle-state/getopponenthealth

function onBattleAction()
    function onBattleAction()
    local result = getOpponentHealth()
    log("getOpponentHealth: " .. tostring(result))
    attack()
end
    log("getOpponentHealth: " .. tostring(result))
    attack()
end

getOpponentMaxHealth()

Signature
result = getOpponentMaxHealth()

Returns the maximum health of the opponent pokémon in the current battle.

Practical scenario

Call this only from battle logic. It is a query and can be combined with one battle action in the same callback.

Returns

integer example: 1

POST /lua/battle-state/getopponentmaxhealth

function onBattleAction()
    function onBattleAction()
    local result = getOpponentMaxHealth()
    log("getOpponentMaxHealth: " .. tostring(result))
    attack()
end
    log("getOpponentMaxHealth: " .. tostring(result))
    attack()
end

getOpponentHealthPercent()

Signature
result = getOpponentHealthPercent()

Returns the percentage of remaining health of the opponent pokémon in the current battle.

Practical scenario

Call this only from battle logic. It is a query and can be combined with one battle action in the same callback.

Returns

integer example: 1

POST /lua/battle-state/getopponenthealthpercent

function onBattleAction()
    function onBattleAction()
    local result = getOpponentHealthPercent()
    log("getOpponentHealthPercent: " .. tostring(result))
    attack()
end
    log("getOpponentHealthPercent: " .. tostring(result))
    attack()
end

getOpponentLevel()

Signature
result = getOpponentLevel()

Returns the level of the opponent pokémon in the current battle.

Practical scenario

Call this only from battle logic. It is a query and can be combined with one battle action in the same callback.

Returns

integer example: 1

POST /lua/battle-state/getopponentlevel

function onBattleAction()
    function onBattleAction()
    local result = getOpponentLevel()
    log("getOpponentLevel: " .. tostring(result))
    attack()
end
    log("getOpponentLevel: " .. tostring(result))
    attack()
end

getOpponentStatus()

Signature
result = getOpponentStatus()

Returns the status of the opponent pokémon in the current battle.

Practical scenario

Call this only from battle logic. It is a query and can be combined with one battle action in the same callback.

Returns

string example: "value"

POST /lua/battle-state/getopponentstatus

function onBattleAction()
    function onBattleAction()
    local result = getOpponentStatus()
    log("getOpponentStatus: " .. tostring(result))
    attack()
end
    log("getOpponentStatus: " .. tostring(result))
    attack()
end

getOpponentForm()

Signature
result = getOpponentForm()

Returns the form of the opponent pokémon in the current battle (0 if no form).

Practical scenario

Call this only from battle logic. It is a query and can be combined with one battle action in the same callback.

Returns

integer example: 1

POST /lua/battle-state/getopponentform

function onBattleAction()
    function onBattleAction()
    local result = getOpponentForm()
    log("getOpponentForm: " .. tostring(result))
    attack()
end
    log("getOpponentForm: " .. tostring(result))
    attack()
end

getOpponentGender()

Signature
result = getOpponentGender()

Returns the gender of the current opponent Pokémon. The result is "M" for male, "F" for female, or an empty string for genderless/unknown. This function is valid only during battle; calling it outside battle triggers the same fatal Lua error contract as the other getOpponent... helpers.

Practical scenario

Use this during battle when behavior depends on gender-specific moves, abilities, or encounter rules.

Returns

string example: "M"

POST /lua/battle-state/getopponentgender

function onBattleAction()
    local gender = getOpponentGender()

    if gender == "M" then
        log("Male opponent detected.")
    elseif gender == "F" then
        log("Female opponent detected.")
    else
        log("Genderless or unknown opponent.")
    end

    attack()
end

getBattleTurn()

Signature
result = getBattleTurn()

Returns the latest battle turn number confirmed by the server through the BT:n battle marker. The value is monotonic for the current battle: duplicate or out-of-order lower markers do not move the turn backwards. 0 means the battle exists but no valid BT:n marker has been received yet. This function is valid only during battle; calling it outside battle follows the tool's fatal Lua error contract.

Practical scenario

Use the server-backed turn number when a script needs different behavior on the first turn or after several turns. Unlike counting onBattleAction() calls, this remains aligned with server battle progression when a move continues automatically, a forced switch occurs, or one player command spans multiple server turns.

Returns

integer 0 before the first valid BT:n marker; otherwise the latest server-confirmed turn number.

POST /lua/battle-state/getbattleturn

function onBattleAction()
    local turn = getBattleTurn()

    if turn == 1 then
        log("First server-confirmed battle turn.")
        useMove("Thunder Wave")
        return
    end

    log("Current battle turn: " .. tostring(turn))
    attack()
end

isOpponentEffortValue()

Signature
result = isOpponentEffortValue(statType)

Returns true if the opponent is only giving the specified effort value.

Practical scenario

Use a documented stat key to verify that the opponent gives only the EV you are training.

Parameters

NameTypeRequiredDescription
statTypestringyesStat name: `HP`, `ATK`, `DEF`, `SPATK`, `SPDEF`, or `SPD` (speed). The long forms `HEALTH`, `ATTACK`, `DEFENCE`/`DEFENSE`, `SPATTACK`, `SPDEFENCE`/`SPDEFENSE` and `SPEED` also work; anything else stops the script.

Returns

boolean example: true

POST /lua/battle-state/isopponenteffortvalue

function onBattleAction()
    if isOpponentEffortValue("ATK") then
        attack()
    else
        run()
    end
end

getOpponentEffortValue()

Signature
result = getOpponentEffortValue(statType)

Returns the amount of a particular EV given by the opponent.

Practical scenario

Read the exact EV yield of the current opponent for one stat.

Parameters

NameTypeRequiredDescription
statTypestringyesStat name: `HP`, `ATK`, `DEF`, `SPATK`, `SPDEF`, or `SPD` (speed). The long forms `HEALTH`, `ATTACK`, `DEFENCE`/`DEFENSE`, `SPATTACK`, `SPDEFENCE`/`SPDEFENSE` and `SPEED` also work; anything else stops the script.

Returns

integer example: 1

POST /lua/battle-state/getopponenteffortvalue

function onBattleAction()
    local attackYield = getOpponentEffortValue("ATK")
    log("Opponent Attack EV yield: " .. tostring(attackYield))
    attack()
end

getOpponentType()

Signature
result = getOpponentType()

Returns the type of the opponent pokémon in the current battle as an array of length 2.

Practical scenario

Call this only from battle logic. It is a query and can be combined with one battle action in the same callback.

Returns

array<string> example: []

POST /lua/battle-state/getopponenttype

function onBattleAction()
    function onBattleAction()
    local result = getOpponentType()
    log("getOpponentType: " .. tostring(result))
    attack()
end
    log("getOpponentType: " .. tostring(result))
    attack()
end

Path actions

moveToCell()

Signature
result = moveToCell(x, y)

Moves to the specified coordinates.

Practical scenario

Use this in `onPathAction()` and return immediately so only one overworld action is issued in the frame.

Parameters

NameTypeRequiredDescription
xintegeryesMap X coordinate.
yintegeryesMap Y coordinate.

Returns

boolean example: true

POST /lua/path-actions/movetocell

function onPathAction()
    function onPathAction()
    local result = moveToCell(10, 15)
    return
end
    return
end

moveToListCell()

Signature
result = moveToListCell(list, "")

Moves to the specified list coordinates.

Practical scenario

Provide comma-separated `x-y` cell lists. The optional second list can represent cells to avoid or an alternate set used by the path helper.

Parameters

NameTypeRequiredDescription
liststringyesValue passed to the `list` parameter.
""stringyesValue passed to the `""` parameter.

Returns

boolean example: true

POST /lua/path-actions/movetolistcell

function onPathAction()
    local preferred = "10-15,11-15,12-15"
    local alternate = "10-16,11-16,12-16"
    moveToListCell(preferred, alternate)
    return
end

moveToMap()

Signature
result = moveToMap(mapName)

Moves to the nearest cell teleporting to the specified map.

Practical scenario

This legacy function is retired. Walk to the destination map link with `moveToCell()` instead.

Parameters

NameTypeRequiredDescription
mapNamestringyesValue passed to the `mapName` parameter.

Returns

boolean example: true

POST /lua/path-actions/movetomap

function onPathAction()
    -- moveToMap("Viridian City") is retired.
    -- Walk onto the known map-link cell instead.
    moveToCell(25, 42)
    return
end

moveToRectangle()

Signature
result = moveToRectangle(...)

Moves to a random accessible cell of the specified rectangle.

Practical scenario

Pass four coordinates: minimum X/Y followed by maximum X/Y. The tool chooses a random accessible cell inside the rectangle.

Parameters

NameTypeRequiredDescription
arg1array<LuaValue>yesValue passed to the `arg1` parameter.

Returns

boolean example: true

POST /lua/path-actions/movetorectangle

function onPathAction()
    moveToRectangle(10, 15, 14, 19)
    return
end

moveToNormalGround()

Signature
result = moveToNormalGround()

Move randomly avoiding water and links.

Practical scenario

Use this in `onPathAction()` and return immediately so only one overworld action is issued in the frame.

Returns

boolean example: true

POST /lua/path-actions/movetonormalground

function onPathAction()
    function onPathAction()
    local result = moveToNormalGround()
    return
end
    return
end

moveToGrass()

Signature
result = moveToGrass()

Moves to the nearest grass patch then move randomly inside it.

Practical scenario

Use this in `onPathAction()` and return immediately so only one overworld action is issued in the frame.

Returns

boolean example: true

POST /lua/path-actions/movetograss

function onPathAction()
    function onPathAction()
    local result = moveToGrass()
    return
end
    return
end

moveToWater()

Signature
result = moveToWater()

Moves to the nearest water area then move randomly inside it.

Practical scenario

Use this in `onPathAction()` and return immediately so only one overworld action is issued in the frame.

Returns

boolean example: true

POST /lua/path-actions/movetowater

function onPathAction()
    function onPathAction()
    local result = moveToWater()
    return
end
    return
end

moveNearExit()

Signature
result = moveNearExit(mapName)

Moves near the cell teleporting to the specified map.

Practical scenario

Use this in `onPathAction()` and return immediately so only one overworld action is issued in the frame.

Parameters

NameTypeRequiredDescription
mapNamestringyesValue passed to the `mapName` parameter.

Returns

boolean example: true

POST /lua/path-actions/movenearexit

function onPathAction()
    function onPathAction()
    local result = moveNearExit("Viridian City")
    return
end
    return
end

talkToNpc()

Signature
result = talkToNpc(npcName)

Moves then talk to NPC specified by its name.

Practical scenario

Use this in `onPathAction()` and return immediately so only one overworld action is issued in the frame.

Parameters

NameTypeRequiredDescription
npcNamestringyesExact or documented NPC name.

Returns

boolean example: true

POST /lua/path-actions/talktonpc

function onPathAction()
    function onPathAction()
    local result = talkToNpc("Nurse Joy")
    return
end
    return
end

talkToNpcOnCell()

Signature
result = talkToNpcOnCell(cellX, cellY)

Moves then talk to NPC located on the specified cell.

Practical scenario

Use this in `onPathAction()` and return immediately so only one overworld action is issued in the frame.

Parameters

NameTypeRequiredDescription
cellXintegeryesValue passed to the `cellX` parameter.
cellYintegeryesValue passed to the `cellY` parameter.

Returns

boolean example: true

POST /lua/path-actions/talktonpconcell

function onPathAction()
    function onPathAction()
    local result = talkToNpcOnCell(10, 15)
    return
end
    return
end

usePokecenter()

Signature
result = usePokecenter()

Moves to the Nurse Joy then talk to the cell below her.

Practical scenario

Use this in `onPathAction()` and return immediately so only one overworld action is issued in the frame.

Returns

boolean example: true

POST /lua/path-actions/usepokecenter

function onPathAction()
    function onPathAction()
    local result = usePokecenter()
    return
end
    return
end

swapPokemon()

Signature
result = swapPokemon(index1, index2)

Swaps the two pokémon specified by their position in the team.

Practical scenario

Use this in `onPathAction()` and return immediately so only one overworld action is issued in the frame.

Parameters

NameTypeRequiredDescription
index1integeryesValue passed to the `index1` parameter.
index2integeryesValue passed to the `index2` parameter.

Returns

boolean example: true

POST /lua/path-actions/swappokemon

function onPathAction()
    function onPathAction()
    local result = swapPokemon(1, 1)
    return
end
    return
end

swapPokemonWithLeader()

Signature
result = swapPokemonWithLeader(pokemonName)

Swaps the first pokémon with the specified name with the leader of the team.

Practical scenario

Move the named Pokémon to the lead slot before continuing the route.

Parameters

NameTypeRequiredDescription
pokemonNamestringyesValue passed to the `pokemonName` parameter.

Returns

boolean example: true

POST /lua/path-actions/swappokemonwithleader

function onPathAction()
    if getPokemonName(1) ~= "Pikachu" then
        swapPokemonWithLeader("Pikachu")
        return
    end

    moveToGrass()
end

sortTeamByLevelAscending()

Signature
result = sortTeamByLevelAscending()

Sorts the pokémon in the team by level in ascending order, one pokémon at a time.

Practical scenario

Use this in `onPathAction()` and return immediately so only one overworld action is issued in the frame.

Returns

boolean example: true

POST /lua/path-actions/sortteambylevelascending

function onPathAction()
    function onPathAction()
    local result = sortTeamByLevelAscending()
    return
end
    return
end

sortTeamByLevelDescending()

Signature
result = sortTeamByLevelDescending()

Sorts the pokémon in the team by level in descending order, one pokémon at a time.

Practical scenario

Use this in `onPathAction()` and return immediately so only one overworld action is issued in the frame.

Returns

boolean example: true

POST /lua/path-actions/sortteambyleveldescending

function onPathAction()
    function onPathAction()
    local result = sortTeamByLevelDescending()
    return
end
    return
end

sortTeamRangeByLevelAscending()

Signature
result = sortTeamRangeByLevelAscending(fromIndex, toIndex)

Sorts the specified part of the team by level in ascending order, one pokémon at a time.

Practical scenario

Use this in `onPathAction()` and return immediately so only one overworld action is issued in the frame.

Parameters

NameTypeRequiredDescription
fromIndexintegeryesValue passed to the `fromIndex` parameter.
toIndexintegeryesValue passed to the `toIndex` parameter.

Returns

boolean example: true

POST /lua/path-actions/sortteamrangebylevelascending

function onPathAction()
    function onPathAction()
    local result = sortTeamRangeByLevelAscending(10, 10)
    return
end
    return
end

sortTeamRangeByLevelDescending()

Signature
result = sortTeamRangeByLevelDescending(fromIndex, toIndex)

Sorts the specified part of the team by level in descending order, one pokémon at a time.

Practical scenario

Use this in `onPathAction()` and return immediately so only one overworld action is issued in the frame.

Parameters

NameTypeRequiredDescription
fromIndexintegeryesValue passed to the `fromIndex` parameter.
toIndexintegeryesValue passed to the `toIndex` parameter.

Returns

boolean example: true

POST /lua/path-actions/sortteamrangebyleveldescending

function onPathAction()
    function onPathAction()
    local result = sortTeamRangeByLevelDescending(10, 10)
    return
end
    return
end

relearnMove()

Signature
result = relearnMove(moveName)

Relearn a move from the move relearner NPC.

Practical scenario

Use this in `onPathAction()` and return immediately so only one overworld action is issued in the frame.

Parameters

NameTypeRequiredDescription
moveNamestringyesExact move name as shown by the game.

Returns

boolean example: true

POST /lua/path-actions/relearnmove

function onPathAction()
    function onPathAction()
    local result = relearnMove("Tackle")
    return
end
    return
end

releasePokemonFromTeam()

Signature
result = releasePokemonFromTeam(pokemonUid)

Releases the specified pokemon in the team.

Practical scenario

Use this in `onPathAction()` and return immediately so only one overworld action is issued in the frame.

Parameters

NameTypeRequiredDescription
pokemonUidintegeryesStable Pokémon database/unique identifier returned by the corresponding query API.

Returns

boolean example: true

POST /lua/path-actions/releasepokemonfromteam

function onPathAction()
    function onPathAction()
    local result = releasePokemonFromTeam(1)
    return
end
    return
end

enablePrivateMessage()

Signature
result = enablePrivateMessage()

Enable private messages from users.

Practical scenario

Use this in `onPathAction()` and return immediately so only one overworld action is issued in the frame.

Returns

boolean example: true

POST /lua/path-actions/enableprivatemessage

function onPathAction()
    function onPathAction()
    local result = enablePrivateMessage()
    return
end
    return
end

disablePrivateMessage()

Signature
result = disablePrivateMessage()

Disable private messages from users.

Practical scenario

Use this in `onPathAction()` and return immediately so only one overworld action is issued in the frame.

Returns

boolean example: true

POST /lua/path-actions/disableprivatemessage

function onPathAction()
    function onPathAction()
    local result = disablePrivateMessage()
    return
end
    return
end

enablePartyInspection()

Signature
result = enablePartyInspection()

Enable party inspection from users.

Practical scenario

Use this in `onPathAction()` and return immediately so only one overworld action is issued in the frame.

Returns

boolean example: true

POST /lua/path-actions/enablepartyinspection

function onPathAction()
    function onPathAction()
    local result = enablePartyInspection()
    return
end
    return
end

disablePartyInspection()

Signature
result = disablePartyInspection()

Disable party inspection from users.

Practical scenario

Use this in `onPathAction()` and return immediately so only one overworld action is issued in the frame.

Returns

boolean example: true

POST /lua/path-actions/disablepartyinspection

function onPathAction()
    function onPathAction()
    local result = disablePartyInspection()
    return
end
    return
end

enableAutoEvolve()

Signature
result = enableAutoEvolve()

Enable auto evolve on Pkm Catchem client.

Practical scenario

Use this in `onPathAction()` and return immediately so only one overworld action is issued in the frame.

Returns

boolean example: true

POST /lua/path-actions/enableautoevolve

function onPathAction()
    function onPathAction()
    local result = enableAutoEvolve()
    return
end
    return
end

disableAutoEvolve()

Signature
result = disableAutoEvolve()

Disable auto evolve on Pkm Catchem client.

Practical scenario

Use this in `onPathAction()` and return immediately so only one overworld action is issued in the frame.

Returns

boolean example: true

POST /lua/path-actions/disableautoevolve

function onPathAction()
    function onPathAction()
    local result = disableAutoEvolve()
    return
end
    return
end

enableNpcInteractions()

Signature
result = enableNpcInteractions()

Enables npc interactions.

Practical scenario

Use this in `onPathAction()` and return immediately so only one overworld action is issued in the frame.

Returns

boolean example: true

POST /lua/path-actions/enablenpcinteractions

function onPathAction()
    function onPathAction()
    local result = enableNpcInteractions()
    return
end
    return
end

disableNpcInteractions()

Signature
result = disableNpcInteractions()

Disables npc interactions.

Practical scenario

Use this in `onPathAction()` and return immediately so only one overworld action is issued in the frame.

Returns

boolean example: true

POST /lua/path-actions/disablenpcinteractions

function onPathAction()
    function onPathAction()
    local result = disableNpcInteractions()
    return
end
    return
end

Dialog functions

pushDialogAnswer()

Signature
pushDialogAnswer(answerValue)

Adds the specified answer to the answer queue. It will be used in the next dialog.

Practical scenario

Queue the expected answer before interacting with the NPC that will open the dialog.

Parameters

NameTypeRequiredDescription
answerValueLuaValueyesAny Lua value.

Returns

void

POST /lua/dialog-functions/pushdialoganswer

function onPathAction()
    pushDialogAnswer("Yes")
    talkToNpc("Nurse Joy")
end

Battle actions

attack()

Signature
result = attack()

Uses the most effective offensive move available.

Practical scenario

Choose this action in `onBattleAction()` and return immediately so only one battle action is sent in the frame.

Returns

boolean example: true

POST /lua/battle-actions/attack

function onBattleAction()
    function onBattleAction()
    local result = attack()
    return
end
    return
end

weakAttack()

Signature
result = weakAttack()

Uses the least effective offensive move available.

Practical scenario

Choose this action in `onBattleAction()` and return immediately so only one battle action is sent in the frame.

Returns

boolean example: true

POST /lua/battle-actions/weakattack

function onBattleAction()
    function onBattleAction()
    local result = weakAttack()
    return
end
    return
end

run()

Signature
result = run()

Tries to escape from the current wild battle.

Practical scenario

Choose this action in `onBattleAction()` and return immediately so only one battle action is sent in the frame.

Returns

boolean example: true

POST /lua/battle-actions/run

function onBattleAction()
    function onBattleAction()
    local result = run()
    return
end
    return
end

sendUsablePokemon()

Signature
result = sendUsablePokemon()

Sends the first usable pokemon different from the active one.

Practical scenario

Choose this action in `onBattleAction()` and return immediately so only one battle action is sent in the frame.

Returns

boolean example: true

POST /lua/battle-actions/sendusablepokemon

function onBattleAction()
    function onBattleAction()
    local result = sendUsablePokemon()
    return
end
    return
end

sendAnyPokemon()

Signature
result = sendAnyPokemon()

Sends the first available pokemon different from the active one.

Practical scenario

Choose this action in `onBattleAction()` and return immediately so only one battle action is sent in the frame.

Returns

boolean example: true

POST /lua/battle-actions/sendanypokemon

function onBattleAction()
    function onBattleAction()
    local result = sendAnyPokemon()
    return
end
    return
end

sendPokemon()

Signature
result = sendPokemon(index)

Sends the specified pokemon to battle.

Practical scenario

Choose this action in `onBattleAction()` and return immediately so only one battle action is sent in the frame.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.

Returns

boolean example: true

POST /lua/battle-actions/sendpokemon

function onBattleAction()
    function onBattleAction()
    local result = sendPokemon(1)
    return
end
    return
end

useMove()

Signature
result = useMove(moveName)

Uses the specified move in the current battle if available.

Practical scenario

Choose this action in `onBattleAction()` and return immediately so only one battle action is sent in the frame.

Parameters

NameTypeRequiredDescription
moveNamestringyesExact move name as shown by the game.

Returns

boolean example: true

POST /lua/battle-actions/usemove

function onBattleAction()
    function onBattleAction()
    local result = useMove("Tackle")
    return
end
    return
end

useAnyMove()

Signature
result = useAnyMove()

Uses the first available move or struggle if out of PP.

Practical scenario

Choose this action in `onBattleAction()` and return immediately so only one battle action is sent in the frame.

Returns

boolean example: true

POST /lua/battle-actions/useanymove

function onBattleAction()
    function onBattleAction()
    local result = useAnyMove()
    return
end
    return
end

Bot configuration

setAfk()

Signature
result = setAfk(value)

Sets afk timeout for BOT

Practical scenario

Set this during startup or when changing modes, rather than writing it every frame.

Parameters

NameTypeRequiredDescription
valueintegeryesValue to store or send.

Returns

boolean example: true

POST /lua/bot-configuration/setafk

function onStart()
    function onStart()
    local result = setAfk(1)
end
end

setAfkTimeout()

Signature
result = setAfkTimeout(value)

Sets afk timeout for BOT

Practical scenario

Set this during startup or when changing modes, rather than writing it every frame.

Parameters

NameTypeRequiredDescription
valueintegeryesValue to store or send.

Returns

boolean example: true

POST /lua/bot-configuration/setafktimeout

function onStart()
    function onStart()
    local result = setAfkTimeout(1)
end
end

Move learning actions

forgetMove()

Signature
result = forgetMove(moveName)

Forgets the specified move, if existing, in order to learn a new one.

Practical scenario

Call this from `onLearningMove()` and choose exactly one move-learning action.

Parameters

NameTypeRequiredDescription
moveNamestringyesExact move name as shown by the game.

Returns

boolean example: true

POST /lua/move-learning-actions/forgetmove

function onLearningMove(moveName, pokemonIndex)
    function onLearningMove(moveName, pokemonIndex)
    local result = forgetMove("Tackle")
end
end

forgetAnyMoveExcept()

Signature
result = forgetAnyMoveExcept(...)

Forgets the first move that is not one of the specified moves.

Practical scenario

Pass move names that must be preserved. The tool forgets the first current move not in that list.

Parameters

NameTypeRequiredDescription
moveNamesarray<LuaValue>yesValue passed to the `moveNames` parameter.

Returns

boolean example: true

POST /lua/move-learning-actions/forgetanymoveexcept

function onLearningMove(moveName, pokemonIndex)
    forgetAnyMoveExcept("Thunderbolt", "Volt Tackle")
end

Custom options

setOption()

Signature
setOption(index, value)

Sets the option at a particular index, or creates it if it doesn't exist

Practical scenario

Define or update script options during startup so the user can configure behavior from the UI.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.
valuebooleanyesValue to store or send.

Returns

void

POST /lua/custom-options/setoption

function onStart()
    function onStart()
    setOption(1, true)
end
end

getOption()

Signature
result = getOption(index)

Gets the option at a particular index, or creates it if it doesn't exist

Practical scenario

Read the user-selected option when deciding what action the script should take.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.

Returns

boolean example: true

POST /lua/custom-options/getoption

function onPathAction()
    function onPathAction()
    local result = getOption(1)
    log("getOption: " .. tostring(result))
end
    log("getOption: " .. tostring(result))
end

setOptionName()

Signature
setOptionName(index, content)

Sets the name of the option at a particular index, or creates it if it doesn't exist

Practical scenario

Give a boolean option a user-facing label during script startup.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.
contentstringyesValue passed to the `content` parameter.

Returns

void

POST /lua/custom-options/setoptionname

function onStart()
    setOption(1, true)
    setOptionName(1, "Catch uncaught Pokémon")
end

setOptionDescription()

Signature
setOptionDescription(index, content)

Sets the tooltip description of the option at a particular index, or creates it if it doesn't exist

Practical scenario

Explain exactly what a boolean option changes so the user can configure the script safely.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.
contentstringyesValue passed to the `content` parameter.

Returns

void

POST /lua/custom-options/setoptiondescription

function onStart()
    setOptionDescription(1, "When enabled, the script weakens and catches species not yet owned.")
end

removeOption()

Signature
removeOption(index)

Removes the slider option at the specified index

Practical scenario

Define or update script options during startup so the user can configure behavior from the UI.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.

Returns

void

POST /lua/custom-options/removeoption

function onStart()
    function onStart()
    removeOption(1)
end
end

setTextOption()

Signature
setTextOption(index, content)

Sets the text of the TextOption at a particular index, or creates it if it doesn't exist

Practical scenario

Create a text option with a meaningful default value.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.
contentstringyesValue passed to the `content` parameter.

Returns

void

POST /lua/custom-options/settextoption

function onStart()
    setTextOption(1, "Pikachu")
    setTextOptionName(1, "Target Pokémon")
end

getTextOption()

Signature
result = getTextOption(index)

Returns the text content of the TextOption at a particular index, or an empty string if it doesn't exist

Practical scenario

Read the user-selected option when deciding what action the script should take.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.

Returns

string example: "value"

POST /lua/custom-options/gettextoption

function onPathAction()
    function onPathAction()
    local result = getTextOption(1)
    log("getTextOption: " .. tostring(result))
end
    log("getTextOption: " .. tostring(result))
end

setTextOptionName()

Signature
setTextOptionName(index, content)

Sets the name of the TextOption at a particular index, or creates it if it doesn't exist

Practical scenario

Give a text option a concise user-facing label.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.
contentstringyesValue passed to the `content` parameter.

Returns

void

POST /lua/custom-options/settextoptionname

function onStart()
    setTextOptionName(1, "Target Pokémon")
end

setTextOptionDescription()

Signature
setTextOptionDescription(index, content)

Sets the tooltip description of the TextOption at a particular index, or creates it if it doesn't exist

Practical scenario

Describe the accepted text format and provide an example.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.
contentstringyesValue passed to the `content` parameter.

Returns

void

POST /lua/custom-options/settextoptiondescription

function onStart()
    setTextOptionDescription(1, "Exact species name, for example Pikachu or Eevee.")
end

removeTextOption()

Signature
removeTextOption(index)

Removes the text option at the specified index

Practical scenario

Define or update script options during startup so the user can configure behavior from the UI.

Parameters

NameTypeRequiredDescription
indexintegeryesOne-based index in the current team or option list, depending on the API.

Returns

void

POST /lua/custom-options/removetextoption

function onStart()
    function onStart()
    removeTextOption(1)
end
end

File APIs

writeToFile()

Signature
writeToFile(filename, text, false)

Writes a string to file overwrite is an optional parameter, and will append the line(s) if absent

Practical scenario

Persist a small state snapshot. Set the third argument to `true` to overwrite or `false` to append.

Parameters

NameTypeRequiredDescription
filenamestringyesValue passed to the `filename` parameter.
textstringyesValue passed to the `text` parameter.
falsebooleanyesValue passed to the `false` parameter.

Returns

void

POST /lua/file-apis/writetofile

function onStop()
    writeToFile("state/last-map.txt", getMapName(), true)
end

logToFile()

Signature
logToFile(file, text, false)

Writes a string, a number, or a table of strings and/or numbers to file overwrite is an optional parameter, and will append the line(s) if absent

Practical scenario

Append structured diagnostic values without relying only on the visible message log.

Parameters

NameTypeRequiredDescription
filestringyesPath relative to the script/tool data directory.
textLuaValueyesAny Lua value.
falsebooleanyesValue passed to the `false` parameter.

Returns

void

POST /lua/file-apis/logtofile

function onWarningMessage(differentMap, distance)
    logToFile("logs/warnings.txt", {
        map = getMapName(),
        differentMap = differentMap,
        distance = distance
    }, false)
end

readLinesFromFile()

Signature
result = readLinesFromFile(file)

Returns a table of every line in file

Practical scenario

Use script-local files for small persistent state or diagnostics. Handle missing/empty data before indexing returned lines.

Parameters

NameTypeRequiredDescription
filestringyesPath relative to the script/tool data directory.

Returns

array<string> example: []

POST /lua/file-apis/readlinesfromfile

function onStart()
    function onStart()
    local result = readLinesFromFile("logs/script.txt")
    if result ~= nil then
        log("File API completed.")
    end
end
    if result ~= nil then
        log("File API completed.")
    end
end

tradeGiveMoney()

Signature
result = tradeGiveMoney(username, money)

Used to trade money With Parameters Username and Money

Practical scenario

Use only inside the intended trade flow and validate the recipient and amount.

Parameters

NameTypeRequiredDescription
usernamestringyesValue passed to the `username` parameter.
moneyintegeryesValue passed to the `money` parameter.

Returns

boolean example: true

POST /lua/file-apis/tradegivemoney

function prepareTrade()
    local ok = tradeGiveMoney("TrustedPlayer", 15000)
    log("Money offer prepared: " .. tostring(ok))
end

tradeAcceptMoney()

Signature
result = tradeAcceptMoney()

Lua function tradeAcceptMoney.

Practical scenario

Use script-local files for small persistent state or diagnostics. Handle missing/empty data before indexing returned lines.

Returns

boolean example: true

POST /lua/file-apis/tradeacceptmoney

function onStart()
    function onStart()
    local result = tradeAcceptMoney()
    if result ~= nil then
        log("File API completed.")
    end
end
    if result ~= nil then
        log("File API completed.")
    end
end

Chat

closeChannel()

Signature
result = closeChannel(name)

Close channel chat by name

Practical scenario

Close a channel by its visible name when the script no longer needs it.

Parameters

NameTypeRequiredDescription
namestringyesName of the option, hook, variable, or resource.

Returns

boolean example: true

POST /lua/chat/closechannel

function onStart()
    local closed = closeChannel("Trade")
    log("Trade channel closed: " .. tostring(closed))
end

Notifications

sendNotification()

Signature
result = sendNotification(templateName)

Send a configured notification template by name or id. Built-in variables such as {player}, {map}, {x}, {y}, {account}, {server}, {bot}, {time}, {date}, and {datetime} are filled automatically when available. The template's configured target controls whether it goes to personal Discord, the built-in PROCatchem Discord channel, Telegram, or all enabled channels. Returns false only when notifications are disabled or the template cannot be found; network delivery is asynchronous.

Practical scenario

Send notifications only for meaningful events to avoid duplicate alerts from callbacks that run repeatedly.

Parameters

NameTypeRequiredDescription
templateNamestringyesTemplate display name or stable template id.

Returns

boolean example: true

POST /lua/notifications/sendnotification

function onSystemMessage(message)
    if stringContains(message, "Caught") then
        function onSystemMessage(message)
    if stringContains(message, "Caught") then
        local ok = sendNotification("Shiny found")
    end
end
    end
end

sendNotificationWith()

Signature
result = sendNotificationWith(templateName, values)

Send a configured notification template and override/add template variables using a Lua table. Table keys should match template variables without braces. Per-call values override built-ins, runtime variables set by setNotifyVar, global variables, and template defaults.

Practical scenario

Send notifications only for meaningful events to avoid duplicate alerts from callbacks that run repeatedly.

Parameters

NameTypeRequiredDescription
templateNamestringyesTemplate display name or stable template id.
valuesNotificationVariablesyesLua table containing template variables.

Returns

boolean example: true

POST /lua/notifications/sendnotificationwith

function onSystemMessage(message)
    if stringContains(message, "Caught") then
        function onSystemMessage(message)
    if stringContains(message, "Caught") then
        local ok = sendNotificationWith("Shiny found", { pokemon = "Gyarados", level = "30" })
    end
end
    end
end

sendNotificationTo()

Signature
result = sendNotificationTo(templateName, target)

Send a configured notification template while overriding its delivery target for this one call. Accepted targets are personal, discord, procatchem, telegram, and all. all falls back to the template's configured target, which defaults to all enabled channels.

Practical scenario

Send notifications only for meaningful events to avoid duplicate alerts from callbacks that run repeatedly.

Parameters

NameTypeRequiredDescription
templateNamestringyesTemplate display name or stable template id.
targetNotificationTargetyesNotification delivery target.

Returns

boolean example: true

POST /lua/notifications/sendnotificationto

function onSystemMessage(message)
    if stringContains(message, "Caught") then
        function onSystemMessage(message)
    if stringContains(message, "Caught") then
        local ok = sendNotificationTo("Bot stopped", "personal")
    end
end
    end
end

sendNotificationWithTo()

Signature
result = sendNotificationWithTo(templateName, values, target)

Send a configured notification template, pass template variables, and override the delivery target for this one call. This is the most explicit notification helper for scripts that need to route different alerts to different channels.

Practical scenario

Send notifications only for meaningful events to avoid duplicate alerts from callbacks that run repeatedly.

Parameters

NameTypeRequiredDescription
templateNamestringyesTemplate display name or stable template id.
valuesNotificationVariablesyesLua table containing template variables.
targetNotificationTargetyesNotification delivery target.

Returns

boolean example: true

POST /lua/notifications/sendnotificationwithto

function onSystemMessage(message)
    if stringContains(message, "Caught") then
        function onSystemMessage(message)
    if stringContains(message, "Caught") then
        local ok = sendNotificationWithTo("Shiny found", { pokemon = "Gyarados", level = "30" }, "procatchem")
    end
end
    end
end

notify()

Signature
result = notify(message)

Send a quick plain-text notification without using a configured template. Use this for simple alerts where you do not need title/body formatting or template variables. Returns immediately after queueing the asynchronous send.

Practical scenario

Send notifications only for meaningful events to avoid duplicate alerts from callbacks that run repeatedly.

Parameters

NameTypeRequiredDescription
messagestringyesPlain text message to send.

Returns

boolean example: true

POST /lua/notifications/notify

function onSystemMessage(message)
    if stringContains(message, "Caught") then
        function onSystemMessage(message)
    if stringContains(message, "Caught") then
        local ok = notify("PROCatchem: script reached Cerulean City.")
    end
end
    end
end

setNotifyVar()

Signature
setNotifyVar(name, value)

Set a runtime notification variable. The variable can be used in any template as {name} until it is overwritten or cleared with clearNotifyVars(). Values are converted to strings.

Practical scenario

Send notifications only for meaningful events to avoid duplicate alerts from callbacks that run repeatedly.

Parameters

NameTypeRequiredDescription
namestringyesVariable name without braces.
valueLuaValueyesValue to store or send.

Returns

void

POST /lua/notifications/setnotifyvar

function onSystemMessage(message)
    if stringContains(message, "Caught") then
        function onSystemMessage(message)
    if stringContains(message, "Caught") then
        setNotifyVar("hunt", "Shiny Magikarp")
    end
end
    end
end

clearNotifyVars()

Signature
clearNotifyVars()

Clear all runtime notification variables previously set with setNotifyVar. Built-in variables and configured template/default variables are not removed.

Practical scenario

Send notifications only for meaningful events to avoid duplicate alerts from callbacks that run repeatedly.

Returns

void

POST /lua/notifications/clearnotifyvars

function onSystemMessage(message)
    if stringContains(message, "Caught") then
        function onSystemMessage(message)
    if stringContains(message, "Caught") then
        clearNotifyVars()
    end
end
    end
end

Legacy special actions

useSurf()

Signature
result = useSurf()

Start surfing from the current position. If setWaterMount() configured a water mount, the tool uses that mount item; otherwise it sends the normal /surf action. Pathfinding also calls this automatically when a route transitions from ground to water.

Practical scenario

Call this at the shoreline when a scripted route needs to enter water. Pathfinding may also trigger it automatically.

Returns

boolean example: true

POST /lua/legacy-special-actions/usesurf

function onPathAction()
    if not isSurfing() then
        useSurf()
        return
    end

    moveToWater()
end