NAV Navbar
Logo
lua

Introduction

Welcome to the API documentation for PokeOne+.

This documentation describes the functions available for use in the Lua scripts.

Please note that functions are case-sensitive in Lua and all the PokeOne+ functions start with a lowercase letter.

Last updated: November 18, 2018

Events

onStart

function onStart()

Called when the bot is started.

This is where you should initialize your variables.

onStop

function onStop()

Called when the bot is stopped.

onUpdate

function onUpdate()

Description

onPause

function onPause()

Called when the bot is paused.

onResume

function onResume()

Called when the bot is resumed from a previous pause.

onSystemMessage

function onSystemMessage(message)

Called when a system message is displayed. These messages are displayed inside the chat in-game.

onWarningMessage

function onWarningMessage(isDifferentMap, distance)

Called when something unexpected happened while teleporting to a map or while moving.

onBattleMessage

function onBattleMessage(message)

Called when a battle message is displayed. These messages are displayed inside the battle window in-game.

onDialogMessage

function onDialogMessage(message)

Called when a dialog message is displayed (because you are talking to a NPC, for instance).

onQuestUpdated

function onQuestUpdated(name, type, questDescription)

Description

onMovementLag

function onMovementLag(distance)

Called if lag occurs while moving.

onPathAction

function onPathAction()

Called when the bot must execute a path action. You should execute one (and only one) game action in this scope.

onBattleAction

function onBattleAction()

Called when the bot must execute a batlle action. You should execute one (and only one) battle action in this scope.

onLearningMove

function onLearningMove(moveName, pokemonIndex)

Called when a pokemon is learning a move but already has four. You can call forgetMove or forgetAnyMoveExcept here. If you do not call these functions, the move will not be learned.

Parameters

Parameter Type Description Returns
moveName string Name of the move that can be learned.
pokemonIndex number Index of the pokemon learning the new move. (1-6)

General Functions

Log

function log(message)

Writes the specified message to the message log.

Parameters

Parameter Type Description
message string Message to display.

Fatal

function fatal(message)

Writes the specified message to the message log and stops the bot.

Parameters

Parameter Type Description
message string Message to display.

Logout

function logout(message)

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

Parameters

Parameter Type Description
message string Message to display.

StringContains

function stringContains(haystack, needle)

Returns true if the haystack contains the specified needle, ignoring the case.

Parameters

Parameter Type Description
haystack string String to analyze.
needle string String to search in the haystack.

PlaySound

function playSound(file)

Returns playing a custom sound.

Parameters

Parameter Type Description
file string Sound file to play.

RegisterHook

function registerHook(eventName, callback)

Calls the specified function when the specified event occurs.

Parameters

Parameter Type Description
eventName string Event that triggers the specified callback function.
callback function Function to call when the specified event occurs.

Game Conditions

GetPlayerX

function getPlayerX()

Returns the X-coordinate of the current cell.

GetPlayerY

function getPlayerY()

Returns the Y-coordinate of the current cell.

GetPlayerLevel

function getPlayerLevel()

Returns players current level of current region.

GetAccountName

function getAccountName()

Returns current account name.

GetAreaName

function getAreaName()

Returns the name of the current area.

GetMapName

function getMapName()   

Returns the name of the current map.

GetDestinationId

function getDestinationId(X, Y)

Gets destination id of a specified link in Guid format.

Parameters

Parameter Type Description
X number X coordinate of the cell.
Y number Y coordinate of the cell.

GetNearestMovableCell

function getNearestMovableCell(minX, minY, maxX, maxY)

Gets the nearest moveable cell from specified rectangle cells.

Parameters

Parameter Type Description
minX number Minimum X coordinate of the rectangle.
minY number Minimum Y coordinate of the rectangle.
maxX number Maximum X coordinate of the rectangle.
maxY number Maximum Y coordinate of the rectangle.

GetTeamSize

function getTeamSize()

Returns the amount of pokémon in the team.

GetPokedexOwned

function getPokedexOwned()

Returns the amount of pokémon owned in the pokédex.

GetPokedexSeen

function getPokedexSeen()

Returns the amount of pokémon seen in the pokédex.

GetTotalSteps

function getTotalSteps()

Returns total steps taken by the account.

GetLastDirection

function getLastDirection()

Returns last direction of the player.

HasItem

function hasItem(itemName)

Returns true if the specified item is in the inventory.

Parameters

Parameter Type Description
itemName string Name of the item (case insensitive).

GetItemQuantity

function getItemQuantity(itemName)

Returns the quantity of the specified item in the inventory.

Parameters

Parameter Type Description
itemName string Name of the item (case insensitive).

GetItemId

function getItemId(itemName)

Returns the ID of the specified item in the inventory.

HasItemId

function hasItemId(itemId)

Returns true if the specified item is in the inventory.

Parameters

Parameter Type Description
itemId string ID of the item.

GetItemQuantityID

function getItemQuantityId(itemId)

Returns the quantity of the specified item in the inventory.

Parameters

Parameter Type Description
itemId string ID of the item.

HasPokemonInTeam

