Conditions

If you are unsure how to use these object functions, check out the conditions tutorial.

Note

Do not use %% in conditions, even if you do when assigning variables. For example,

if var[a]!=hour
var[a]=%hour%
(condition) random[n]
random[n]

A random integer between 1 and n.

n (number)

Upper bound.

(condition) random
random

The integer previously generated by random[n].

(condition) player
player

The player’s ID number.

(condition) oddplayer
oddplayer

1 if player ID is odd, 0 if player ID is even.

(condition) rank
rank

The player’s rank.

Options
telep, mapper, mod, admin, dev
(condition) var[name]
var[name]

The value of a variable.

name (string)

Variable name.

(condition) mapvar[name]
mapvar[name]

The value of a map variable.

name (string)

Variable name.

(condition) ev[name]
ev[name]

The value of an event variable.

name (string)

Variable name.

(condition) skin
skin

The player’s current skin ID.

(condition) skin[n]
skin[n]

???

n (number)

???

(condition) direction
direction

The direction the player is currently facing. Works with msg() and execute(). See direction.

(condition) ontouch
ontouch

True when the player is touching the tile. Works with warp(), msg(), and execute().

(condition) ontile
ontile

True when the player is standing on the tile. Works with msg() and execute().

(condition) offtile
offtile

True when the player is not standing on the tile. Works with msg() and execute().

(condition) minute
minute

An integer between 0 and 59 representing the current in-game minute.

(condition) hour
hour

An integer between 0 and 23 representing the current in-game hour.

(condition) month
month

An integer between 0 and 11 representing the current month.

(condition) year
year

An integer representing the current year.

(condition) day
day

If used with no comparison, yields true when it is day time (12:00-17:59) in-game. If used with a comparison against a number, yields the day of the year. If used with a comparison against a string, yields the lowercase day of the week (monday to sunday).

(condition) night
night

True when it is night time (20:00-05:59) in-game.

(condition) dusk
dusk

True when it is dusk time (18:00-19:59) in-game.

(condition) dawn
dawn

True when it is dawn time (06:00-11:59) in-game.

(condition) item[name|id]
item[name|id]

How much of an item the player owns.

name|id (string | number)

Item name or ID number.

(condition) party
party

The number of Pokémon in the player’s party.

(condition) party[name|id]
party[name|id]

1 if player has a specified Pokémon in their party. 0 otherwise.

name|id (pokémon | skin)

Name, dev ID, or skin ID for a Pokémon.

partyHas[searchFor|collections|copyright|eggGroups|evolutions|slot|species|tags|types|mon]

1 if the condition is true, 0 otherwise.

This only accepts 1 param, a string containing multiple sub parameters.

The conditional string accepts a wide array of potential values.

Each condition is separated by &, and is treated as an “and” conditionally.

Most/all conditions can be used multiple times (just not “searchFor”)

Spacing is allowed if it helps legibility, though avoid using it in the value for the “mon” condition.

if partyHas[searchfor=any & evolutions = 1 & slot = 1]

Is a valid value, and translates to “Any mon in the party that has an immediate evo and is in the first slot.”

Below is documentation for each sub parameter/conditional capable of being used.

searchFor

Accepts “any” or “all” as valid values.

Defaults to “any” if not specified at all.

Preferably the first condition, this specifies how the condition should behave.

“any” - Find if there is ANY mon in the party that meets ALL the conditions in this check.

“all” - Check to see that ALL mons in the party meet ALL the conditions in this check.

if partyHas[searchfor=all&type=bug]

Would be ‘true’ if the player’s party is entirely pokemon that are at least bug type.

collections

Accepts any number of UIDs of collections the mon/mons may be from, separated by commas.

If specified, no matter how many acceptable collections are provided, the mon/mons must belong to AT LEAST ONE of them.

if partyHas[collections=10f6gxci,10hvquu7]

Would be “Any mon that is in the HUB OR Rica collections”

copyright

Whether or not the mon/mons should be copyright.

Often used to identify Nintendo mons.

if partyHas[copyright=1]

