Skip to content

script_api/macros.h

EVT_FIXED_TO_FLOAT

#define EVT_FIXED_TO_FLOAT(x) source

Progammatically converts Float --> f32

FLOAT_TO_FIXED

#define FLOAT_TO_FIXED(x) source

Progammatically converts f32 --> Float

Ref

#define Ref(sym) source

Address/pointer constant.

LocalVar

#define LocalVar(INDEX) source

Local Word. A variable local to the current script. These are copied to scripts created by Exec, ExecWait, Thread, and ChildThread. Additionally, ExecWait copies LWs back from the child when it completes.

Range: 0 <= v < 0x10

MapVar

#define MapVar(INDEX) source

Global Word. A variable global to all scripts. Cleared upon entering a new map.

Range: 0 <= v < 0x10

LocalFlag

#define LocalFlag(INDEX) source

Local Flag. A boolean variable local to the current script. These are copied to scripts created by Exec, ExecWait, Thread, and ChildThread. Additionally, ExecWait copies LFs back from the child when it completes.

Range: 0 <= v < 0x60

MapFlag

#define MapFlag(INDEX) source

Global Flag. A boolean variable global to all scripts. Cleared upon entering a new map.

Range: 0 <= v < 0x60

AreaFlag

#define AreaFlag(INDEX) source

Local Save World Flag. A boolean variable local to the current world area, saved in the savefile. Cleared upon entering a new world area.

Used to track whether items that respawn, such as coins, Goomnuts, or Koopa Leaves, have been collected.

Range: 0 <= v < 0x100

GameFlag

#define GameFlag(INDEX) source

Global Save World Flag. A boolean variable saved in the savefile.

Used to track whether badges, items, etc. have been collected or whether NPCs have been interacted with.

Range: 0 <= v < 0x800

AreaByte

#define AreaByte(INDEX) source

Local Saved Byte. A variable local to the current world area, saved in the savefile. Cleared upon a new world area.

Rarely used. Most common use is for NPCs with dialogue that changes depending on the number of times you have interacted with them in their 'recent memory' (i.e. until you leave the area).

Range: 0 <= v < 0x10

GameByte

#define GameByte(INDEX) source

Global Saved Byte. A variable saved in the save file.

Used for almost all savefile state.

ArrayVar

#define ArrayVar(INDEX) source

User Word. A variable stored within the current script's array. You can load an array with UseArray or temporarily allocate one with MallocArray, then get/set values with the ArrayVar(index) macro.

Range: 0 <= v

ArrayFlag

#define ArrayFlag(INDEX) source

User Flag. A boolean variable stored within the current script's flag array. The flag array is distinct from the word array (unlike UseBuf and UseFBuf).

Range: 0 <= v

ArgVar

#define ArgVar(INDEX) source

Argument Word. A variable parameter to this script execution. Args are set by Exec/ExecGetID/ExecWait and are not inherited by child scripts or thread blocks. Assumed to be constant. Mutating by evt_set_variable or evt_set_float_variable will trigger PANIC.

ARG_INT

#define ARG_INT(EXPR) source

Force an Exec/ExecGetID/ExecWait argument to be dereferenced through evt_get_variable. Arguments not wrapped with ARG_INT or ARG_FLOAT are passed as literal bytecode words.

ARG_FLOAT

#define ARG_FLOAT(EXPR) source

Force an Exec/ExecGetID/ExecWait argument to be dereferenced through evt_get_float_variable. The captured value is stored in the child ArgVar as an EVT fixed-point bytecode word.

EvtEval0Func

typedef EvtEval0Func source

EvtEval1Func

typedef EvtEval1Func source

EvtEval2Func

typedef EvtEval2Func source

EvtEval3Func

typedef EvtEval3Func source

EvtEval4Func

typedef EvtEval4Func source

EvtEval5Func

typedef EvtEval5Func source

EvtEval6Func

typedef EvtEval6Func source

EvtEvalF0Func

typedef EvtEvalF0Func source

EvtEvalF1Func

typedef EvtEvalF1Func source

EvtEvalF2Func

typedef EvtEvalF2Func source

EvtEvalF3Func

typedef EvtEvalF3Func source

EvtEvalF4Func

typedef EvtEvalF4Func source

EvtEvalF5Func

typedef EvtEvalF5Func source

EvtEvalF6Func

typedef EvtEvalF6Func source

EvtInvoke0Func