function hasPokemonInTeam(pokemonName)

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

Parameters

Parameter Type Description
pokemonName string Name of the pokémon (case insensitive).

IsTeamSortedByLevelAscending

function isTeamSortedByLevelAscending() 

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

IsTeamSortedByLevelDescending

function isTeamSortedByLevelDescending()

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

IsTeamRangeSortedByLevelAscending

function isTeamRangeSortedByLevelAscending(fromIndex, toIndex)

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

Parameters

Parameter Type Description
fromIndex number Lower index of the range (1-5).
toIndex number Upper index of the range (2-6).

IsTeamRangeSortedByLevelDescending

function isTeamRangeSortedByLevelDescending(fromIndex, toIndex)

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

Parameters

Parameter Type Description
fromIndex number Lower index of the range (1-5).
toIndex number Upper index of the range (2-6).

IsNpcVisible

function isNpcVisible(npcName)

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

Parameters

Parameter Type Description
npcName string Name of the NPC (case insensitive).

IsNpcOnCell

function isNpcOnCell(X, Y)

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

Parameters

Parameter Type Description
X number X coordinate of the cell.
Y number Y coordinate of the cell.

IsShopOpen

function isShopOpen()

Returns true if the shop window is open.

GetMoney

function getMoney()

Returns the amount of money in the inventory.

IsMounted

function isMounted()

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

IsSurfing

function isSurfing()

Returns true if the player is surfing.

GetTime

function getTime()

Returns the current in game hour and minute.

IsMorning

function isMorning()

Returns true if morning time.

IsNoon

function isNoon()

Returns true if noon time.

isEvening

function IsEvening()

Returns true if evening time.

IsNight

function isNight()

Returns true if night time.

IsOutside

function isOutside()

Returns true if the character is outside.

IsPlayerFacingWater

function isPlayerFacingWater()

Returns true if the character is facing water.

GetWaterDirectionFromPlayer

function getWaterDirectionFromPlayer()

Returns water direction from the player.

IsTrainerInfoReceived

function isTrainerInfoReceived()

Returns true if trainer info has been received.

AskForTrainerInfo

function askForTrainerInfo()

Asks for trainer info.

GetTrainerKantoLevel

function getTrainerKantoLevel()

Retruns players Kanto level.

GetTrainerJohtoLevel

function getTrainerJohtoLevel()

Returns players Johto level.

HasBadge

function hasBadge(badgeName)

Retruns true if player has specified badge.

Parameters

Parameter Type Description
badgeName string Name of the badge.

HasBadgeId

function hasBadgeId(badgeId)

Retruns true if player has specified badge Id.

Parameters

Parameter Type Description
badgeId number Id of the badge.

CountBadges

function countBadges()

Counts players currently owned badges.

CountNpcWith

function countNpcWith(npcNameContains)

Counts total NPCs with specified string.

Parameters

Parameter Type Description
npcNameContains string Containing string of the NPC name.

CheckNpcWith

function checkNpcWith(npcNameContains)

Checks if any NPCs is visible with specified string.

Parameters

Parameter Type Description
npcNameContains string Containing string of the NPC name.

GetAllNpcData

function getAllNpcData()

Returns npc data on current map, format : { { "x" = x , "y" = y, "los" = los, "isBattler" = isBattler }, {...}, ... } The data you can retrieve is: x, y, name, isBattler, canBattle, id, los

GetNpcData

function getNpcData(npcName)

Returns npc data with spcified name on current map, format : { { "x" = x , "y" = y, "los" = los, "isBattler" = isBattler }, {...}, ... } The data you can retrieve is: x, y, name, isBattler, canBattle, id, los

Parameters

Parameter Type Description
npcName string Name of the NPC.

GetNpcDataWith

function getNpcDataWith(npcNameContains)

Returns npc data with spcified string, format : { { "x" = x , "y" = y, "los" = los, "isBattler" = isBattler }, {...}, ... } The data you can retrieve is: x, y, name, isBattler, canBattle, id, los

Parameters

Parameter Type Description
npcNameContains string Containing string of the NPC name.

UseEquippedMount

function useEquippedMount()

Uses the currently equipped mount.

Pokemon Conditions

GetPokemonId

function getPokemonId(pokemonIndex)

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

Parameters

Parameter Type Description
pokemonIndex number Index of the pokémon (1-6).

GetPokemonName

function getPokemonName(pokemonIndex)

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

Parameters

Parameter Type Description
pokemonIndex number Index of the pokémon (1-6).

GetPokemonHealth

function getPokemonHealth(pokemonIndex)

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

Parameters

Parameter Type Description
pokemonIndex number Index of the pokémon (1-6).

GetPokemonHealthPercent

function getPokemonHealthPercent(pokemonIndex)

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

Parameters

Parameter Type Description
pokemonIndex number Index of the pokémon (1-6).

GetPokemonMaxHealth

function getPokemonMaxHealth(pokemonIndex)

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

Parameters

Parameter Type Description
pokemonIndex number Index of the pokémon (1-6).

IsPokemonShiny

