-
Notifications
You must be signed in to change notification settings - Fork 12
Scripts
Scripts are little bits of dialog and behavior that happen when the player bumps into a sprite, enters or leaves a room, or starts the game. Any plain text you write in the script will be printed in a little dialog box in the game, but there are also special codes you can use to format the text, change features of rooms or sprites, or do something only when a certain condition is met (like collecting enough items).
Jump to scripts for...
Returns some value, that can be inserted into the dialog text or used as an argument in another function or expression. Think of this as the verb of a sentence. Expressions are written with curly braces: {sprite-name}
Performs some action in the game or affects the dialog. Functions don't return values though, so you can't use them as arguments in other functions or expressions. Like an expression, you can think of this as the verb of a sentence. Functions are also written with curly braces: {remove-sprite}
A bit of information you give to an expression or function to tell it what to do. Think of these as the subjects and objects of a sentence. Arguments get written after the name of the expression/function, separated by spaces: {move-avatar "room-1-2" 0 5}
An integer (no floats/decimals) or an expression that returns a number.
A string/bit of text or an expression that returns a string. If you want to include spaces in your string (or you just feel like it) you can enclose it in double-quotes.
A boolean ("true" or "false") or an expression that returns a boolean.
If you write plain text into the script box, it will show up as dialog in the game.
A function that inserts a line break.
Example: line one{b}line two
A function that inserts a page break.
Example: page one{p}page two
A function that transforms the text between the opening and closing tags into animated, wavy text.
Example: {wavy}whoa so cool!{/wavy}
A function that transforms the text between the opening and closing tags into animated, shaky text.
Example: {shaky}spooky scary skeletons{/shaky}
A function that colors the text between the opening and closing tags with the specific number from the current room's color palette (0 = background color, 1 = first foreground color, etc).
Example: {color 1}some colorful text{/color}
A function that specifies where the dialog box should be shown on the screen.
Example: {position center}a dialog box in the middle of the screen{/position}
Example: {position fullscreen}a full-screen title card{/position}
A function that waits a number of frames before continuing with the script.
Example: huh...{delay 5} I didn't think that would work
An expression that returns the world's name.
Example: welcome to the world of {world-name}
An expression that returns the name of the avatar's sprite.
Example: the avatar is called {avatar-name}
An expression that returns the x position (column number) of the avatar, starting with 0.
Example: you're at column {avatar-x}
An expression that returns the y position (row number) of the avatar, starting with 0.
Example: you're at row {avatar-y}
A function that moves the avatar to the specific room and x, y position. If no room is specified, use the room they're already in.
Example: {move-avatar 0 15}
Example: {move-avatar room-1-2 0 15}
A function that changes the appearance of the avatar to look like the given sprite.
Example: {transform-avatar wall}
An expression that returns the name of the room that the current sprite is in. (Only available in sprite scripts.)
Example: this sprite lives in {sprite-room}
An expression that returns the x position (column number) of the current sprite, starting with 0. (Only available in sprite scripts.)
Example: this sprite is column {sprite-x}
An expression that returns the y position (row number) of the current sprite, starting with 0. (Only available in sprite scripts.)
Example: this sprite is on row {sprite-y}
An expression that returns the name of the current sprite. (Only available in sprite scripts.)
Example: hello, my name is {sprite-name}
An expression that returns "true" if the current sprite is a wall. (Only available in sprite scripts.)
Example: {if {sprite-wall}}you shall not pass!{/if}
An expression that returns "true" if the current sprite is an item. (Only available in sprite scripts.)
Example: {if {sprite-item}}eat me{/if}
A function that moves the current sprite to the specific room and x, y position. If no room is specified, use the room they're already in. (Only available in sprite scripts.)
Example: {move-sprite 0 5}
Example: {move-sprite room-1-2 0 5}
A function that adds a sprite to the given room at a specific x, y position. If no room is specified, use the room they're already in.
Example: {place-sprite teacup 0 5}
Example: {place-sprite teacup room-1-2 0 5}
A function that changes the current sprite into the given sprite. (Only available in sprite scripts.)
Example: {transform-sprite teacup}
A function that removes the current sprite from its current location. (Only available in sprite scripts.)
Example: {remove-sprite}
A function that changes the color palette index of the current sprite (0 = background color, 1 = first foreground color, etc). (Only available in sprite scripts.)
Example: {set-sprite-color 2}
A function that changes whether the current sprite is a wall. (Only available in sprite scripts.)
Example: {set-sprite-wall false}
A function that changes whether the current sprite is an item. (Only available in sprite scripts.)
Example: {set-sprite-item true}
The name of the current room (ie. the room the avatar is in)
Example: this is room {room-name}
An expression that returns whether there is a sprite at the given location.
Example: {if {is-empty 5 8}}{place-sprite teacup 5 8}{/if}
A function that sets the palette of the current or given room.
Example: {set-palette palette-2}
Example: {set-palette room-1-2 palette-2}
A function that sets the music of the current or given room.
Example: {set-music song-2}
Example: {set-music room-1-2 song-2}
An expression that adds the arguments together.
Example: {add 5 4} is equal to 9
An expression that subtracts the second argument from the first argument.
Example: {sub 5 4} is equal to 1
An expression that multiplies the arguments together.
Example: {mul 5 4} is equal to 20
An expression that divides the first argument by the second argument.
Example: {mul 20 4} is equal to 5
An expression that returns the first argument modulo the second argument.
Example: {mul 5 4} is equal to 1
An expression that returns a random number between the first and second argument (inclusive).
Example: {random 1 4} could be 1, 2, 3, or 4
A function that only displays the dialog (or run the functions) between the opening and closing tags if the argument is true.
You can also include an {else}
in the middle to display or do something else if the argument is false.
Example: to be {if {eq 2 8}}or not to be{/if}
Example: {if {lt {item-count crow} 10}} you need to befriend more crows {else} oh no... it's a murder! {/if}
An expression that returns "true" if the two arguments are equal to each other.
Example: {eq 5 5} is true
Example: {eq "something" "something else"} is false
An expression that returns "true" if the first argument is greater than the second one.
Example: {gt 5 4} is true but {gt 5 5} is false
An expression that returns "true" if the first argument is greater than or equal to the second one.
Example: {gte 5 4} and {gte 5 5} are both true
An expression that returns "true" if the first argument is less than the second one.
Example: {lt 5 6} is true but {lt 5 5} is false
An expression that returns "true" if the first argument is less than or equal to the second one.
Example: {lte 5 6} and {lte 5 5} are both true
An expression that returns "true" if the argument is false, and "false" if the argument is true.
Example: {not {eq 5 5}} is false, and {not {eq 5 4}} is true
An expression that returns "true" only if every argument is true.
Example: {all-true true true} is true but {all-true true false} is false
An expression that returns "true" if any argument is true.
Example: {any-true true true} and {any-true true false} are true
An expression that returns "true" if none of the arguments are true.
Example: {none-true true false} is false but {none-true false false} is true
An expression that returns the value of a variable, if that variable has been set.
Example: you have collected {var hearts} hearts
A function that sets the given variable to a new value (a number, string, or boolean).
Example: {set-var hearts 100}
A function that increments the given variable (adds one to its value, if it's a number). Optionally, you can add a second argument to increment by a larger number.
Example: {inc-var hearts}
Example: {inc-var hearts 10}
A function that decrements the given variable (subtracts one from its value, if it's a number). Optionally, you can add a second argument to decrement by a larger number.
Example: {dec-var hearts}
Example: {dec-var hearts 10}
An expression that returns the number of items in the player's inventory.
Example: I only have {item-count teacup} teacups left
A function that sets the number of the given item in the player's inventory (minimum 0).
Example: {set-item-count teacup 5}
A function that adds one of the given item to the player's inventory. Optionally, you can add a second argument to add more than one item at a time.
Example: {inc-var teacup}
Example: {inc-var teacup 5}
A function that removes one of the given item to the player's inventory (down to 0). Optionally, you can add a second argument to add more than one item at a time.
Example: {dec-var teacup}
Example: {dec-var teacup 5}
A function that changes which sprite is targeted for functions and expressions like "remove-sprite" and "sprite-name". If the sprite expression refers to multiple sprites, the contents of this expression are run for every sprite in that list.
An expression that returns the sprite(s) at the given coordinates in the current room.
Example: {pick {sprite-at 3 4}}{remove-sprite}{/pick}
An expression that returns all sprites in the current room.
Example: {pick {sprites-in-room}}{if {sprite-wall}}{remove-sprite}{/if}{/pick}
An expression that returns all sprites in the current room with the given name.
Example: {pick {sprites-named bud}}{transform-sprite flower}{/pick}
An expression that returns all sprites adjacent to the current sprite.
Example: {pick {neighbors}}hello, {sprite-name}! {/pick}