typedef EvtInvoke0Func source

EvtInvoke1Func

typedef EvtInvoke1Func source

EvtInvoke2Func

typedef EvtInvoke2Func source

EvtInvoke3Func

typedef EvtInvoke3Func source

EvtInvoke4Func

typedef EvtInvoke4Func source

EvtInvoke5Func

typedef EvtInvoke5Func source

EvtInvoke6Func

typedef EvtInvoke6Func source

EvtInvokeF0Func

typedef EvtInvokeF0Func source

EvtInvokeF1Func

typedef EvtInvokeF1Func source

EvtInvokeF2Func

typedef EvtInvokeF2Func source

EvtInvokeF3Func

typedef EvtInvokeF3Func source

EvtInvokeF4Func

typedef EvtInvokeF4Func source

EvtInvokeF5Func

typedef EvtInvokeF5Func source

EvtInvokeF6Func

typedef EvtInvokeF6Func source

EvtPredicate0Func

typedef EvtPredicate0Func source

EvtPredicate1Func

typedef EvtPredicate1Func source

EvtPredicate2Func

typedef EvtPredicate2Func source

EvtPredicate3Func

typedef EvtPredicate3Func source

EvtPredicate4Func

typedef EvtPredicate4Func source

EvtPredicate5Func

typedef EvtPredicate5Func source

EvtPredicate6Func

typedef EvtPredicate6Func source

EvtPredicateF0Func

typedef EvtPredicateF0Func source

EvtPredicateF1Func

typedef EvtPredicateF1Func source

EvtPredicateF2Func

typedef EvtPredicateF2Func source

EvtPredicateF3Func

typedef EvtPredicateF3Func source

EvtPredicateF4Func

typedef EvtPredicateF4Func source

EvtPredicateF5Func

typedef EvtPredicateF5Func source

EvtPredicateF6Func

typedef EvtPredicateF6Func source

EVT_ENTITY_ID_BIT

#define EVT_ENTITY_ID_BIT source

An entity index. Entities are assigned indices in the order they are created with Call(MakeEntity, ...). Supported in BindTrigger and BindItemPrompt only.

End

#define End source

Signals the end of EVT script data. A script missing this will likely crash on load.

Return

#define Return source

Kills the current EVT script. A script missing a return will live - but do nothing - forever, or until something else kills it (e.g. leaving the map).

Finally

#define Finally source

Marks the start of a synchronous cleanup tail for the script. When present, Return, End, and external kills run the commands after Finally before the script is cleaned up. Owned children are cleaned up first. The tail ends at the normal End/EndThread/EndChildThread and must not block or start an owned child. Exec and ExecGetID may start detached scripts. KillScript is allowed and is idempotent for scripts which are already terminating.

Jump

#define Jump(EVT_SOURCE) source

Jumps to a given instruction pointer and begins execution from there. You can jump to a different EVT source and labels etc. will be loaded as expected. The timescale for the current script is also reset to the global default.

Label

#define Label(LABEL_ID) source

Marks this point in the script as a Goto target.

LABEL_ID may be an integer constant outside the EVT expression range, or a pointer to an identifier-style string such as "Resume" or Ref(sym).

Goto

#define Goto(LABEL_ID) source

Moves execution to the given label.

LABEL_ID must use the same representation as the matching Label.

Loop

#define Loop(TIMES) source

Marks the beginning of a loop.

Loop(TIMES) ... EndLoop

The variable or value given in TIMES is decremented upon each loop iteration. After the "1" iteration completes, the loop exits. Use Loop(0) for an infinite loop; make sure it breaks or blocks to avoid a freeze.

Up to 8 loops may be nested within a single script.

EndLoop

#define EndLoop source

Marks the end of a loop.

BreakLoop

#define BreakLoop source

Breaks out of the innermost loop.

ContinueLoop

#define ContinueLoop source

Skips to the next iteration of the innermost loop.

RetryLoop

#define RetryLoop source

Immediately restarts the current iteration of the innermost loop without updating its counter.

Lerp

#define Lerp(VAR, START, END, DURATION, EASING) source

Marks the beginning of a lerp loop.

Lerp(VAR, START, END, DURATION, EASING) ... EndLerp

VAR is set to the current interpolated value before each iteration. START and END may be integer or Float values. DURATION is measured in frames. The body runs once for each elapsed frame from 0 through DURATION, then exits. EndLerp yields for one frame between iterations, so no Wait is needed inside the loop.