function isPokemonShiny(pokemonIndex)

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

Parameters

Parameter Type Description
pokemonIndex number Index of the pokémon (1-6).

GetPokemonMoveName

function getPokemonMoveName(pokemonIndex, moveIndex)

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

Parameters

Parameter Type Description
pokemonIndex number Index of the pokémon (1-6).
moveIndex number Index of the move (1-4).

GetPokemonMoveAccuracy

function getPokemonMoveAccuracy(pokemonIndex, moveIndex)

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

Parameters

Parameter Type Description
pokemonIndex number Index of the pokémon (1-6).
moveIndex number Index of the move (1-4).

GetPokemonMovePower

function getPokemonMovePower(pokemonIndex, moveIndex)

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

Parameters

Parameter Type Description
pokemonIndex number Index of the pokémon (1-6).
moveIndex number Index of the move (1-4).

GetPokemonMoveType

function getPokemonMoveType(pokemonIndex, moveIndex)

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

Parameters

Parameter Type Description
pokemonIndex number Index of the pokémon (1-6).
moveIndex number Index of the move (1-4).

GetPokemonMoveDamageType

function getPokemonMoveDamageType(pokemonIndex, moveIndex)

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

Parameters

Parameter Type Description
pokemonIndex number Index of the pokémon (1-6).
moveIndex number Index of the move (1-4).

GetPokemonMoveStatus

function getPokemonMoveStatus(pokemonIndex, moveIndex)

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

Parameters

Parameter Type Description
pokemonIndex number Index of the pokémon (1-6).
moveIndex number Index of the move (1-4).

GetPokemonMaxPowerPoints

function getPokemonMaxPowerPoints(pokemonIndex, moveIndex)

Max move PP of the pokémon of the current box matching the ID.

Parameters

Parameter Type Description
pokemonIndex number Index of the pokémon (1-6).
moveIndex number Index of the move (1-4).

GetPokemonNature

function getPokemonNature(pokemonIndex)

Nature of the pokémon of the current box matching the ID.

Parameters

Parameter Type Description
pokemonIndex number Index of the pokémon (1-6).

GetPokemonAbility

function getPokemonAbility(pokemonIndex)

Ability of the pokémon of the current box matching the ID.

Parameters

Parameter Type Description
pokemonIndex number Index of the pokémon (1-6).

GetPokemonLevel

function getPokemonLevel(pokemonIndex)

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

Parameters

Parameter Type Description
pokemonIndex number Index of the pokémon (1-6).

GetPokemonHappiness

function getPokemonHappiness(pokemonIndex)

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

Parameters

Parameter Type Description
pokemonIndex number Index of the pokémon (1-6).

GetPokemonOriginalTrainer

function getPokemonOriginalTrainer(pokemonIndex)

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

Parameters

Parameter Type Description
pokemonIndex number Index of the pokémon (1-6).

GetPokemonGender

function getPokemonGender(pokemonIndex)

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

Parameters

Parameter Type Description
pokemonIndex number Index of the pokémon (1-6).

GetPokemonType

function getPokemonType(pokemonIndex)

Returns the type of the specified pokémon in the team as a table of length 2.

Parameters

Parameter Type Description
pokemonIndex number Index of the pokémon (1-6).

GetDamageMultiplier

function getDamageMultiplier(attacker, defender)

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

Parameters

Parameter Type Description
attacker string Type of the attacking move.
defender string Type(s) of the defending pokémon.

GetPokemonStatus

function getPokemonStatus(pokemonIndex)

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

Parameters

Parameter Type Description
pokemonIndex number Index of the pokémon (1-6).

GetPokemonForme

function getPokemonForme(pokemonIndex)

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

Parameters

Parameter Type Description
pokemonIndex number Index of the pokémon (1-6).

GetPokemonHeldItem

function getPokemonHeldItem(pokemonIndex)

Returns the item held by the specified pokémon in the team, null if empty.

Parameters

Parameter Type Description
pokemonIndex number Index of the pokémon (1-6).

IsPokemonUsable

function isPokemonUsable(pokemonIndex)

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

Parameters

Parameter Type Description
pokemonIndex number Index of the pokémon (1-6).

GetUsablePokemonCount

function getUsablePokemonCount()

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

HasMove

function hasMove(pokemonIndex, moveName)

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

Parameters

Parameter Type Description
pokemonIndex number Index of the pokémon (1-6).
moveName string Name of the move (case insensitive).

GetRemainingPowerPoints

function getRemainingPowerPoints(pokemonIndex, moveName)

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

Parameters

Parameter Type Description
pokemonIndex number Index of the pokémon (1-6).
moveName string Name of the move (case insensitive).

GetPokemonStat

function getPokemonStat(pokemonIndex, statName)

Returns the value for the specified stat of the specified pokémon in the team. Stat names are:

Full Name Short Alternative
Health HP
Attack ATK
Defence DEF Defense
SpAttack SPATK
SpDefence SPDEF SpDefense
Speed SPD

Parameters

Parameter Type Description
pokemonIndex number Index of the pokémon (1-6).
statName string Name of the stat (case insensitive).