Would mean “if the player’s party has ANY copyright mon”

eggGroups

Accepts names of egg groups separated by commas.

The egg groups you want the mon/mons to belong to.

if partyHas[eggGroups=mineral,water 2,field]

Would be “Any mon that belongs to AT LEAST ONE of the egg groups: mineral, water 2, or field”

evolutions

Accepts whole numbers or whole numbers that are preceeded by >,>=,<,<=

The number of IMMEDIATE evolutions the mon/mons should have.

if partyHas[evolutions=>=1]

Would be “Any mon that has one or more possible immediate evolutions

slot

Accepts whole numbers (1 to 6) or whole numbers (1 to 6) that are preceeded by >,>=,<,<=

The slot the mon should be in.

Do not attempt to use this with searchfor=all as it will not work.

if partyHas[slot=>=4]

Would be “any mon exists in the 4th, 5th and 6th slots.”

if partyHas[slot=4&type=ground]

Would be “If the player has a ground type in their 4th slot”

species

Accepts any species UIDs OR species names.

If specified, no matter how many UIDs are provided, the mon/mons must belong to AT LEAST ONE of them, not ALL of them.

if partyHas[species=0027xe3s]

Would be “any mon that is EXACTLY this SPECIFIC trapinch species that matches this UID”

if partyHas[species=Trapinch]

Would be “any mon that is ANY species named Trapinch”

tags

Accepts any string values separated by commas.

The tags the mon should have in the pokengine database site.

If specified, no matter how many tags are provided, the mon/mons must belong to AT LEAST ONE of them, not ALL of them.

Tags ARE case sensitive here.

if partyHas[tags=King,knight]

Would be “If the party has any mon that has the tag ‘King’ OR ‘knight’ “

types

Accepts any number of types by name separated by commas.

If specified, no matter how many types are provided, the mon/mons must belong to AT LEAST ONE of them, not ALL of them.

if partyHas[types=bug]

Would be “any mon that has the type bug”

if partyHas[types=bug,ground]

Would be “any mon that has the type bug OR ground”

if partyHas[types=bug&type=ground]

Would be “any mon that has the type bug AND ground”

if partyHas[searchfor=all&types=bug,ground]

Would be “All mons in party are at least bug OR at least ground”

if partyHas[searchfor=all&types=bug&types=ground]

Would be “All mons in party are at least bug AND ground”

mon

Accepts a value very similar to a mon generation string, with a few slight variances.

Each of these sub-conditions are separated by ; and their sub-sub-condition values are separated by commas (see the ivs in the examples below)

  • level / lv / l - mon level, accepts whole numbers and >,>=,<=,<

  • nickname / name / n - the mon’s name (or nickname if set)

  • male / m - the mon’s gender being male

  • female / f - the mon’s gender being female

  • status / q - the mon’s status, accepts status like “poison” and “paralyze” etc.

  • hp / h - the mon’s current hp, accepts whole numbers and >,>=,<=,<

  • ability / a - ability UID the mon should have

  • nature / p - nature the mon should have, accepts whole text like ‘hardy’

  • moves / o - moves the mon should have AT LEAST ONE of, move UIDs separated by commas

  • item / b - item the mon should have, item UID

  • happiness / friendship / w - happiness value the mon should have, accepts whole numbers and >,>=,<=,<

  • egg / y - number of egg steps remaining till hatch, accepts whole numbers and >,>=,<=,<

  • IVs / ivs / i - IVs the mon should have, accepts whole numbers and >,>=,<=,< or # for ‘any’

  • EVs / evs / e - EVs the mon should have, accepts whole numbers and >,>=,<=,< or # for ‘any’

  • baseStats - Stats the mon’s species should have, accepts whole numbers and >,>=,<=,< or # for ‘any’

  • rainbow - if the mon should be rainbow, accepts just “rainbow” no value

  • golden - if the mon should be rainbow, accepts just “golden” no value

  • shiny - if the mon should be rainbow, accepts just “shiny” no value

  • steps - if the mon should have a number of steps, accepts whole numbers and >,>=,<=,<

  • uid / u - The UID of the species the mon should be. Accepted if no key before:

if partyHas[searchFor=any&mon=male;status poison;IVs 31,>=15,#,#,#,0]

Would be “any male mon that is poisoned, has exactly 31 HP iv and at least 15 attack iv, exactly 0 iv, with any other ivs.” Similar syntax would be used for specifying evs.

(condition) seen[dex|pokemon]
seen[dex|pokemon]

If a Dex ID is given, yields the number of Pokémon seen in that Dex. If given a Pokémon, yields 1 if the player has seen that Pokémon.

dex|pokemon (number | pokémon | skin)

Dex ID number or the name, dev ID, or skin ID for a Pokémon.

(condition) caught[dex|pokemon|]
caught[dex|pokemon|]

If a Dex ID is given, yields the number of Pokémon caught in that Dex. If given a Pokémon, yields 1 if the player has caught that Pokémon.

dex|pokemon (number | pokémon | skin)

Dex ID number or the name, dev ID, or skin ID for a Pokémon.

(condition) beaten
beaten

The number of times the player has beaten a trainer. Saves to the specific tile.

(condition) beaten[x,y]
beaten[x,y]

Checks the beaten value at designated x,y coordinates.

(condition) battlewon
battlewon

Value is the battle ID of the last battle the player won, either a trainer’s battle ID or a Pokémon name. 0 if player has not battled.

Examples
if battlewon=350 and ontile=natalie
msg(Congrats, you have earned the Wilds Badge!)
(condition) battlelost
battlelost

Value is the battle ID of the last battle the player lost, either a trainer’s battle ID or a Pokémon name. 0 if player has not battled.

(condition) caught
caught

Value is the battle ID of the last battle in which the player captured a Pokémon, either a trainer’s battle ID or a Pokémon name. 0 if player has not captured anything.

Examples
if !ev[mewtwo]
mewtwo=npc(543,down)
mewtwo.msg(Mew!)&battle=mewtwo;level 70;moves 129,112,94,105;scene 42
if ontile=mewtwo and caught=mewtwo
execute(ev[mewtwo]=1)
(condition) battled
battled

Value is the battle ID of the last battle the player participated in regardless of outcome, either a trainer’s battle ID or a Pokémon name. 0 if player has not battled.

(condition) starter
starter

The Dex number of the player’s starter Pokémon. 0 if no starter has been received. See &starter.

(condition) fainted
fainted

???

(condition) badge[name|id]
badge[name|id]

1 if the player has collected a specified badge. 0 otherwise.

name|id (string | number)

Badge name or ID number.

(condition) badges
badges

The number of badges collected in the current region.

(condition) traded
traded

1 if the player has traded. 0 otherwise.

(condition) gaveaway
gaveaway

1 if the player has just given away a Pokemon with &giveaway. 0 otherwise.

(condition) season
season

The current season.

Options
winter, spring, summer, fall
(condition) achievement[id]
achievement[id]

The current state of the given achievement. See &achievement.

id (number)

Achievement ID number.

(condition) replayed
replayed

???

(condition) spectated
spectated

???

(condition) rival
rival

The rival’s name. See &rival.

(condition) money
money

The amount of money in the player’s wallet.

(condition) coins
coins

The number of coins the player has in their coin case.

(condition) surfing
surfing

1 if the player is surfing. 0 otherwise.

(condition) cycling
cycling

1 if the player is cycling. 0 otherwise.

(condition) safari
safari

1 if the player is in the Safari Zone state. 0 otherwise.

(condition) repel
repel

1 if repel is active. 0 otherwise.

(condition) champion
champion

1 if the player has beat the champion. 0 otherwise.

(condition) weather
weather

The current in-game weather condition.

(condition) happiness[slot]
happiness[slot]

The happiness value, between 0 and 255, for a Pokémon in the player’s party.

slot (number)

Integer between 1 and 6 for the party slot to check.

(condition) onload
onload

1 if map has just loaded, 0 otherwise.

(condition) refreshed
refreshed

1 if player has just refreshed, 0 otherwise.