BreakLoop exits the lerp early. ContinueLoop and RetryLoop are not allowed inside Lerp. Lerp blocks cannot be nested. Up to 8 total Loop and Lerp blocks may be active within a single script.

EndLerp

#define EndLerp source

Marks the end of a lerp loop.

Wait

#define Wait(NUM_FRAMES) source

Blocks for the given number of frames.

WaitSecs

#define WaitSecs(NUM_SECONDS) source

Blocks for the given number of seconds.

IfEq

#define IfEq(LVAR, RVAR) source

Marks the beginning of an if statement that only executes if LVAR == RVAR.

IfEq(LVAR, RVAR) ... Else ... EndIf

The Else block is optional.

IfNe

#define IfNe(LVAR, RVAR) source

Marks the beginning of an if statement that only executes if LVAR != RVAR.

IfLt

#define IfLt(LVAR, RVAR) source

Marks the beginning of an if statement that only executes if LVAR < RVAR.

IfGt

#define IfGt(LVAR, RVAR) source

Marks the beginning of an if statement that only executes if LVAR > RVAR.

IfLe

#define IfLe(LVAR, RVAR) source

Marks the beginning of an if statement that only executes if LVAR <= RVAR.

IfGe

#define IfGe(LVAR, RVAR) source

Marks the beginning of an if statement that only executes if LVAR >= RVAR.

IfRange

#define IfRange(LVAR, MIN, MAX) source

Marks the beginning of an if statement that only executes if MIN <= LVAR <= MAX.

IfNotRange

#define IfNotRange(LVAR, MIN, MAX) source

Marks the beginning of an if statement that only executes if LVAR < MIN or LVAR > MAX.

IfFlag

#define IfFlag(LVAR, RVAR) source

Marks the beginning of an if statement that only executes if the RVAR flag is set on LVAR, i.e. (LVAR & RVAR) != 0.

IfNotFlag

#define IfNotFlag(LVAR, RVAR) source

Marks the beginning of an if statement that only executes if the RVAR flag is unset on LVAR, i.e. (LVAR & RVAR) == 0.

Else

#define Else source

Marks the end of an if statement and the start of the else block.

EndIf

#define EndIf source

Marks the end of an if statement or an else block.

Switch

#define Switch(LVAR) source

Marks the start of a switch statement.

Switch(LVAR) CaseEq(RVAR) ... EndSwitch

Unlike C, EVT switch statements do not have fallthrough by default. If you want to opt-in to fallthrough, use CaseOrEq.

Up to 8 switch statements may be nested within a single script.

SwitchConst

#define SwitchConst(LCONST) source

Marks the start of a switch statement where the given value is treated as-is instead of using evt_get_variable. That is, SwitchConst(LocalVar(0)) will switch over the value 0xFE363C80 instead of the value contained within LocalVar(0).

CaseEq

#define CaseEq(RVAR) source

Marks the start of a switch case that executes only if LVAR == RVAR. It also marks the end of any previous case.

CaseNe

#define CaseNe(RVAR) source

Marks the start of a switch case that executes only if LVAR != RVAR. It also marks the end of any previous case.

CaseLt

#define CaseLt(RVAR) source

Marks the start of a switch case that executes only if LVAR < RVAR. It also marks the end of any previous case.

CaseGt

#define CaseGt(RVAR) source

Marks the start of a switch case that executes only if LVAR > RVAR. It also marks the end of any previous case.

CaseLe

#define CaseLe(RVAR) source

Marks the start of a switch case that executes only if LVAR <= RVAR. It also marks the end of any previous case.

CaseGe

#define CaseGe(RVAR) source

Marks the start of a switch case that executes only if LVAR >= RVAR. It also marks the end of any previous case.

CaseDefault

#define CaseDefault source

Marks the start of a switch case that executes unconditionally. It also marks the end of any previous case.

CaseOrEq

#define CaseOrEq(RVAR) source

Marks the start of a switch case that executes only if LVAR == RVAR. It also marks the end of any previous case. Unlike CaseEq, CaseOrEq will fallthrough to the next case until EndCaseGroup is reached.

CaseAndEq

#define CaseAndEq(RVAR) source

Marks the start of a switch case that executes only if LVAR == RVAR. It also marks the end of any previous case. Similar to CaseOrEq, CaseAndEq has fallthrough. However, if LVAR != RVAR, fallthrough does not apply.