GetPokemonEffortValue

function getPokemonEffortValue(pokemonIndex, statName)

Returns the value for the specified stat of the specified pokémon in the team. Stat names are:

Full Name Short Alternative
Health HP
Attack ATK
Defence DEF Defense
SpAttack SPATK
SpDefence SPDEF SpDefense
Speed SPD

Parameters

Parameter Type Description
pokemonIndex number Index of the pokémon (1-6).
statName string Name of the stat (case insensitive).

GetPokemonIndividualValue

function getPokemonIndividualValue(pokemonIndex, statName)

Returns the value for the specified stat of the specified pokémon in the team. Stat names are:

Full Name Short Alternative
Health HP
Attack ATK
Defence DEF Defense
SpAttack SPATK
SpDefence SPDEF SpDefense
Speed SPD

Parameters

Parameter Type Description
pokemonIndex number Index of the pokémon (1-6).
statName string Name of the stat (case insensitive).

GetPokemonCollectedEffortValue

function getPokemonCollectedEffortValue(pokemonIndex, statName)

Returns the collected effort value for the specified stat of the specified pokémon in the team. Stat names are:

Full Name Short Alternative
Health HP
Attack ATK
Defence DEF Defense
SpAttack SPATK
SpDefence SPDEF SpDefense
Speed SPD

Parameters

Parameter Type Description
pokemonIndex number Index of the pokémon (1-6).
statName string Name of the stat (case insensitive).

Battle Conditions

IsOpponentShiny

function isOpponentShiny()

Returns true if the opponent pokémon is shiny.

IsAlreadyCaught

function isAlreadyCaught()

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

IsWildBattle

function isWildBattle()

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

IsDoubleBattle

function isDoubleBattle()

Returns true if the current battle is a double battle.

GetActivePokemonNumber

function getActivePokemonNumber()

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

GetTeamPositionFromPersonality

function getTeamPositionFromPersonality(integer)

Description.

Parameters

Parameter Type Description
integer number Description.

GetActivePokemons

function getActivePokemons()

Returns all active pokemons during double/triple battle, format : { { "Name" = name, "Id" = id, "Form" = form }, {...}, ... }

GetOpponentId

function getOpponentId()

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

GetOpponentName

function getOpponentName()

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

GetOpponentHealth

function getOpponentHealth()

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

GetOpponentMaxHealth

function getOpponentMaxHealth()

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

GetOpponentHealthPercent

function getOpponentHealthPercent()

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

GetOpponentLevel

function getOpponentLevel()

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

GetOpponentStatus

function getOpponentStatus()

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

GetOpponentForme

function getOpponentForme()

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

IsOpponentEffortValue

function isOpponentEffortValue(statName)

Returns true if the opponent is only giving the specified effort value. Stat names are:

Full Name Short Alternative
Health HP
Attack ATK
Defence DEF Defense
SpAttack SPATK
SpDefence SPDEF SpDefense
Speed SPD

Parameters

Parameter Type Description
statName string Name of the stat (case insensitive).

GetOpponentEffortValue

function getOpponentEffortValue(statName)

Returns the amount of a particular EV given by the opponent. Stat names are:

Full Name Short Alternative
Health HP
Attack ATK
Defence DEF Defense
SpAttack SPATK
SpDefence SPDEF SpDefense
Speed SPD

Parameters

Parameter Type Description
statName string Name of the stat (case insensitive).

GetOpponentType

function getOpponentType()

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

PC Conditions

IsPCOpen

function isPCOpen()

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

IsCurrentPCBoxRefreshed

function releasePokemonFromPC(boxId, pokemonUid)

Returns true if the currentPCBox is refreshed.

GetCurrentPCBoxId

function getCurrentPCBoxId()

Returns the active PC Box Id.

GetCurrentPCBoxSize

function getCurrentPCBoxSize()

Returns the current box size.

GetPCBoxCount

function getPCBoxCount()

Return the number of non-empty boxes in the PC.

GetCurrentBoxPokemonCount

function getCurrentBoxPokemonCount()

Return the number of pokemon in the current box.

GetPCPokemonCount

function getPCPokemonCount()

Return the number of pokemon in the PC.

GetPokemonIdFromPC

function getPokemonIdFromPC(boxId, boxPokemonId)

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

Parameters

Parameter Type Description
boxId number ID of the specified box.
boxPokemonId number ID of the specified pokemon.

GetPokemonNameFromPC

function getPokemonNameFromPC(boxId, boxPokemonId)

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

Parameters

Parameter Type Description
boxId number ID of the specified box.
boxPokemonId number ID of the specified pokemon.

GetPokemonHealthFromPC

function getPokemonHealthFromPC(boxId, boxPokemonId)

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

Parameters

Parameter Type Description
boxId number ID of the specified box.
boxPokemonId number ID of the specified pokemon.

GetPokemonHealthPercentFromPC

function getPokemonHealthPercentFromPC(boxId, boxPokemonId)

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

Parameters

Parameter Type Description
boxId number ID of the specified box.
boxPokemonId number ID of the specified pokemon.

