Skip to content

Script commands

Generated from pl_script::ops by pl_scriptc::reference; do not edit. cargo xtask bless (or PL_BLESS=1 cargo test -p pl-scriptc --test reference) rewrites it, and a test fails while it is out of date. docs/scripting.md is the guide, with examples; this is every item, hook, statement, expression, command, word, movement action and limit, one row each.

Form Meaning
const NAME = value A name for a number, text, flag(n), var(n), lflag(n), lvar(n) or temp(n)
array NAME = kind[from..to] A name for flags or variables from to to - 1 of var, flag, lvar, lflag or temp; at most 255
script name { ... } A script: call name runs it sharing the caller’s temporaries, start name runs it in the background
script name(a, b) { ... } A procedure: its own frame of temporaries, parameters first; called as name(x, y) or call name(x, y)
script name(a, b) -> value { ... } A procedure with a value: return expr; usable in expressions
on EVENT [when cond] { ... } A hook: the game starts it (see Hooks)
hide actor when cond The actor is not there when the map loads if the condition holds

The number is the hook’s kind in a module’s table. when cond may follow any of them.

Form Number File Starts when
on load 0 map The map has loaded, before anything is drawn; every one whose condition holds runs, in the background
on enter 1 map The player has arrived and the screen has faded in
on talk ACTOR 2 map The player talks to the actor; self is the actor
on read SPOT 3 map The player examines the spot
on step SPOT 4 map The player steps on a cell of the trigger spot
on step area(x, y, [w, h]) 5 map The player steps on a cell of the rectangle
on sight ACTOR, range 6 map The actor sees the player straight ahead within range cells; once until the player has been out of sight
on use ITEM 7 shared The item is used from the bag
on follower 8 map or shared The player talks to the following creature; self is the follower
on steps n 9 map or shared The player’s step count in the whole game is a multiple of n; every one that fits runs, in the background
on gameover 10 shared The challenge mode left nothing that can fight and challenge_over is the script’s
on fieldmove KIND 11 shared A field move is to be used; self is the tree, rock or boulder faced
on option NAME 12 shared The player changed the game’s option on the options screen
on newgame 13 shared or map A new game has begun and the start map is still dark: the game’s intro; on enter waits for it, and the map fades in when it ends
on resume 14 map or shared Play came back to the field without changing map (a menu screen, a battle, a scene, a continued save); every one that holds runs, in the background
on load, resume 0 map or shared One script for both: on load, and on resume (its resume row has n = 1; a continued save runs it once)
on idle when cond 15 map The field is idle and the condition holds: checked every tick, the first that holds runs in the foreground; it must make its own condition false
on wildmon(method, map) 17 shared, then map Editing hook: a wild creature is about to be fought (a step, encounter, fishing, a headbutt, wildbattle (method 8), a roamer). Runs at once, may not wait; the pend* commands read and change the creature, pendcancel calls the meeting off
on trainerparty(class, version) 18 shared, then map Editing hook: a trainer’s team has been made from the pack, before its battle; once per trainer. pendcount members, each by its index; pendadd, pendremove
on givemon(species, level, how) 19 shared, then map Editing hook: a creature is about to be given (how 0: givemon); the pend* commands read and change it before it is stored

One a line, or separated by ;; a line ending in a comma continues.

Form Meaning
set FLAG / clear FLAG Sets or clears a flag (also set ARRAY[i])
VAR = expr / VAR += expr / VAR -= expr Assigns a variable or temporary (also ARRAY[i] = expr)
let name = expr Names the next free temporary until the end of the block and sets it
if cond { } else if cond { } else { } Runs a block when the condition is not 0
while cond { } Repeats while the condition is not 0; a loop is made to pause after 2,000 instructions a tick
for i in from..to { } i from from up to to - 1; to is read once
for i in ARRAY { } i over the array’s indices
break Leaves the innermost while or for
call name Runs a script and comes back; it shares the caller’s temporaries
call name(args) / name(args) Runs a procedure; its value is dropped
return Back to the caller (a procedure gives 0); ends the script at the outermost level
return expr In a procedure with -> value: back with this value
end Ends the script, however deep in calls
start name Starts a script of this file in the background
move actor, [actions], [wait: false] A movement list (see Movement actions); waits unless wait: false
command args -> VAR A command (see Commands); -> VAR stores its value
text -> value [when cond] In a menu’s body: an entry with its value, added when the condition holds