CaseFlag

#define CaseFlag(RVAR) source

Marks the start of a switch case that executes only if the RVAR flag is set on LVAR, i.e. (LVAR & RVAR) != 0. It also marks the end of any previous case.

EndCaseGroup

#define EndCaseGroup source

Marks the end of a switch case group (CaseOrEq and/or CaseAndEq), stopping fallthrough.

CaseRange

#define CaseRange(MIN, MAX) source

Marks the start of a switch case that executes only if MIN <= LVAR <= MAX (inclusive). It also marks the end of any previous case.

BreakSwitch

#define BreakSwitch source

Marks the end of a switch case

EndSwitch

#define EndSwitch source

Marks the end of a switch statement and any case.

Set

#define Set(VAR, INT_VALUE) source

Sets the given variable to a given value casted to an integer.

SetConst

#define SetConst(VAR, CONST) source

Sets the given variable to a given value, skipping the evt_get_variable call. That is, SetConst(LocalVar(0), LocalVar(1)) will set LocalVar(0) to 0xFE363C81 instead of copying the value of LocalVar(1) into LocalVar(0).

SetF

#define SetF(VAR, FLOAT_VALUE) source

Sets the given variable to a given value, but supports Floats.

Add

#define Add(VAR, INT_VALUE, MORE...) source

When used with two args, adds a value to a variable (A += B). When used with more args, all are added together and stored in the variable (A = B + C + ...).

Sub

#define Sub(VAR, INT_VALUE, MORE...) source

When used with two args, subtracts a value from a variable (A -= B). When used with three args, subtracts one value from another and stores the result in the variable (A = B - C).

Mul

#define Mul(VAR, INT_VALUE, MORE...) source

When used with two args, multiplies a variable by a value (A *= B). When used with more args, all are multiplied together and stored in the variable (A = B * C * ...).

Div

#define Div(VAR, INT_VALUE, MORE...) source

When used with two args, divides a variable by a value (A /= B). When used with three args, divides one value by another and stores the result in the variable (A = B / C).

Mod

#define Mod(VAR, INT_VALUE, MORE...) source

When used with two args, stores the remainder of a variable divided by a value (A %= B). When used with three args, stores the remainder of one value divided by another in the variable (A = B % C).

AddF

#define AddF(VAR, FLOAT_VALUE, MORE...) source

When used with two args, adds a value to a variable (A += B). When used with more args, all are added together and stored in the variable (A = B + C + ...).

SubF

#define SubF(VAR, FLOAT_VALUE, MORE...) source

When used with two args, subtracts a value from a variable (A -= B). When used with three args, subtracts one value from another and stores the result in the variable (A = B - C).

MulF

#define MulF(VAR, FLOAT_VALUE, MORE...) source

When used with two args, multiplies a variable by a value (A *= B). When used with more args, all are multiplied together and stored in the variable (A = B * C * ...).

DivF

#define DivF(VAR, FLOAT_VALUE, MORE...) source

When used with two args, divides a variable by a value (A /= B). When used with three args, divides one value by another and stores the result in the variable (A = B / C).

Neg

#define Neg(VAR, INT_VALUE...) source

When used with one arg, negates a variable (A = -A). When used with two args, negates a value and stores the result in the variable (A = -B).

NegF

#define NegF(VAR, FLOAT_VALUE...) source

When used with one arg, negates a variable (A = -A). When used with two args, negates a value and stores the result in the variable (A = -B).

Abs

#define Abs(VAR, INT_VALUE...) source

When used with one arg, stores the absolute value of a variable (A = abs(A)). When used with two args, stores the absolute value of another value (A = abs(B)).

AbsF

#define AbsF(VAR, FLOAT_VALUE...) source

When used with one arg, stores the absolute value of a variable (A = abs(A)). When used with two args, stores the absolute value of another value (A = abs(B)).

Sign

#define Sign(VAR, INT_VALUE...) source

When used with one arg, stores the sign of a variable as -1, 0, or 1 (A = sign(A)). When used with two args, stores the sign of another value as -1, 0, or 1 (A = sign(B)).

SignF

#define SignF(VAR, FLOAT_VALUE...) source

When used with one arg, stores the sign of a variable as -1.0, 0.0, or 1.0 (A = sign(A)). When used with two args, stores the sign of another value as -1.0, 0.0, or 1.0 (A = sign(B)).