GetPokemonMaxHealthFromPC

function getPokemonMaxHealthFromPC(boxId, boxPokemonId)

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

Parameters

Parameter Type Description
boxId number ID of the specified box.
boxPokemonId number ID of the specified pokemon.

GetPokemonLevelFromPC

function getPokemonLevelFromPC(boxId, boxPokemonId)

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

Parameters

Parameter Type Description
boxId number ID of the specified box.
boxPokemonId number ID of the specified pokemon.

GetPokemonTotalExperienceFromPC

function getPokemonTotalExperienceFromPC(boxId, boxPokemonId)

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

Parameters

Parameter Type Description
boxId number ID of the specified box.
boxPokemonId number ID of the specified pokemon.

GetPokemonRemainingExperienceFromPC

function getPokemonRemainingExperienceFromPC(boxId, boxPokemonId)

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

Parameters

Parameter Type Description
boxId number ID of the specified box.
boxPokemonId number ID of the specified pokemon.

GetPokemonStatusFromPC

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

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

Parameters

Parameter Type Description
boxId number ID of the specified box.
boxPokemonId number ID of the specified pokemon.

GetPokemonTypeFromPC

function getPokemonTypeFromPC(boxId, boxPokemonId)

Type of the pokemon of the current box matching the ID as a table of length 2.

Parameters

Parameter Type Description
boxId number ID of the specified box.
boxPokemonId number ID of the specified pokemon.

GetPokemonHeldItemFromPC

function getPokemonHeldItemFromPC(boxId, boxPokemonId)

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

Parameters

Parameter Type Description
boxId number ID of the specified box.
boxPokemonId number ID of the specified pokemon.

GetPokemonRemainingPowerPointsFromPC

function getPokemonRemainingPowerPointsFromPC(boxId, boxPokemonId, moveId)

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

Parameters

Parameter Type Description
boxId number ID of the specified box.
boxPokemonId number ID of the specified pokemon.
moveId number ID of the move (1-4).

GetPokemonMaxPowerPointsFromPC

function getPokemonMaxPowerPointsFromPC(boxId, boxPokemonId, moveId)

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

Parameters

Parameter Type Description
boxId number ID of the specified box.
boxPokemonId number ID of the specified pokemon.
moveId number ID of the move (1-4).

IsPokemonFromPCShiny

function isPokemonFromPCShiny(boxId, boxPokemonId)

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

Parameters

Parameter Type Description
boxId number ID of the specified box.
boxPokemonId number ID of the specified pokemon.

GetPokemonMoveNameFromPC

function getPokemonMoveNameFromPC(boxId, boxPokemonId, moveId)

Returns the move name of the move index of the pokemon of the current box matching the ID.

Parameters

Parameter Type Description
boxId number ID of the specified box.
boxPokemonId number ID of the specified pokemon.
moveId number ID of the move (1-4).

GetPokemonMoveAccuracyFromPC

function getPokemonMoveAccuracyFromPC(boxId, boxPokemonId, moveId)

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

Parameters

Parameter Type Description
boxId number ID of the specified box.
boxPokemonId number ID of the specified pokemon.
moveId number ID of the move (1-4).

GetPokemonMovePowerFromPC

function getPokemonMovePowerFromPC(boxId, boxPokemonId, moveId)

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

Parameters

Parameter Type Description
boxId number ID of the specified box.
boxPokemonId number ID of the specified pokemon.
moveId number ID of the move (1-4).

GetPokemonMoveTypeFromPC

function getPokemonMoveTypeFromPC(boxId, boxPokemonId, moveId)

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

Parameters

Parameter Type Description
boxId number ID of the specified box.
boxPokemonId number ID of the specified pokemon.
moveId number ID of the move (1-4).

GetPokemonMoveDamageTypeFromPC

function getPokemonMoveDamageTypeFromPC(boxId, boxPokemonId, moveId)

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

Parameters

Parameter Type Description
boxId number ID of the specified box.
boxPokemonId number ID of the specified pokemon.
moveId number ID of the move (1-4).

GetPokemonMoveStatusFromPC

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

Parameters

Parameter Type Description
boxId number ID of the specified box.
boxPokemonId number ID of the specified pokemon.
moveId number ID of the move (1-4).

GetPokemonNatureFromPC

function getPokemonNatureFromPC(boxId, boxPokemonId)

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

Parameters

Parameter Type Description
boxId number ID of the specified box.
boxPokemonId number ID of the specified pokemon.

GetPokemonAbilityFromPC

function getPokemonAbilityFromPC(boxId, boxPokemonId)

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

Parameters

Parameter Type Description
boxId number ID of the specified box.
boxPokemonId number ID of the specified pokemon.

GetPokemonStatFromPC

function getPokemonStatFromPC(boxId, boxPokemonId, statType)

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

Full Name Short Alternative
Health HP
Attack ATK
Defence DEF Defense
SpAttack SPATK
SpDefence SPDEF SpDefense
Speed SPD

Parameters

Parameter Type Description
boxId number ID of the specified box.
boxPokemonId number ID of the specified pokemon.
statType string Name of the stat (case insensitive).

