Scripting Language Reference
This is a manual for the kalmar compiler and the scripting language it compiles.
Syntax
Scripts
Scripts are defined using the scr
keyword followed by the name of the script and a set of curly brackets containing the contents of the script
scr cool_script {
Var[0] = 2
if Var[1] == 4 {
return
}
Var[1] = 6
return
}
Note that newlines are used to terminate each statement
Comments
Line comments are denoted with //
and run to the end of the line. They can be placed at the beginning of a line:
// this is a line comment
Var[0] = 5
or at the end of a line
scr main {
Var[0] = 5 // this is also a valid comment
}
Block comments are denoted with /* */
where everything in between the delimiters is commented out. They can be used in place of line comments but can additionally be placed in the middle of statements and can span multiple lines:
/*
This entire block
is
a
comment
*/
Var[0] = 2 + /* this is a valid statement */ 5
Types
Constants
All integers are stored as signed 32-bit numbers. They can be written in any of the following forms
Base | Example |
---|---|
Decimal | 523 |
Binary | 0b100110 |
Octal | 0o1342172 |
Hexadecimal | 0x41414141 |
Fractional numbers are interpreted as 32-bit floating point numbers. They are converted to fixed-point numbers with a scaling factor of 1024 during compilation.
Variables
Name | Size | Description |
---|---|---|
Var | 0x10 | Variables local to the current script |
Flag | 0x60 | Flags local to the current script |
MapVar | 0x10 | Global variables cleared upon map transition |
MapFlag | 0x60 | Global flags cleared upon map transition |
AreaByte | 0x10 | Bytes stored in save file. Cleared upon area transition |
AreaFlag | 0x100 | Flags stored in save file. Cleared upon area transition |
GameByte | 0x200 | Bytes stored in save file. Never cleared |
GameFlag | 0x800 | Flags stored in save file. Never cleared |
Array | - | Current script array. Must be assigned before use |
FlagArray | - | Current script flag array. Must be assigned before use |
Buffer | - | Current script buffer. Must be assigned before use |
Expressions
Assignment
Variables may be assigned values using the =
operator. They may be assigned integers, floating point numbers, values stored in variables, and references to other variables.
Var[0] = 5
Var[0] = 5.5
Var[0] = Var[1]
Var[0] = &Var[1]
Arithmetic
Arithmetic operators operate on a value stored in a variable and store the result back in the original variable.
// Adds 5 to the value stored in Var[0]
Var[0] += 5
The following operators are provided:
Operator | Operation | Valid operands |
---|---|---|
+= | Addition | Integers, Floats |
-= | Subtraction | Integers, Floats |
*= | Multipication | Integers, Floats |
/= | Division | Integers, Floats |
%= | Modulus | Integers |
|= | Bitwise OR | Integers, Variables |
&= | Bitwise AND | Integers, Variables |
Constant Expressions
Constant expressions are expressions that can be resolved by the compiler at compile time. They are provided for use in cases when representing a value as an expression may be more clear than using its fully evaluated form. These expressions may only include numbers and the following operators:
arithmetic:
+, -, *, /, %, &
boolean:
==, !=, <, <=, >, >=
Additionally, parentheses may be used to explicitly specify operator precedence
Buffers and Arrays
Script Buffer
The script buffer is a preexisting array that stores 32-bit integers which can be popped off by the current script.
The buffer must be assigned before use. It can be assigned by doing the following:
Buffer = Var[0]
Integers can be retrieved in order from the buffer. Note that this will advance the buffer by however many integers were accessed
Var[1], Var[2], Var[3] <- Buffer
Integers can also be retrieved by index without advancing the buffer
Var[2] = Buffer[1]
Script Array
The script array and flag array are arrays that can either be created within the script or be allocated before the script. They must be assigned before use
An array can be allocated with a specific size using the alloc
function. This will return the allocated array pointer and also overwrite the current script's array pointer to match
Var[2] = alloc(5)
If an array already exists, it can be set as the current script array or flag array by assigning either the variable Array
or FlagArray
Array = Var[2]
FlagArray = Var[3]
Values in the array can be accessed by index
Var[3] = Array[5]
Var[4] = FlagArray[0]
Control Flow
Wait
The wait
function blocks execution of the script for a specified number of frames, while wait_sec
blocks execution for a specified number of seconds
wait(5) // blocks script for 5 frames
wait_sec(22) // blocks script for 22 seconds
If statements
An if statement conditionally executes a set of statements if a provided expression evaluates to true
if expr {
// does something if expr is true
}
An alternate set of statements to be executed if the expression evaluates to false can be specified using an else statement
if expr {
// does something if expr is true
} else {
// does something if expr is false
}
Multiple conditions can also be chained together
if expr1 {
// does something if expr1 is true
} else if expr2 {
// does something if expr2 is true
} else {
// does something if neither are true
}
The following conditions are available:
a == b | a is equal to b |
a != b | a is not equal to b |
a < b | a is less than b |
a <= b | a is less than or equal to b |
a > b | a is greater than b |
a >= b | a is greater than or equal to b |
a & b | the bits of b are set on a |
The inverse of any condition can be tested by prefixing the condition with a !
character and surrounding it with parentheses
For example: a == b is equivalent to !(a != b)
Labels and Goto statements
A label specifies a statement that can be jumped to using a goto statement. The scope of a label is limited to the script it is defined in.
if Var[0] == 6 {
goto error
}
error:
return
Loops
A loop executes a set of statements a specified number of times
loop 5 {
// do something 5 times
}
If the loop count is 0 or is omitted, the loop will run indefinitely unless broken out of
loop {
// this code will run forever...
if expr { // until this condition is met
bloop
}
}
The bloop
keyword can be used to break out of any loop whether or not it executes a finite number of times.
Switch statements
A switch statement selects a set of statements to execute based on which condition matches the specified expression.
switch Var[0] {
3 {
// do something if Var[0] == 3
}
!= 5 {
// do something if Var[0] != 5
}
}
The following conditions are available:
a | expression is equal to a |
== a | expression is equal to a |
!= a | expression is not equal to a |
< a | expression is less than a |
<= a | expression is less than or equal to a |
> a | expression is greater than a |
>= a | expression is greater than or equal to a |
a | b | expression is equal to a or b |
a & b | expression is equal to a and b |
a..b | expression is between a and b (inclusive) |
& a | the bits of expression are set on a |
Additionally, the default
keyword can be used to designate a set of statements to execute if none of the previous conditions match.
The bcase
keyword can be used to break out of any case statement and jump execution to immediately after the switch statement ends.
Jump statements
A jump statement jumps execution to another script. The script to be jumped to can be defined anywhere in the file containing the script that contains the jump instruction.
scr script1 {
// script body
}
scr script 2 {
if Var[5] == 3 {
jump script1
}
}
Threads
Regular thread
A thread block creates a temporary script that runs alongside the current script, copying the current script variables to the new script
thread {
// do stuff
}
Child thread
Similar to a regular thread except the thread is killed when the current script is finished executing
cthread {
// do stuff
}
Exec/Exec Wait
The family of exec functions allow for launching a new script from inside another
The exec
function launches a script without blocking the execution of the current script
exec(cool_script)
The id of the launched script can be stored in a variable
Var[0] = exec(cool_script)
The exec_wait
function launches a script and blocks the execution of the current script until the child returns
exec_wait(cool_script)
Misc functions
Function | Arguments | Return value | Description |
---|---|---|---|
bind | script pointer, event type: int, collider id: int | trigger pointer | binds a script to run when an event is triggered |
bind_lock | script pointer, event type: int, collider id: int, item list: int | trigger pointer | works similar to the bind function but displays a list showing selectable items |
unbind | - | - | unbinds the current script from a trigger |
kill | id: int | - | kills a script with the given id |
set_priority | priority: int | - | sets the priority of a script |
set_timescale | timescale: float | - | sets the timescale of a script |
set_group | group: int | - | sets the group of a script |
suspend_group | group: int | - | suspends all scripts in the given group |
resume_group | group: int | - | resumes all scripts in the given group |
suspend_others | group: int | - | suspends all scripts in the given group excluding the current script |
resume_others | group: int | - | resumes all scripts in the given group excluding the current script |
suspend_thread | id: int | - | suspends all scripts with the id as well as their children |
resume thread | id: int | - | resumes all scripts with the id as well as their children |
is_thread_running | id: int | bool | returns whether a script with the given id is in the current script list |
Bytecode Instruction Reference
INTERNAL_FETCH (0x00)
Description
Arguments
INTERNAL_FETCH ()
END (0x01)
Description
Indicates the end of the script.
Arguments
END ()
RETURN (0x02)
Description
Returns from the script and kills it and its child if it has one. If it has a parent that it is blocking, copies the local variables and flags to the parent.
Arguments
RETURN ()
LABEL (0x03)
Description
Creates a label that can be jumped to with a goto statement. Up to 16 labels can be created per script.
Arguments
LABEL (id: int)
GOTO (0x04)
Description
Jumps execution to a position in the script specified by a label id.
Arguments
GOTO (id: var)
LOOP (0x05)
Description
Repeatedly executes the intructions in the next loop body a specified number of times. A count of 0 will repeat indefinitely until a BREAK_LOOP instruction is encountered. Hangs if the loop depth is greater or equal to 8.
Arguments
LOOP (count: int)
END_LOOP (0x06)
Description
Designates the end of a loop body. Hangs if the loop depth is less than 0.
Arguments
END_LOOP ()
BREAK_LOOP (0x07)
Description
Breaks out of a loop and jumps execution to immediately after the next END_LOOP instruction. Hangs if the loop depth is less than 0 or it reaches an END
instruction first.
Arguments
BREAK_LOOP ()
WAIT_FRAMES (0x08)
Description
Blocks the current script's execution for the specified number of frames.
Arguments
WAIT_FRAMES (frames: var)
WAIT_SECS (0x09)
Description
Blocks the current script's execution for the specified number of seconds.
Arguments
WAIT_SECS (seconds: float)
IF_EQ (0x0A)
Description
Executes the following instructions if ls == rs
, otherwise jumps execution to immediately after the next ELSE
or END_IF
instruction. Hangs if it reaches the END
instruction first.
Arguments
IF_EQ (ls: var, rs: var)
IF_NE (0x0B)
Description
Executes the following instructions if ls != rs
, otherwise jumps execution to immediately after the next ELSE
or END_IF
instruction. Hangs if it reaches the END
instruction first.
Arguments
IF_NE (ls: var, rs: var)
IF_LT (0x0C)
Description
Executes the following instructions if ls < rs
, otherwise jumps execution to immediately after the next ELSE
or END_IF
instruction. Hangs if it reaches the END
instruction first.
Arguments
IF_LT (ls: var, rs: var)
IF_GT (0x0D)
Description
Executes the following instructions if ls > rs
, otherwise jumps execution to immediately after the next ELSE
or END_IF
instruction. Hangs if it reaches the END
instruction first.
Arguments
IF_GT (ls: var, rs: var)
IF_LE (0x0E)
Description
Executes the following instructions if ls <= rs
, otherwise jumps execution to immediately after the next ELSE
or END_IF
instruction. Hangs if it reaches the END
instruction first.
Arguments
IF_LE (ls: var, rs: var)
IF_GE (0x0F)
Description
Executes the following instructions if ls >= rs
, otherwise jumps execution to immediately after the next ELSE
or END_IF
instruction. Hangs if it reaches the END
instruction first.
Arguments
IF_GE (ls: var, rs: var)
IF_FLAG (0x10)
Description
Executes the following instructions if val & flag != 0
, otherwise jumps execution to immediately after the next ELSE
or END_IF
instruction. Hangs if it reaches the END
instruction first.
Arguments
IF_FLAG (val: var, flag: int)
IF_NOT_FLAG (0x11)
Description
Executes the following instructions if val & flag == 0
, otherwise jumps execution to immediately after the next ELSE
or END_IF
instruction. Hangs if it reaches the END
instruction first.
Arguments
IF_NOT_FLAG (val: var, flag: int)
ELSE (0x12)
Description
Jumps execution to immediately after the next END_IF
instruction. Hangs if it reaches the END
instruction first.
Arguments
ELSE ()
END_IF (0x13)
Description
Designates the end of an if statement block.
Arguments
END_IF ()
SWITCH (0x14)
Description
Designates the start of a switch block. Stores the contents of val
as the current switch block value. Hangs if the switch depth is greater than or equal to 8.
Arguments
SWITCH (val: var)
SWITCH_CONST (0x15)
Description
Designates the start of a switch block. Stores val as the current switch block value. Hangs if the switch depth is greater than or equal to 8.
Arguments
SWITCH_CONST (val: int)
CASE_EQ (0x16)
Description
Jumps execution to immediately after the next END_SWITCH
if the switch value has already been matched. If not, executes the following instructions if val == switch value
, otherwise, jumps execution to the next case statement. Hangs if it reaches the END
instruction first or if the switch depth is less than 0.
Arguments
CASE_EQ (val: var)
CASE_NE (0x17)
Description
Jumps execution to immediately after the next END_SWITCH
if the switch value has already been matched. If not, executes the following instructions if val != switch value
, otherwise, jumps execution to the next case statement. Hangs if it reaches the END
instruction first or if the switch depth is less than 0.
Arguments
CASE_NE (val: var)
CASE_LT (0x18)
Description
Jumps execution to immediately after the next END_SWITCH
if the switch value has already been matched. If not, executes the following instructions if val < switch value
, otherwise, jumps execution to the next case statement. Hangs if it reaches the END
instruction first or if the switch depth is less than 0.
Arguments
CASE_LT (val: var)
CASE_GT (0x19)
Description
Jumps execution to immediately after the next END_SWITCH
if the switch value has already been matched. If not, executes the following instructions if val > switch value
, otherwise, jumps execution to the next case statement. Hangs if it reaches the END
instruction first or if the switch depth is less than 0.
Arguments
CASE_GT (val: var)
CASE_LE (0x1A)
Description
Jumps execution to immediately after the next END_SWITCH
if the switch value has already been matched. If not, executes the following instructions if val <= switch value
, otherwise, jumps execution to the next case statement. Hangs if it reaches the END
instruction first or if the switch depth is less than 0.
Arguments
CASE_LE (val: var)
CASE_GE (0x1B)
Description
Jumps execution to immediately after the next END_SWITCH
if the switch value has already been matched. If not, executes the following instructions if val >= switch value
, otherwise, jumps execution to the next case statement. Hangs if it reaches the END
instruction first or if the switch depth is less than 0.
Arguments
CASE_GE (val: var)
CASE_DEFAULT (0x1C)
Description
Jumps execution to immediately after the next END_SWITCH
if the switch value has already been matched. If not, executes the following instructions. Hangs if it reaches the END
instruction first or if the switch depth is less than 0.
Arguments
CASE_DEFAULT ()
CASE_OR_EQ (0x1D)
Description
Jumps execution to immediately after the next END_SWITCH
if the switch value has already been matched. If not, executes the following instructions if val == switch value
or any of the following CASE_OR_EQ
values equal the switch value until END_CASE_GROUP
is encountered, otherwise, jumps execution to the next case statement. Hangs if it reaches the END
instruction first or if the switch depth is less than 0.
Arguments
CASE_OR_EQ (val: var)
CASE_AND_EQ (0x1E)
Description
Jumps execution to immediately after the next END_SWITCH
if the switch value has already been matched. If not, executes the following instructions if val == switch value
and all of the following CASE_AND_EQ
values equal the switch value until END_CASE_GROUP
is encountered, otherwise, jumps execution to the next case statement. Hangs if it reaches the END
instruction first or if the switch depth is less than 0.
Arguments
CASE_AND_EQ (val: var)
CASE_FLAG (0x1F)
Description
Jumps execution to immediately after the next END_SWITCH
if the switch value has already been matched. If not, executes the following instructions if val & switch value != 0
, otherwise, jumps execution to the next case statement. Hangs if it reaches the END
instruction first or if the switch depth is less than 0.
Arguments
CASE_FLAG (val: int)
END_CASE_GROUP (0x20)
Description
Ends a CASE_OR_EQ
or CASE_AND_EQ
matching group.
Arguments
END_CASE_GROUP ()
CASE_RANGE (0x21)
Description
Jumps execution to immediately after the next END_SWITCH
if the switch value has already been matched. If not, executes the following instructions if min <= switch value <= max
, otherwise, jumps execution to the next case statement. Hangs if it reaches the END
instruction first or if the switch depth is less than 0.
Arguments
CASE_RANGE (min: var, max: var)
BREAK_SWITCH (0x22)
Description
Jumps execution to immediately after the next END_SWITCH
. Hangs if it reaches the END
instruction first or if the switch depth is less than 0.
Arguments
BREAK_SWITCH ()
END_SWITCH (0x23)
Description
Designates the end of a switch statement block. Hangs if the switch depth is less than 0.
Arguments
END_SWITCH ()
SET (0x24)
Description
Sets the contents of var
to the contents of val
.
Arguments
SET (var: var, val: var)
SET_CONST (0x25)
Description
Sets the contents of var
to val
.
Arguments
SET_CONST (var: var, val: int)
SETF (0x26)
Description
Sets the contents of var
to the contents of val
.
Arguments
SETF (var: var, val: float_var)
ADD (0x27)
Description
Adds the contents of addend
to the contents of res
, storing the result in res
.
Arguments
ADD (addend: var, res: var)
SUB (0x28)
Description
Subtracts the contents of minuend
from the contents of res
, storing the result in res
.
Arguments
SUB (minuend: var, res: var)
MUL (0x29)
Description
Multiplies the contents of multiplier
with the contents of res
, storing the result in res
.
Arguments
MUL (multiplier: var, res: var)
DIV (0x2A)
Description
Divides the contents of res
from the contents of dividend
, storing the quotient in res
.
Arguments
DIV (dividend: var, res: var)
MOD (0x2B)
Description
Divides the contents of res
from the contents of dividend
, storing the remainder in res
.
Arguments
MOD (dividend: var, res: var)
ADDF (0x2C)
Description
Adds the contents of addend
to the contents of res
, storing the result in res
.
Arguments
ADDF (addend: float_var, res: float_var)
SUBF (0x2D)
Description
Subtracts the contents of minuend
from the contents of res
, storing the result in res
.
Arguments
SUBF (minuend: float_var, res: float_var)
MULF (0x2E)
Description
Multiplies the contents of multiplier
with the contents of res
, storing the result in res
.
Arguments
MULF (multiplier: float_var, res: float_var)
DIVF (0x2F)
Description
Divides the contents of
from the contents of dividend
, storing the quotient in res
.
Arguments
DIVF (dividend: float_var, res: float_var)
USE_BUF (0x30)
Description
Sets the script's buffer pointer to the contents of ptr
.
Arguments
USE_BUF (ptr: var)
BUF_READ1 (0x31)
Description
Pops one integer from the script's buffer pointer, storing it in var1
. The buffer pointer is advanced by one position.
Arguments
BUF_READ1 (var1: var)
BUF_READ2 (0x32)
Description
Pops two integers from the script's buffer pointer, storing them in var1
and var2
. The buffer pointer is advanced by two positions.
Arguments
BUF_READ2 (var1: var, var2: var)
BUF_READ3 (0x33)
Description
Pops three integers from the script's buffer pointer, storing them in var1
, var2
, and var3
. The buffer pointer is advanced by three positions.
Arguments
BUF_READ3 (var1: var, var2: var, var3: var)
BUF_READ4 (0x34)
Description
Pops four integers from the script's buffer pointer, storing them in var1
, var2
, var3
, and var4
. The buffer pointer is advanced by four positions.
Arguments
BUF_READ4 (var1: var, var2: var, var3: var, var4: var)
BUF_PEEK (0x35)
Description
Gets the integer from the script's int buffer pointer at the offset stored in idx
, storing the result in res
. Does not advance the buffer pointer.
Arguments
BUF_PEEK (res: var, idx: var)
USE_FBUF (0x36)
Description
Sets the script's buffer pointer to the contents of ptr
.
Arguments
USE_FBUF (ptr: var)
FBUF_READ1 (0x37)
Description
Pops one float from the script's buffer pointer, storing it in var1
. The buffer pointer is advanced by one position.
Arguments
FBUF_READ1 (var1: float_var)
FBUF_READ2 (0x38)
Description
Pops two floats from the script's buffer pointer, storing them in var1
and var2
. The buffer pointer is advanced by two positions.
Arguments
FBUF_READ2 (var1: float_var, var2: float_var)
FBUF_READ3 (0x39)
Description
Pops three floats from the script's buffer pointer, storing them in var1
, var2
, and var3
. The buffer pointer is advanced by three positions.
Arguments
FBUF_READ3 (var1: float_var, var2: float_var, var3: float_var)
FBUF_READ4 (0x3A)
Description
Pops four floats from the script's buffer pointer, storing them in var1
, var2
, var3
, and var4
. The buffer pointer is advanced by four positions.
Arguments
FBUF_READ4 (var1: float_var, var2: float_var, var3: float_var, var4: float_var)
FBUF_PEEK (0x3B)
Description
Gets the float from the script's buffer pointer at the offset stored in idx
, storing the result in res
. Does not advance the buffer pointer.
Arguments
FBUF_PEEK (res: float_var, idx: var)
USE_ARRAY (0x3C)
Description
Sets the script's array pointer to the contents of ptr
.
Arguments
USE_ARRAY (ptr: var)
USE_FLAGS (0x3D)
Description
Sets the script's flag array pointer to the contents of ptr
.
Arguments
USE_FLAGS (ptr: var)
MALLOC_ARRAY (0x3E)
Description
Allocates an array of size
words, setting the script's array pointer to the allocated array and storing the pointer in res
. The array is padded to 0x10 bytes.
Arguments
MALLOC_ARRAY (size: var, res: var)
BITWISE_AND (0x3F)
Description
ANDs the contents of val
with the contents of res
, storing the result in res
.
Arguments
BITWISE_AND (res: var, val: var)
BITWISE_AND_CONST (0x40)
Description
ANDs val
with the contents of res
, storing the result in res
.
Arguments
BITWISE_AND_CONST (res: var, val: int)
BITWISE_OR (0x41)
Description
ORs the contents of val
with the contents of res
, storing the result in res
.
Arguments
BITWISE_OR (res: var, val: var)
BITWISE_OR_CONST (0x42)
Description
ORs val
with the contents of res
, storing the result in res
.
Arguments
BITWISE_OR_CONST (res: var, val: var)
CALL (0x43)
Description
Calls func
with the provided arguments. Blocks the script's execution if the function does not return 2, calling the function every frame until it does.
Arguments
CALL (func: var, args...)
EXEC (0x44)
Description
Creates a new script with the same priority and group of the current script and starts execution at the address stored in script
. Copies the current script's local variables, flags, and array and flag array pointers to the new script. Hangs if there are already 128 scripts in the script list.
Arguments
EXEC (script: var)
EXEC_GET_TID (0x45)
Description
Identical to EXEC
but stores the id of the new script in id
.
Arguments
EXEC_GET_TID (script: var, id: var)
EXEC_WAIT (0x46)
Description
Creates a new script and blocks the current script's execution until it finishes executing.
Arguments
EXEC_WAIT (script: var)
BIND_TRIGGER (0x47)
Description
Binds a trigger of type type
to a script, executing the script whenever the trigger is activated. Stores the address of the trigger in trigger
.
Arguments
BIND_TRIGGER (script: var, type: int, collider_id: var, interact_prompt: int, trigger: var)
UNBIND (0x48)
Description
Deletes the current script's trigger.
Arguments
UNBIND ()
KILL_THREAD (0x49)
Description
Kills every script with the id stored in id
as well as their children. If it has a parent that it is blocking, copies the local variables and flags to the parent.
Arguments
KILL_THREAD (id: var)
JUMP (0x4A)
Description
Jumps execution to the contents of script
, clearing all current labels and loading labels from the new script.
Arguments
JUMP (script: var)
SET_PRIORITY (0x4B)
Description
Sets the priority of the current script to the contents of priority
.
Arguments
SET_PRIORITY (priority: var)
SET_TIMESCALE (0x4C)
Description
Sets the timescale of the current script to the contents of scale
.
Arguments
SET_TIMESCALE (scale: float_var)
SET_GROUP (0x4D)
Description
Sets the group number of the current script to the contents of group
.
Arguments
SET_GROUP (group: var)
BIND_PADLOCK (0x4E)
Description
Similar to BIND
but displays a prompt containing a list of selectable items.
Arguments
BIND_PADLOCK (script: var, type: int, collider_id: var, item_list: var, trigger: int, interact_prompt: int)
SUSPEND_GROUP (0x4F)
Description
Suspends execution of all scripts with the group number stored in group
.
Arguments
SUSPEND_GROUP (group: var)
RESUME_GROUP (0x50)
Description
Resumes execution of all scripts with the group number stored in group
.
Arguments
RESUME_GROUP (group: var)
SUSPEND_OTHERS (0x51)
Description
Suspends execution of all scripts with the group number stored in group
except the current script.
Arguments
SUSPEND_OTHERS (group: var)
RESUME_OTHERS (0x52)
Description
Resumes execution of all scripts with the group number stored in group
except the current script.
Arguments
RESUME_OTHERS (group: var)
SUSPEND_THREAD (0x53)
Description
Suspends every script with the id stored in id
as well as their children.
Arguments
SUSPEND_THREAD (id: var)
RESUME_THREAD (0x54)
Description
Resumes every script with the id stored in id
as well as their children.
Arguments
RESUME_THREAD (id: var)
IS_THREAD_RUNNING (0x55)
Description
Checks if a script with the id stored in id
is in the current script list, storing 1 in out
if it is and 0 otherwise.
Arguments
IS_THREAD_RUNNING (id: var, out: var)
THREAD (0x56)
Description
Executes the following instructions in a new script, copying the current script's local variables, flags, and array and flag array pointers to the new script. Is not killed if the parent script is terminated. Hangs if there are already 128 scripts in the script list.
Arguments
THREAD ()
END_THREAD (0x57)
Description
Designates the end of the thread block.
Arguments
END_THREAD ()
CHILD_THREAD (0x58)
Description
Behaves like THREAD
but the new script is killed if its parent is.
Arguments
CHILD_THREAD ()
END_CHILD_THREAD (0x59)
Description
Designates the end of the child thread block.
Arguments
END_CHILD_THREAD ()
DEBUG_LOG (0x5A)
Description
Does nothing.
Arguments
DEBUG_LOG ()
DEBUG_PRINT_VAR (0x5B)
Description
Prints var
and its value.
Arguments
DEBUG_PRINT_VAR (var: var)
OP_92 (0x5C)
Description
Saves the current script pointer (unused).
Arguments
OP_92 ()
OP_93 (0x5D)
Description
Does nothing.
Arguments
OP_93 ()
OP_94 (0x5E)
Description
Checks if the current script is in the script list. Always returns 1.
Arguments
OP_94 ()