Min

#define Min(VAR, INT_VALUE, MORE...) source

When used with two args, stores the lower of a variable and another value (A = min(A, B)). When used with more args, stores the lowest value in the variable (A = min(B, C, ...)).

MinF

#define MinF(VAR, FLOAT_VALUE, MORE...) source

When used with two args, stores the lower of a variable and another value (A = min(A, B)). When used with more args, stores the lowest value in the variable (A = min(B, C, ...)).

Max

#define Max(VAR, INT_VALUE, MORE...) source

When used with two args, stores the higher of a variable and another value (A = max(A, B)). When used with more args, stores the highest value in the variable (A = max(B, C, ...)).

MaxF

#define MaxF(VAR, FLOAT_VALUE, MORE...) source

When used with two args, stores the higher of a variable and another value (A = max(A, B)). When used with more args, stores the highest value in the variable (A = max(B, C, ...)).

Clamp

#define Clamp(VAR, MIN_OR_VALUE, MAX_OR_MIN, MORE...) source

When used with three args, clamps a variable between a min and max (A = clamp(A, MIN, MAX)). When used with four args, clamps a value between a min and max and stores the result (A = clamp(B, MIN, MAX)).

ClampF

#define ClampF(VAR, MIN_OR_VALUE, MAX_OR_MIN, MORE...) source

When used with three args, clamps a variable between a min and max (A = clamp(A, MIN, MAX)). When used with four args, clamps a value between a min and max and stores the result (A = clamp(B, MIN, MAX)).

UseBuf

#define UseBuf(INT_PTR) source

Loads a s32 pointer for use with subsequent BufRead commands.

BufRead

#define BufRead(VAR, MORE...) source

Consumes one or more s32s from the buffer and stores them in the given variables.

BufPeek

#define BufPeek(VAR, OFFSET) source

Gets the s32 at the given offset of the buffer and stores it in the given variable, without consuming it.

UseFBuf

#define UseFBuf(FLOAT_PTR) source

Loads an s32 pointer of fixed-point Float(...) values for use with subsequent FBufRead commands. Beware that the int buffer and the float buffer are not distinct.

FBufRead

#define FBufRead(VAR, MORE...) source

Consumes one or more fixed-point Float(...) values from the buffer and stores them in the given variables.

FBufPeek

#define FBufPeek(VAR, OFFSET) source

Gets the fixed-point Float(...) value at the given offset and stores it without consuming it.

MemGet

#define MemGet(OUT_VAR, SOURCE) source

Reads a typed value from a C lvalue into an EVT variable. The address is taken implicitly and must refer to readable memory. No bounds checking is performed.

MemSet

#define MemSet(DESTINATION, VALUE) source

Writes an EVT value to a typed C lvalue. The address is taken implicitly and must refer to writable memory. No bounds checking is performed.

MemGetIndex

#define MemGetIndex(OUT_VAR, SOURCE_ARRAY, INDEX) source

Reads a typed array element using an index evaluated when the script runs. The array must be a link-time-addressable C array, not a pointer stored in an EVT variable.

MemSetIndex

#define MemSetIndex(DESTINATION_ARRAY, INDEX, VALUE) source

Writes a typed array element using an index evaluated when the script runs. The array must be a link-time-addressable C array, not a pointer stored in an EVT variable.

UseArray

#define UseArray(INT_PTR) source

Loads an s32 array pointer into the current script for use with ArrayVar(INDEX).

UseFlagArray

#define UseFlagArray(PACKED_FLAGS_PTR) source

Loads an s32 array pointer into the current script for use with UF(INDEX). Flags are stored in a 'packed' structure where indices refer to bits.

MallocArray

#define MallocArray(SIZE, OUT_PTR_VAR) source

Allocates a new array of the given size for use with ArrayVar(INDEX). EVT scripts do not have to worry about freeing this array.

BitwiseAnd

#define BitwiseAnd(VAR, VALUE) source

VAR &= VALUE

BitwiseAndConst

#define BitwiseAndConst(VAR, CONST) source

VAR &= CONST, but CONST is treated as-is rather than dereferenced with evt_get_variable.

BitwiseOr

#define BitwiseOr(VAR, VALUE) source

VAR |= VALUE

BitwiseOrConst

#define BitwiseOrConst(VAR, CONST) source

VAR |= CONST, but CONST is treated as-is rather than dereferenced with evt_get_variable.