Tightest first in the operator rows.

Form Meaning
12, 0x1F, 1_000 Whole numbers, 32 bits
"text" Text: \n new line, \p new page, \r wait and scroll, {0}-{7} message buffers
true, false 1 and 0
flag(n), lflag(n) A saved (0-4095) or map-local (0-63) flag: 1 or 0
var(n), lvar(n), temp(n) A saved (0-511), map-local (0-31) or the script’s own (0-15) variable
npc(n) Actor n of the map
ARRAY[i] An element of an array; outside it reads 0
len(ARRAY) The array’s length, a constant
name(args) A command or a procedure with a value
menu(prompt, [at: side], [columns: n], [cancel: v]) { entries } A menu built as the script runs: the chosen entry’s value; the body holds entries and statements (for, if)
! - Not, minus
* / % Times, divided by (0 for division by 0), remainder
+ - Plus, minus
== != < <= > >= Comparisons: 1 or 0; they do not chain
&& || And, or: both sides are always worked out

In the table’s order; the opcode is 64 plus the number. Arguments are name: kind, with = default when they may be left out, given in order or as name: value. A kind is int, text (text in quotes, a string name, or a text value), [text...] (a list), int... (the rest), or a namespace of Words (a word, or any number). Value: yes when the command leaves one (usable as name(args) and with -> VAR).