GetPokemonEffortValueFromPC

function getPokemonEffortValueFromPC(boxId, boxPokemonId, statType)

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

Full Name Short Alternative
Health HP
Attack ATK
Defence DEF Defense
SpAttack SPATK
SpDefence SPDEF SpDefense
Speed SPD

Parameters

Parameter Type Description
boxId number ID of the specified box.
boxPokemonId number ID of the specified pokemon.
statType string Name of the stat (case insensitive).

GetPokemonIndividualValueFromPC

function getPokemonIndividualValueFromPC(boxId, boxPokemonId, statType)

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

Full Name Short Alternative
Health HP
Attack ATK
Defence DEF Defense
SpAttack SPATK
SpDefence SPDEF SpDefense
Speed SPD

Parameters

Parameter Type Description
boxId number ID of the specified box.
boxPokemonId number ID of the specified pokemon.
statType string Name of the stat (case insensitive).

GetPokemonHappinessFromPC

function getPokemonHappinessFromPC(boxId, boxPokemonId)

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

Parameters

Parameter Type Description
boxId number ID of the specified box.
boxPokemonId number ID of the specified pokemon.

GetPokemonOriginalTrainerFromPC

function getPokemonOriginalTrainerFromPC(boxId, boxPokemonId)

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

Parameters

Parameter Type Description
boxId number ID of the specified box.
boxPokemonId number ID of the specified pokemon.

GetPokemonGenderFromPC

function getPokemonGenderFromPC(boxId, boxPokemonId)

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

Parameters

Parameter Type Description
boxId number ID of the specified box.
boxPokemonId number ID of the specified pokemon.

Quest Conditions

IsMainQuest

function isMainQuest(questName)

Returns true if the given questName is the name of Main Quest or Story Quest.

Parameters

Parameter Type Description
questName string Name of the quest.

IsMainQuestId

function isMainQuestId(questId)

Returns true if the given Id is the Id of Main Quest or Story Quest.

Parameters

Parameter Type Description
questId string ID of the quest in Guid format.

IsQuestCompleted

function isQuestCompleted(questName)

Returns true if the given questName is a completed Quest.

Parameters

Parameter Type Description
questName string Name of the quest.

IsQuestIdCompleted

function isQuestIdCompleted(questId)

Returns true if the given Id is a completed Quest.

Parameters

Parameter Type Description
questId string ID of the quest in Guid format.

IsQuestPathRequested

function isQuestPathRequested(questName)

Returns true if the path has been requested of the given questName.

Parameters

Parameter Type Description
questName string Name of the quest.

IsQuestIdPathRequested

function isQuestIdPathRequested(questId)

Returns true if the path has been requested of the given questId.

Parameters

Parameter Type Description
questId string ID of the quest in Guid format.

GetQuestId

function getQuestId(questName)

Returns the ID of the given questName in Guid format.

Parameters

Parameter Type Description
questName string Name of the quest.

GetQuestType

function getQuestType(questName)

Returns quest type from name as string.

Parameters

Parameter Type Description
questName string Name of the quest.

GetQuestIdType

function getQuestIdType(questId)

Returns quest type from id as string.

Parameters

Parameter Type Description
questId string ID of the quest in Guid format.

GetQuestTargetArea

function getQuestTargetArea(questName)

Returns target area of a spcefied quest name.

Parameters

Parameter Type Description
questName string Name of the quest.

GetQuestIdTargetArea

function getQuestIdTargetArea(questId)

Returns target completed area of a spcefied quest name.

Parameters

Parameter Type Description
questId string ID of the quest in Guid format.

GetQuestTargetCompletedArea

function getQuestTargetCompletedArea(questName)

Returns target completed area of a spcefied quest name.

Parameters

Parameter Type Description
questName string Name of the quest.

GetQuestIdTargetCompletedArea

function getQuestIdTargetCompletedArea(questId)

Returns target completed area of a spcefied quest id.

Parameters

Parameter Type Description
questId string ID of the quest in Guid format.

GetQuestSourceNpc

function getQuestSourceNpc(questName)

Returns source npc name of a spcefied quest name.

Parameters

Parameter Type Description
questName string Name of the quest.

GetQuestIdSourceNpc

function getQuestIdSourceNpc(questId)

Returns source npc name of a spcefied quest id.

Parameters

Parameter Type Description
questId string ID of the quest in Guid format.

GetQuestSourceArea

function getQuestSourceArea(questName)

Returns source area of a spcefied quest name.

Parameters

Parameter Type Description
questName string Name of the quest.

GetQuestIdSourceArea

function getQuestIdSourceArea(questId)

Returns source area of a spcefied quest id.

Parameters

Parameter Type Description
questId string ID of the quest in Guid format.

GetMainQuestName

function getMainQuestName()

Returns the main quest's name.

GetMainQuestId

function getMainQuestId()

Returns the main quest's Id.

Game Actions

MoveToCell

function moveToCell(X, Y)

Moves to the specified coordinates.

Parameters