Exec

#define Exec(EVT_SOURCE, ARGS...) source

Launches a new detached script. The following values are copied from the current script to the new script:

  • LocalFlags
  • LocalVars
  • Array pointer
  • Flag array pointer
  • Priority
  • Group

Extra ARGS become ArgVars in the new script. Arguments are passed as literal bytecode words unless explicitly wrapped with ARG_INT or ARG_FLOAT.

ExecGetID

#define ExecGetID(OUTVAR, EVT_SOURCE, ARGS...) source

Identical to Exec, but the newly-launched script ID is stored in OUTVAR. The other script may be interacted with using KillScript, SuspendScript, ResumeScript, and IsScriptRunning. Extra ARGS become ArgVars in the new script with the same capture rules as Exec.

ExecWait

#define ExecWait(EVT_SOURCE, ARGS...) source

Launches a new child script. Blocks for at least one frame unless the child is made to have a higher priority than the parent.

The following values are inherited and then copied back to the parent script upon completion:

  • LocalFlags
  • LocalVars
  • Array pointer
  • Flag array pointer
  • Priority
  • Group

Child scripts are killed, suspended, and resumed with their parent. For example, using KillScript on the parent also kills the child launched by this command. Extra ARGS become ArgVars in the child script with the same capture rules as Exec.

ExpectArgs

#define ExpectArgs(NUM_ARGS) source

Assert that this script invocation received exactly NUM_ARGS arguments.

BindTrigger

#define BindTrigger( EVT_SOURCE, TRIGGER, COLLIDER_ID, HAS_INTERACT_PROMPT, TRIGGER_PTR_OUTVAR ) source

Sets up a script to launch when a particular event is triggered.

EVT_SOURCE is the script to launch when the trigger activates. TRIGGER is one or more trigger flags. COLLIDER_ID is the trigger target. HAS_INTERACT_PROMPT controls whether the player sees the interaction prompt for wall-press-A triggers. TRIGGER_PTR_OUTVAR receives the Trigger* when nonzero.

Valid triggers:

  • TRIGGER_WALL_PUSH
  • TRIGGER_FLOOR_TOUCH
  • TRIGGER_WALL_PRESS_A (displays "!" icon above player)
  • TRIGGER_FLOOR_JUMP
  • TRIGGER_WALL_TOUCH
  • TRIGGER_FLOOR_PRESS_A
  • TRIGGER_WALL_HAMMER
  • TRIGGER_GAME_FLAG_SET
  • TRIGGER_AREA_FLAG_SET
  • TRIGGER_CEILING_TOUCH
  • TRIGGER_FLOOR_ABOVE
  • TRIGGER_POINT_BOMB (takes Vec3f* instead of collider ID)

For the COLLIDER_ID param, the following values are accepted:

  • Collider ID
  • Entity ID (use EVT_ENTITY_INDEX)
  • Pointer to a Vec3f (for TRIGGER_POINT_BOMB only)

Only one script will run for a trigger at once.

BindItemPrompt

#define BindItemPrompt( EVT_SOURCE, TRIGGER, COLLIDER_ID, ITEM_LIST, TATTLE_MSG, HAS_INTERACT_PROMPT ) source

Similar to BindTrigger, but also attaches an item list to the trigger context.

EVT_SOURCE is responsible for showing any item prompt, typically by calling ShowKeyChoicePopup or ShowConsumableChoicePopup. Those APIs read ITEM_LIST from the trigger context created here. TATTLE_MSG is stored on the trigger and may be read by Goombario tattles. HAS_INTERACT_PROMPT controls whether the player sees the interaction prompt for wall-press-A triggers.

Unbind

#define Unbind source

Unbinds the current script from the trigger it was bound to, if any.

KillScript

#define KillScript(SCRIPT_ID) source

Kills a script by its ID.

SetPriority

#define SetPriority(PRIORITY) source

Sets the current script's priority. Higher-priority scripts execute before lower-priority scripts on each frame.

SetTimescale

#define SetTimescale(TIMESCALE) source

Sets the current script's timescale. This is a multiplier applied to Wait and Wait_SECONDS.

SetGroup

#define SetGroup(GROUP) source

Sets the current script's group. Group value meanings are currently not known.

SuspendGroup

#define SuspendGroup(GROUP) source

Suspends all scripts in a group.

ResumeGroup

#define ResumeGroup(GROUP) source