Command Number Arguments Value Meaning
say 0 text: text no Shows a message and waits until it is read; the box stays up until closetext, release or the end
sign 1 text: text no As say, in the sign’s box. sign text, style, icon (or style:, icon:) compiles to signex
choice 2 prompt: text, options: [text…] yes Asks a question: the option’s place from 0, -1 if cancelled; up to 32 options, more than 8 scroll
yesno 3 prompt: text yes Asks yes or no: 1 or 0
closetext 4 no Closes the message box
buffer 5 slot: int, kind: buffer, value: int = 0 no Puts a number or a name (the buffer words) in message buffer slot for {slot} in later text
lock 6 no Holds the player and everyone’s own movement
release 7 no Frees them and closes the box
wait 8 ticks: int no Waits ticks sixtieths of a second
waitmoves 9 no Waits until every movement list is done
waitbutton 10 no Waits until the player presses the button
waitsound 11 no Waits until the sound or fanfare has finished
random 12 below: int yes A number from 0 to below - 1, from the game’s generator
lastresult 13 yes The value of the last battle, choice or screen
faceplayer 14 who: actor = 253 no Turns who to the player
face 15 who: actor, dir: dir no Turns who to a direction
look 16 who: actor, at: actor no Turns who towards another actor
approach 17 who: actor = 253 no who walks up to the player in a straight line; the script waits
show 18 who: actor no Shows an actor
hide 19 who: actor no Hides an actor: not drawn, blocks nothing, sees nothing
emote 20 who: actor, emote: emote no Shows an emote above an actor and waits
place 21 who: actor, x: int, y: int no Puts an actor on a cell at once, until the map is left
mover 22 who: actor, kind: mover, param: int = 0 no Changes how an actor moves by itself (the mover words)
xof 23 who: actor yes An actor’s x; -1 for none
yof 24 who: actor yes An actor’s y; -1 for none
facing 25 who: actor yes An actor’s direction; -1 for none
sees 26 who: actor, range: int yes 1 if the actor sees the player within range, by the rule of on sight
warp 27 map: map, x: int, y: int, facing: dir = 4 no Leaves for another map; the script ends
setcell 28 x: int, y: int, cell: cell no Changes a cell’s behaviour until the map is left (the cell words)
door 29 x: int, y: int, state: door no Opens or closes the door at a cell and waits
fade 30 way: fade, colour: colour = 0, ticks: int = 0 no Fades out to or in from black or white and waits
shake 31 strength: int, ticks: int no Shakes the picture by strength sixteenths of a cell for ticks
camera 32 who: actor no The camera follows this actor at once
playsound 33 sound: sound no Plays a sound effect
playmusic 34 music: music no Changes the music (none stops it, map is the map’s own)
fanfare 35 music: music no Plays a jingle over the music and waits
weather 36 kind: weather no Changes the weather (the weather words); it fades in
giveitem 37 item: item, count: int = 1 yes Gives items: 1 if they fitted in the bag
takeitem 38 item: item, count: int = 1 yes Takes items: 1 if the player had that many
hasitem 39 item: item, count: int = 1 yes 1 if the player has that many
givemon 40 species: species, level: int yes Gives a creature: 1 party, 2 storage, 0 no room
hasmon 41 species: species yes 1 if the party has a creature of the species
healparty 42 no Heals the party; where the player stands is where a lost battle returns
wildbattle 43 species: species, level: int yes A wild battle; waits: 0 lost, 1 won, 2 ran, 3 caught
trainerbattle 44 kind: trainer, name: text, version: int = 0, defeat: text = -1, lose: lose = 0, money: switch = 1, exempt: switch = 0, mode: mode = 0, called: name = 255, music: battlemusic = 0 yes A trainer battle with its texts and choices; waits: 1 won, 0 lost
shop 45 stock: shop, percent: int = 100 no Opens a shop with a stock list and waits
storage 46 yes Opens the storage screen and waits: 1 if anything changed
save 47 yes Saves the game: 1 if saved
askname 48 who: name yes Opens the naming screen for player or rival and waits: 1 if named
givemoney 49 amount: int no Adds money, to at most 999,999
takemoney 50 amount: int yes Takes money: 1 if the player had that much
money 51 yes The player’s money
showmoney 52 no Shows the money box
hidemoney 53 no Hides the money box
respawn 54 map: map, x: int, y: int no Sets where a lost battle returns the player
endgame 55 no Saves, fades out and goes back to the title screen
choosemon 56 yes Opens the party screen to choose a creature and waits: its place, -1 if none
ext 57 call: int, args: int… yes A command the game adds in Rust, by number
setaside 58 species: species, slot: int yes The story keeps the party’s first creature of the species in place slot (0-3): 1 if it did
bringback 59 slot: int yes The creature kept in slot rejoins the party: 1 if it did
tint 60 red: int = -1, green: int = -1, blue: int = -1 no Sets the main light’s colour; tint alone gives the hour’s light back
menuentry 61 entry: entry, on: switch = 1 no Lists or unlists a menu entry (the entry words)
cammove 62 pitch: int = -1, distance: int = -1, ticks: int = 30, ease: ease = 3, fov: int = -1, wait: switch = 1 no Moves the camera’s framing (pitch, distance, field of view) over ticks
campan 63 x: int, y: int, ticks: int = 30, ease: ease = 3, wait: switch = 1 no Pans the camera to look at a cell
camfollow 64 who: actor, ticks: int = 30, ease: ease = 3, wait: switch = 1 no Moves the camera to an actor and follows it
camreset 65 ticks: int = 30, ease: ease = 3, wait: switch = 1 no Returns the camera to the map’s framing, following the player
camwait 66 no Waits until a camera move given wait: false is over
trademon 67 slot: int, species: species, level: int, item: item = 0 yes Trades the party’s creature in slot for a new one: 1 if it did
evolveevent 68 event: int yes Evolves every creature that evolves by event n; waits: how many were to
canhold 69 item: item, count: int = 1 yes 1 if that many more of the item fit in the bag
pocket 70 item: item yes The item’s bag pocket, 1-8; 0 for no such item
istm 71 item: item yes 1 if the item is a machine
record 72 record: record yes One of the game’s 32 counters (the record words)
addrecord 73 record: record, amount: int = 1 no Adds to a counter
journal 74 kind: int, a: int = 0, b: int = 0, c: int = 0, d: int = 0 no Notes an entry of a kind and four numbers in the journal
journalentry 75 entry: int, field: int = 0 yes A field of journal entry n, newest 0; -1 for none
setflag 76 flag: int no Sets saved flag n worked out at run time (0-4095)
clearflag 77 flag: int no Clears saved flag n
checkflag 78 flag: int yes Saved flag n: 1 or 0
cry 79 species: species, pitch: int = 0 no Plays a species’ cry
waitcry 80 no Waits until the cry has played
badge 81 badge: int yes 1 if the player has badge n (0-31)
setbadge 82 badge: int, on: switch = 1 no Gives or takes badge n
badges 83 yes How many badges the player has
fademusic 84 ticks: int = 30 no Fades the music out and waits
gender 85 yes The player’s gender
setgender 86 gender: gender no Sets the player’s gender
option 87 text: text no Hands over one option of a long choice (what choice with more than 8 compiles to)
listchoice 88 prompt: text yes Asks with the options handed over: the place, -1 if cancelled
partycount 89 yes How many creatures of the party are not eggs
partyspecies 90 slot: int yes The species in party place slot; 0 for none or an egg
sayline 91 first: text, n: int no Says the line n after first in its bank or file
hour 92 yes The game clock’s hour, 0-23
minute 93 yes The minute, 0-59
weekday 94 yes The day of the week, 0 Sunday to 6
day 95 yes The day of the month, 1-31
month 96 yes The month, 1-12
year 97 yes The year
clockchanged 98 yes 1 while new days are held back because the clock was turned back
steps 99 yes Steps taken in the whole game
journalnote 100 text: text no Writes a line in the journal screen’s diary
canuse 101 move: fieldmove yes The party place that would use field move move; 6 by an item; -1 for none
fieldmove 102 move: fieldmove yes Uses a field move here: 1, or 0 where it cannot
travel 103 yes How the player gets about: 0 walking, 1 cycling, 2 surfing, 3 diving
monget 104 slot: int, field: monfield, which: stat = 0, box: int = 0 yes A field of a creature of the party (box 0) or a box; -1 for none
monset 105 slot: int, field: monfield, value: int, which: stat = 0, box: int = 0 yes Sets a field of a creature, held to the engine’s rules; the field afterwards
rule 106 rule: rule yes One of the game’s rules (the rule words)
setrule 107 rule: rule, value: int no Sets a rule, from now on and in the save
getoption 108 option: option yes The value of one of the game’s own options; -1 for none
setoption 109 option: option, value: int no Sets one of the game’s own options
text 110 format: text, args: int… yes A line made of the format with {0}-{7} filled by the text values after it, in the next text register
name 111 kind: buffer, value: int = 0 yes The name buffer would show for the kind and value, in the next text register
speciesget 112 species: species, field: speciesfield yes A field of a species’ record (the speciesfield words); -1 for none
moveget 113 move: move, field: movefield yes A field of a move’s record (the movefield words); -1 for none
itemget 114 item: item, field: itemfield yes A field of an item’s record (the itemfield words); -1 for none
partyfind 115 kind: find, value: int yes The first party place whose creature fits (the find words); -1 for none
partytally 116 kind: tally, value: int = 0 yes How many of the party are of a kind (the tally words)
menubegin 117 prompt: text, at: side = 0, columns: int = 1, cancel: int = -1 no Begins a menu: its prompt, side (the side words), columns and the value of cancelling; menu(...) { } compiles to it
menuitem 118 text: text, value: int, enabled: int = 1 no Adds an entry with a value of its own; left out when enabled is 0; at most 64
menushow 119 yes Shows the menu and waits: the value of the entry chosen, or the cancel value
banner 120 no Shows the location banner with the map’s name again, whatever the game’s [banner] says about arriving
encounter 121 method: method yes A wild meeting the player starts: the map’s table for the method is rolled once (time of day, swarm and radio count; no repellent does). Met: a wild battle, and the value is its outcome; nothing met, no table or nobody able to fight: -1. In on headbutt, headbutt is the tree faced (-1 for a tree the player’s identifier leaves empty)
knowsmove 122 move: move yes The party place, plus one, of the first creature that knows the move; 0 for none
fruitstage 123 tree: int, hours: int = 0 yes How far a fruit tree (0 to 127) has grown back: 0 just picked to 4 ripe; a tree never picked is ripe. hours is its time to grow, 0 overnight
pickfruit 124 tree: int, item: item, count: int = 1, hours: int = 0 yes Picks a ripe fruit tree: count of the item into the bag, and it grows again. The number given; 0 if it is not ripe or there is no room
craftorder 125 fruit: item, product: item, count: int = 0 yes Gives the craftsman count of a fruit (0: all the bag holds) to make into as many of a product, ready the next day. The number taken; 0 if an order waits or the bag has none
craftstate 126 yes The craftsman’s order: 0 none, 1 waiting, 2 ready
craftcollect 127 yes A ready order into the bag: the number given; 0 if none is ready or there is no room
swarm 128 map: map, on: switch = 1 no Today’s swarm is on the map (its ...Swarm tables are used there), or with false no longer; saved
radio 129 sound: int no The radio plays sound 1 or 2 (the ...RadioA, ...RadioB tables are used), or 0 for none; saved
netbattle 130 yes A link battle with whoever else asks for one on the game’s server (plan 33): 1 when asked for; 0 in a game built without online play
daycare 131 what: daycare, slot: int = 0 yes Asks the day care: count left, egg 1 when the keeper has one, and of place slot (0 or 1) its species (0 for none), level now, levels gained, the fee to take it back (100 and 100 a level), its gender (-1 for none); compat, how the two get on, 0 to 3
daycaregive 132 slot: int yes Leaves the party’s creature in place slot at the day care, healed, for nothing: 1; 0 if both places are taken, it is an egg or the last that can fight
daycaretake 133 slot: int yes The day care’s creature in place slot joins the party as it has grown: 1; 0 with the party full, -1 with nobody there. The fee is the script’s to take
daycareegg 134 yes The keeper’s egg joins the party, made now from the two by the game’s daycare rules: 1; 0 with the party full, -1 with no egg
yard 135 who: actor, slot: int no The actor shows the day care’s creature in place slot, drawn with its follow sheet and wandering; hidden while the place is empty
currency 136 currency: currency yes The player’s amount of one of the game’s currencies ([rules.currencies] in game.toml, the currency words)
givecurrency 137 currency: currency, amount: int yes Gives an amount: 1, or 0 and nothing given when it would pass the currency’s most
takecurrency 138 currency: currency, amount: int yes Takes an amount: 1, or 0 and nothing taken when the player has less
currencyroom 139 currency: currency yes How much more of the currency fits
showcurrency 140 currency: currency no Shows the currency in the money box, which follows it; the box shows one thing at a time
hidecurrency 141 currency: currency no Hides the box if it shows that currency
signex 142 text: text, style: int = 0, icon: int = 0 no A sign with a style and an icon, what sign with them compiles to: style is a frame of the skin after the sign’s own (0: its own); icon a picture of graphics/ui/sign_icons/ beside the text (0: none)
showpic 143 picture: picture, x: int = 0, y: int = 0, front: switch = 0, touch: switch = 0 yes Shows a picture of graphics/art/ at a tile: behind, front: true in front, touch: true as the touch screen’s backdrop; 1 if shown
hidepic 144 which: pictures = 2 no Takes pictures down: back, front, touch or all (the default)
showmon 145 species: species, x: int = 10, y: int = 4 yes Shows a creature’s front picture in front at a tile (10, 4 unless given); 1 if shown
choosepic 146 first: picture, second: picture yes Two pictures side by side, the one not chosen darkened: 0 or 1 as chosen, -1 if cancelled
doublebattle 147 kind: trainer, name: text, version: int = 0, defeat: text = -1, lose: lose = 0, money: switch = 1, exempt: switch = 0, mode: mode = 0, called: name = 255, music: battlemusic = 0 yes A trainer battle fought two creatures a side, with trainerbattle’s arguments; waits: 1 won, 0 lost
fish 148 method: method yes A cast of a rod into the water ahead, as [world.fishing] plays it (task 25v): the battle’s outcome if something was landed; -1 nothing bit, -2 too early, -3 it got away, -4 no cast
roamer 149 what: roamer, slot: int = 0 yes Asks of the roaming creature in slot (0 to 5): count how many roam (the slot is ignored), state (0 none, 1 roaming, 2 beaten, 3 caught), the area it is in (-1 when it does not roam), its species, level, hp and status as the last meeting left them
roamerstart 150 slot: int, species: species, level: int yes A wild creature of the species at the level starts roaming in slot (0 to 5), on a route (a map of kind route) other than the one the player came from, and moves as the player changes maps by the game’s wild rules; saved: 1; 0 with no route or no such slot
roamerend 151 slot: int yes The roaming creature in slot is taken off its route and the slot emptied: 1; 0 when it was empty
eyemusic 152 kind: trainer no A trainer class’s eyes track for this map’s region ([audio.music] eyes); the map’s track comes back after the battle
musicoverride 153 music: music no A track over the map’s until musicoverride map, kept in [audio.music] override_var
halloffame 154 yes Enters the party in the Hall of Fame and shows it, a creature at a time; how many teams were ever entered (0, nothing shown, with nobody to enter)
hallview 155 yes The viewer of the Hall of Fame, until the player leaves it; how many teams were ever entered
hallcount 156 yes How many teams have ever been entered in the Hall of Fame
credits 157 part: int = 0 yes Shows a part (0 by default) of credits.txt, and waits: 1 shown to the end, 0 ended by a button or nothing to show
meter 158 label: text, value: int, max: int = 100 no Shows the HUD meter at the top right of the top screen: a label and a bar at value of max (100 by default); shown again with the same label, the bar moves to the value (plan 37)
meterhide 159 no Takes the HUD meter down
tagbattle 160 kind: trainer, name: text, kind2: trainer, name2: text, version: int = 0, version2: int = 0, defeat: text = -1, defeat2: text = -1, lose: lose = 0, money: switch = 1 yes Two trainers at once, a team and its own choices each (a tag battle, task 08z); the outcome as trainerbattle
multibattle 161 partner: trainer, partnername: text, kind: trainer, name: text, kind2: trainer, name2: text, defeat: text = -1, defeat2: text = -1, lose: lose = 0, money: switch = 1 yes Two trainers against the player and a partner trainer beside them, who chooses for its own place and team (a multi battle); the outcome as trainerbattle
wilddouble 162 species: species, level: int, species2: species, level2: int yes Two wild creatures at once (species and level of each); the outcome as wildbattle
teachable 163 tutor: tutor, slot: int, mode: int = 0 yes How many moves a tutor (a name of [rules.tutors], or relearn) could teach the creature in party place slot now: those its species may learn and it does not know; 0 for an egg. For the relearner mode is 0 (level-up moves up to its level), 1 (and egg moves) or 2 (every level-up move) (task 11l)
teach 164 tutor: tutor, slot: int, mode: int = 0 yes The list of what a tutor (or relearn) can teach the creature in party place slot, as a screen: the price of each as the cursor passes it, a forget-which question at four moves (a field move is kept where the game says: keep_field_moves in game.toml). Takes the price only when a move is learned. 1 if one was, else 0 (task 11l)
movecount 165 slot: int yes How many moves the creature in party place slot knows
forgetmove 166 slot: int yes The move deleter’s screen for the creature in party place slot: the moves it knows, one chosen and confirmed, the later ones moving up. 1 if one was forgotten; never its only move (check movecount) (task 11l)
rateable 167 slot: int yes Whether the name rater takes the creature in party place slot: 0 yes, 1 an egg, 2 another trainer’s (task 11l)
namemon 168 slot: int yes The naming screen for the creature in party place slot: 1 renamed, 2 the name it had, 0 left (task 11l)
backwarp 169 map: map, x: int, y: int no Sets where a back warp leads from now (the games’ dynamic warp)
players 170 yes How many players are in the field (several players, task 33c)
playerson 171 x: int, y: int, w: int = 1, h: int = 1 yes How many players stand in the rectangle of w x h cells from (x, y)
triggerplayer 172 yes The player (0 the first) whose step, talk or reading started the script
leash 173 cells: int no Sets the cells a player may go from the players’ middle (0 none)
pendget 174 field: pendfield, index: int = 0, which: stat = 0 yes In an editing hook: a field of the pending creature, or of member index of a pending party; -1 for none
pendset 175 field: pendfield, value: int, index: int = 0, which: stat = 0 yes In an editing hook: sets a field (a word, not an expression), held to the engine’s rules as monset is; the field afterwards, -1 when it cannot be set
pendcount 176 yes In an editing hook: the pending party’s members (1 for one creature; -1 outside a hook)
pendadd 177 species: species, level: int yes In on trainerparty: a member of the species at the level added at the end (up to 6); its index, or -1
pendremove 178 index: int no In on trainerparty: the member at index taken out (never the last one)
pendcancel 179 no In on wildmon: no meeting and no battle
settile 180 x: int, y: int, tile: int, solid: int = 0 no Changes the tile at a cell of a tile map to another of its tilesets, at the same height, and the cell to the tile’s behaviour (or solid with solid 1), until the map is loaded again; a 3D map ignores it
pickmon 181 first: species, second: species, third: species = 0, fourth: species = 0 yes A choice among the front pictures of two to four creatures side by side (a starter’s screen): left and right choose, A takes one; the place chosen from 0, or -1 if cancelled
pickitem 182 pocket: int yes Opens the bag on one pocket (1 to 8) to choose an item, which stays in the bag: the item chosen, or 0 for none
shopin 183 stock: shop, currency: currency, percent: int = 100 no Opens a shop whose prices are in a currency of [rules.currencies] (the items’ prices times percent), and waits; it only sells
mapnumber 184 yes The number of the map the player is on, as its map name gives it