Parameter Type Description
X number X coordinate of the cell.
Y number Y coordinate of the cell.

MoveToArea

function moveToArea(areaName)

Moves to the nearest cell teleporting to the specified area.

Parameters

Parameter Type Description
areaName string Name of the destination area (case insensitive).
function moveToLink(linkId)

Moves to the specified link. You can use getDestinationId() to get link Id's.

Parameters

Parameter Type Description
linkId string ID of the link in Guid format.
function moveToNearestLink()

Moves to nearest accessible link from player.

MoveToRectangle

function moveToRectangle(minX, minY, maxX, maxY)

Moves to a random accessible cell inside the specified rectangle.

Parameters

Parameter Type Description
minX number Minimum X coordinate of the rectangle.
minY number Minimum Y coordinate of the rectangle.
maxX number Maximum X coordinate of the rectangle.
maxY number Maximum Y coordinate of the rectangle.

MoveLinearX

function moveLinearX(minX, maxX, Y)

Moves side to side in a horizontal line.

Parameters

Parameter Type Description
minX number Minimum X coordinate of the line.
maxX number Maximum X coordinate of the line.
Y number Y coordinate of the line.

MoveLinearY

function moveLinearY(minY, maxY, X)

Moves up and down in a vertical line.

Parameters

Parameter Type Description
minY number Minimum Y coordinate of the line.
maxY number Maximum Y coordinate of the line.
X number X coordinate of the line.

MoveToGrass

function moveToGrass()

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

MoveToWater

function moveToWater()

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

MoveToEncounterWild

function moveToEncounterWild()

Moves to wild encounter cells randomly.

UseEquippedMount

function useEquippedMount()

Uses the currently equipped mount.

TalkToNpc

function talkToNpc(npcName)

Moves then talks to NPC specified by its name.

Parameters

Parameter Type Description
npcName string Name of the NPC (case insensitive).

TalkNpcWith

function talkNpcWith(npcNameContains)

Moves then talk to NPC which name contains specified string. If more than 1 NPC is found, the bot will talk to the nearest NPC from the player.

Parameters

Parameter Type Description
npcNameContains string Containing string of the NPC name.

TalkToNpcOnCell

function talkToNpcOnCell(X, Y)

Moves then talks to NPC located on the specified cell.

Parameters

Parameter Type Description
X number X coordinate of the cell.
Y number Y coordinate of the cell.

TurnCharacter

function turnCharacter(direction)

Turns the character to specified direction. For Up, use one of these for 'direction': Up, u, n, 1 For Down, use one of these for 'direction': Down, d, s, 2 For Left, use one of these for 'direction': Left, l, w, 3 For Right, use one of these for 'direction': Right, r, e, 4

Parameters

Parameter Type Description
direction string Direction you want the player to face.

UsePokecenter

function usePokecenter()

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

SwapPokemon

function swapPokemon(pokemonIndex1, pokemonIndex2)

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

Parameters

Parameter Type Description
pokemonIndex1 number Index of the first pokémon to swap.
pokemonIndex2 number Index of the second pokémon to swap.

SortTeamByLevelAscending

function sortTeamByLevelAscending()

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

SortTeamByLevelDescending

function sortTeamByLevelDescending()

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

SortTeamRangeByLevelAscending

function sortTeamRangeByLevelAscending(fromIndex, toIndex)  

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

Parameters

Parameter Type Description
fromIndex number Lower index of the range (1-5).
toIndex number Upper index of the range (2-6).

SortTeamRangeByLevelDescending

function sortTeamRangeByLevelDescending(fromIndex, toIndex)

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

Parameters

Parameter Type Description
fromIndex number Lower index of the range (1-5).
toIndex number Upper index of the range (2-6).

BuyItem

function buyItem(itemName, quantity)

Buys the specified item and quantity from the opened shop.

Parameters

Parameter Type Description
itemName string Name of the item you want to buy.
quantity number Quantity you want to buy.

CloseShop

function closeShop()

Returns true if shop is closed.

GiveItemToPokemon

function giveItemToPokemon(itemName, pokemonIndex)

Give the specified item on the specified pokémon.

Parameters

Parameter Type Description
itemName string Name of the item you want to give.
pokemonIndex number Index of the pokémon (1-6).

RemoveHeldItemFromPokemon

function removeHeldItemFromPokemon(pokemonIndex)

Take the held item from the specified pokémon. NOTE: The item will be lost forever.

Parameters

Parameter Type Description
pokemonIndex number Index of the pokémon (1-6).

Battle Actions

Attack

function attack()

Uses the most effective offensive move available.

WeakAttack

function weakAttack()

Uses the least effective offensive move available.

Run

function run()

Tries to escape from the current wild battle.

SendUsablePokemon

function sendUsablePokemon()

Sends the first usable pokémon different from the active one.

SendAnyPokemon

function sendAnyPokemon()

Sends the first available pokémon different from the active one.

SendPokemon

function sendPokemon(pokemonIndex)

Sends the specified pokémon to battle.

Parameters

Parameter Type Description
pokemonIndex number Index of the pokémon (1-6).