Resumes all scripts in a group.

SuspendOthers

#define SuspendOthers(GROUP) source

Suspends all scripts in a group, except the current script.

ResumeOthers

#define ResumeOthers(GROUP) source

Resumes all scripts in a group, except the current script.

SuspendScript

#define SuspendScript(SCRIPT_ID) source

Suspends a script by its script ID.

ResumeScript

#define ResumeScript(SCRIPT_ID) source

Resumes a script by its script ID.

IsScriptRunning

#define IsScriptRunning(SCRIPT_ID, OUTVAR) source

Sets OUTVAR to true/false depending on whether a script with the given ID exists (i.e. has not been killed).

AwaitScript

#define AwaitScript(SCRIPT_ID) source

Waits until the script with the given ID no longer exists.

Thread

#define Thread source

Marks the start of a thread block. Commands between this and a matching EndThread will run as a new detached script.

EndThread

#define EndThread source

Marks the end of a thread block.

ChildThread

#define ChildThread source

Marks the start of a child thread block. Commands between this and a matching EndChildThread will run as a new child script.

Child threads are killed if the parent script dies, so the following script does NOT set the player's position:

ChildThread Wait_SECONDS(1) // child thread will be killed whilst waiting Call(SetPlayerPos, NPC_DISPOSE_LOCATION) // will not be executed EndChildThread Return // parent script dies

EndChildThread

#define EndChildThread source

Marks the end of a child thread block.

AwaitChildren

#define AwaitChildren source

Waits until all direct ChildThread children of the current script have finished.

Call

#define Call(FUNC, ARGS...) source

Calls a given C EVT API function with any number of arguments.

An API function has the following signature:

ApiStatus ApiFunction(Evt* script, s32 isInitialCall);

This function could then be called with the following command:

Call(ApiFunction)

The given arguments can be accessed from the API function using script->ptrReadPos.

Eval

#define Eval(ARGS...) source

Calls a C function with integer arguments and stores its return value.

The function must return s32 and take exactly the supplied number of s32 arguments. The function is called synchronously and cannot block script execution.

EvalF

#define EvalF(ARGS...) source

Calls a C function with float arguments and stores its float return value.

The function must return f32 and take exactly the supplied number of f32 arguments. The function is called synchronously and cannot block script execution.

Invoke

#define Invoke(ARGS...) source

Calls a C function with integer arguments and no return value.

The function must return void and take exactly the supplied number of s32 arguments. The function is called synchronously and cannot block script execution.

InvokeF

#define InvokeF(ARGS...) source

Calls a C function with float arguments and no return value.

The function must return void and take exactly the supplied number of f32 arguments. The function is called synchronously and cannot block script execution.

IfEval

#define IfEval(ARGS...) source

Marks the beginning of an if statement that only executes if a C function with integer arguments returns nonzero.

The function must return s32 and take exactly the supplied number of s32 arguments.

IfNotEval

#define IfNotEval(ARGS...) source

Marks the beginning of an if statement that only executes if a C function with integer arguments returns zero.

The function must return s32 and take exactly the supplied number of s32 arguments.

IfEvalF

#define IfEvalF(ARGS...) source

Marks the beginning of an if statement that only executes if a C function with float arguments returns nonzero.

The function must return s32 and take exactly the supplied number of f32 arguments.

IfNotEvalF

#define IfNotEvalF(ARGS...) source

Marks the beginning of an if statement that only executes if a C function with float arguments returns zero.

The function must return s32 and take exactly the supplied number of f32 arguments.

DebugPrintVar

#define DebugPrintVar(VAR) source

Prints variable name and value

BreakPoint

#define BreakPoint(TEXT) source

Halt execution after this command

EVT_SETUP_CAMERA_DEFAULT

#define EVT_SETUP_CAMERA_DEFAULT(r, g, b) source

Enable camera using standard parameters for clip distances and FOV. r, g, and b are the background color. @param r @param g @param b

EVT_SETUP_CAMERA_NO_LEAD

#define EVT_SETUP_CAMERA_NO_LEAD(r, g, b) source

Enable camera using standard parameters for clip distances and FOV with LeadPlayer disabled. r, g, and b are the background color. @param r @param g @param b

EVT_SETUP_CAMERA_MIM

#define EVT_SETUP_CAMERA_MIM() source

Enable camera for AREA_MIM using a closer far clip distance and appropriate background color