Built-in names, by namespace. A project’s symbol files add to them.

Namespace Word Value
actor player 255
actor marker 254
actor self 253
actor follower 251
actor trigger 243
actor player2 244
actor player3 245
actor player4 246
actor player5 247
actor player6 248
actor player7 249
actor player8 250
dir down 0
dir left 1
dir right 2
dir up 3
fade out 0
fade in 1
colour black 0
colour white 1
door close 0
door open 1
buffer number 0
buffer item 1
buffer species 2
buffer move 3
buffer map 4
buffer player 5
buffer rival 6
buffer pocket 7
buffer tmmove 8
buffer nickname 9
name player 0
name rival 1
mover still 0
mover look 1
mover pace 2
mover wander 3
mover range 4
mover circuit 5
mover circuit_back 6
mover spin 7
mover face 8
mover in_place 9
emote alert 0
emote question 1
emote dots 2
emote glad 3
speed slowest 0
speed slow 1
speed normal 2
speed fast 3
speed fastest 4
speed instant 5
weather none 0
weather rain 1
weather snow 2
weather fog 3
weather sand 4
weather sun 5
weather heavyrain 6
weather blizzard 7
weather ash 8
weather diamonddust 9
weather dark 10
music none 65534
music map 65533
pictures back 0
pictures front 1
pictures all 2
pictures touch 3
gender male 0
gender female 1
record steps 0
record battles 1
record wins 2
record catches 3
record trades 4
record saves 5
lose respawn 0
lose stay 1
lose rest 2
switch false 0
switch true 1
entry map 1
entry journal 2
entry dex 3
entry card 4
mode class 0
mode easy 1
mode medium 2
mode hard 3
mode random 1
mode basic 4
mode expert 5
battlemusic foe 0
battlemusic wild 1
battlemusic trainer 2
battlemusic rival 3
battlemusic final 4
cell walk 0
cell blocked 1
cell grass 2
cell water 3
cell ledge_down 4
cell ledge_left 5
cell ledge_right 6
cell ledge_up 7
cell stairs 8
cell ice 9
cell door 10
cell counter 11
method land 0
method cave 1
method water 2
method oldrod 3
method goodrod 4
method superrod 5
method rocksmash 6
method headbutt 7
cell waterfall 26
cell rock_wall 27
cell bike_path 28
cell deep_water 29
fieldmove cut 0
fieldmove surf 1
fieldmove strength 2
fieldmove rocksmash 3
fieldmove waterfall 4
fieldmove rockclimb 5
fieldmove defog 6
fieldmove flash 7
fieldmove fly 8
fieldmove dive 9
fieldmove bike 10
tutor relearn 255
ease linear 0
ease in 1
ease out 2
ease inout 3
monfield species 0
monfield level 1
monfield exp 2
monfield ev 3
monfield iv 4
monfield nature 5
monfield ability 6
monfield shiny 7
monfield move 8
monfield pp 9
monfield item 10
monfield friendship 11
monfield hp 12
pendfield species 0
pendfield level 1
pendfield exp 2
pendfield ev 3
pendfield iv 4
pendfield nature 5
pendfield ability 6
pendfield shiny 7
pendfield move 8
pendfield pp 9
pendfield item 10
pendfield friendship 11
pendfield hp 12
pendfield form 13
pendfield gender 14
pendfield ball 15
stat hp 0
stat atk 1
stat def 2
stat spa 3
stat spd 4
stat spe 5
stat all 6
rule challenge 0
rule challenge_box 1
rule challenge_first 2
rule challenge_over 3
rule level_cap 4
rule exp_all 5
rule no_battle_items 6
rule battle_style 7
rule tera 8
rule zmove 9
speciesfield hp 0
speciesfield atk 1
speciesfield def 2
speciesfield spa 3
speciesfield spd 4
speciesfield spe 5
speciesfield type1 6
speciesfield type2 7
speciesfield ability1 8
speciesfield ability2 9
speciesfield hiddenability 10
speciesfield genderratio 11
speciesfield catchrate 12
speciesfield egggroup1 13
speciesfield egggroup2 14
speciesfield growthrate 15
speciesfield dexnumber 16
speciesfield basehappiness 17
speciesfield baseexp 18
speciesfield hatchsteps 19
speciesfield height 20
speciesfield weight 21
speciesfield form 22
speciesfield basespecies 23
speciesfield statsum 24
movefield type 0
movefield category 1
movefield power 2
movefield accuracy 3
movefield pp 4
movefield priority 5
movefield target 6
itemfield pocket 0
itemfield price 1
itemfield sellprice 2
itemfield fielduse 3
itemfield battleuse 4
itemfield holdeffect 5
itemfield machinemove 6
itemfield flingpower 7
find species 0
find move 1
find type 2
find item 3
find fieldmove 4
find able 5
find lead 6
tally creatures 0
tally eggs 1
tally fainted 2
tally species 3
tally able 4
side right 0
side left 1
daycare count 0
daycare egg 1
daycare species 2
daycare level 3
daycare levels 4
daycare fee 5
daycare gender 6
daycare compat 7
roamer count 0
roamer state 1
roamer area 2
roamer species 3
roamer level 4
roamer hp 5
roamer status 6
Action Code Argument
down 4 none; * n repeats
left 5 none; * n repeats
right 6 none; * n repeats
up 7 none; * n repeats
face_down 0 none (always 1)
face_left 1 none (always 1)
face_right 2 none (always 1)
face_up 3 none (always 1)
mark_down 8 none; * n repeats
mark_left 9 none; * n repeats
mark_right 10 none; * n repeats
mark_up 11 none; * n repeats
jump_down 12 a number in brackets
jump_left 13 a number in brackets
jump_right 14 a number in brackets
jump_up 15 a number in brackets
pause 16 a number in brackets
speed 17 a speed word in brackets
lock_facing 18 none (always 1)
unlock_facing 18 none (always 0)
show 19 none (always 1)
hide 19 none (always 0)
emote 20 a emote word in brackets
freeze 21 none (always 0)
unfreeze 21 none (always 1)
hop 12 none (always 0)
appear 19 none (always 1)
vanish 19 none (always 0)
What Limit
Code in one file, bytes 32767
Values on the expression stack 16
Call depth (scripts and procedures) 16
Temporaries of a script’s outermost frame 16
Words of a script’s frame stack 64
Scripts running at once 4
Actors moving by lists at once 8
Options of a choice 32
Options shown without scrolling 8
Instructions a script runs a tick before it yields 2000
Instructions an editing hook runs before it is stopped 4000
Saved flags 4096
Saved variables 512
Map-local flags 64
Map-local variables 32
Entries of an array 255
Text registers 8
Bytes of a text register 64