SendPokemonDoubleBattle

function sendPokemonDoubleBattle(pokemonIndexCurrent, pokemonIndexSending)

Changes the specified pokémon with the specified pokémon during double/triple battle.

Parameters

Parameter Type Description
pokemonIndexCurrent number Index of the pokémon currently in battle (1-6).
pokemonIndexSending number Index of the pokémon you want to swap into battle (1-6).

UseMove

function useMove(moveName)

Uses the specified move in the current battle if available.

Parameters

Parameter Type Description
moveName string Name of the move (case insensitive).

UseAnyMove

function useAnyMove()

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

PC Actions

UsePC

function usePC()

Move to the PC and opens it, refreshing the first box.

OpenPCBox

function openPCBox(boxId)

Open box from the PC.

Parameters

Parameter Type Description
boxId number ID of the specified box.

DepositPokemonToPC

function depositPokemonToPC(pokemonUid)

Deposit a pokemon to the PC.

Parameters

Parameter Type Description
pokemonUid number Unique ID of the specified Pokemon.

WithdrawPokemonFromPC

function withdrawPokemonFromPC(boxId, boxPokemonId)

Withdraw a pokemon from a known box.

Parameters

Parameter Type Description
boxId number ID of the specified box.
boxPokemonId number Unique ID of the specified pokemon.

SwapPokemonFromPC

function swapPokemonFromPC(boxId, boxPokemonId, pokemonUid)

Swap a pokemon from the team with a pokemon from the PC.

Parameters

Parameter Type Description
boxId number ID of the specified box.
boxPokemonId number Unique ID of the specified pokemon to deposit.
pokemonUid number Unique ID of the specified Pokemon to withdraw.

ReleasePokemonFromTeam

function releasePokemonFromTeam(pokemonUid)

Releases the specified pokemon in the team.

Parameters

Parameter Type Description
pokemonUid number Unique ID of the specified Pokemon to release.

ReleasePokemonFromPC

function releasePokemonFromPC(boxId, pokemonUid)

Releases the specified pokemon in the PC.

Parameters

Parameter Type Description
boxId number ID of the specified box.
pokemonUid number Unique ID of the specified Pokemon to release.

Quest Actions

RequestPathForQuest

function requestPathForQuest(questName)

Requests path for specified quest with name. It is something like 'goto' button of PokeOne.

Parameters

Parameter Type Description
questName string Name of the quest.

RequestPathForQuestId

function requestPathForQuestId(questId)

Requests path for specified quest with Id. It is something like 'goto' button of PokeOne.

Parameters

Parameter Type Description
questId string ID of the quest in Guid format.

Other Actions

UseItem

function useItem(itemName)

Uses the specified item. This function is usable in the field and in battle.

Parameters

Parameter Type Description
itemName string Name of the item you want to use.

UseItemOnPokemon

function useItemOnPokemon(itemName, pokemonIndex)

Uses the specified item on the specified pokémon. This function is usable in the field and in battle.

Parameters

Parameter Type Description
itemName string Name of the item you want to use.
pokemonIndex number Index of the pokémon (1-6).

UseItemOnMove

function useItemOnMove(string, string, number)

Description

Parameters

Parameter Type Description
string string Description.
string string Description.
number number Description.

SetCollectedEffortValue

function setCollectedEffortValue(pokemonIndex, statName, evAmount)

Sets specific amount of collected evs to the specified Pokemon. Stat names are:

Full Name Short Alternative
Health HP
Attack ATK
Defence DEF Defense
SpAttack SPATK
SpDefence SPDEF SpDefense
Speed SPD

Parameters

Parameter Type Description
pokemonIndex number Index of the pokémon (1-6).
statName string Name of the stat (case insensitive).
evAmount number What to set the EV amount to.

ForgetMove

function forgetMove(moveName)

Only usable when learning a move, inside onMoveLearning. Forgets the specified move, if existing, in order to learn a new one.

Parameters

Parameter Type Description
moveName string Name of the move (case insensitive).

ForgetAnyMoveExcept

function forgetAnyMoveExcept(moveNames)
Example: forgetAnyMoveExcept({"Fly", "Cut", "Psychic"})

Only usable when learning a move, inside onMoveLearning. Forgets the specified move, if existing, in order to learn a new one.

Parameters

Parameter Type Description
moveNames array of string Name of the moves (case insensitive).

PushDialogAnswer

function pushDialogAnswer(answerIndex)

Adds the specified answer to the answer queue. It will be used in the next dialog. This function should be called before a talkToNpc or talkToNpcOnCell.

Parameters

Parameter Type Description
answerIndex number Index of the answer or index of the pokémon to select.

LogToFile

function logToFile(file, text, [overwrite])

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. Files must be located in /Logs.

Parameters

Parameter Type Description
file string Name of the log file.
text string Text to log to the specified file.
overwrite bool Append absent lines to file (true/false).

ReadLinesFromFile

function readLinesFromFile(file)

Returns a table of every line in file. Files must be located in /Logs.

Parameters

Parameter Type Description
file string Name of the log file.
lua