Skip to content

Script Commands

This page lists every functional Evt command accepted by Star Rod Classic. These commands are part of the script interpreter itself. Functions invoked by Call are a separate interface: map, battle, and global scripts each have their own function library under database/.

The syntax column uses descriptive argument names. A value may ordinarily be a literal, constant, or script variable. A destination must be writable script storage. The opcode is included for comparison with raw scripts and engine code; it is not normally written by hand.

Gaps in the opcode sequence are unused or unavailable in Classic.

OpcodeSyntaxDescription
01EndMark the end of the script data and terminate execution if reached.
02ReturnTerminate this execution of the script. A normal script places Return before End.
03Label labelDefine a destination for Goto. Labels may be numeric or named.
04Goto labelContinue execution at the matching label in this script.
05Loop [count]Begin a loop. A count of zero, or an omitted count, repeats indefinitely.
06EndLoopReturn to the matching Loop until its count is exhausted.
07BreakLoopLeave the innermost loop.
08Wait framesBlock this script for the given number of frames.
09WaitSeconds secondsBlock for the given number of seconds, converted at 30 frames per second.

A script may define at most sixteen labels and nest loops at most eight levels deep.

OpcodeSyntaxCondition
0AIf left == rightThe values are equal.
0BIf left != rightThe values are not equal.
0CIf left < rightThe left value is less than the right value.
0DIf left > rightThe left value is greater than the right value.
0EIf left <= rightThe left value is less than or equal to the right value.
0FIf left >= rightThe left value is greater than or equal to the right value.
10If value & maskAt least one bit in the mask is set in the value.
11If value !& maskNone of the bits in the mask are set in the value.
12ElseBegin the alternate branch of an If.
13EndIfEnd an If block.

Both operands of the comparison commands are resolved as script values. The mask used by & and !& is literal.

OpcodeSyntaxDescription
14Switch valueBegin a switch using a resolved value.
15SwitchConst valueBegin a switch using the argument literally, without resolving it as a script variable.
16Case == valueMatch when the switch value equals the argument.
17Case != valueMatch when the switch value does not equal the argument.
18Case < valueMatch when the switch value is less than the argument.
19Case > valueMatch when the switch value is greater than the argument.
1ACase <= valueMatch when the switch value is less than or equal to the argument.
1BCase >= valueMatch when the switch value is greater than or equal to the argument.
1CDefaultMatch when no earlier case has matched.
1DCaseOR == valueAdd an equality test to an OR case group. The group matches when any test matches.
1ECaseAND == valueAdd an equality test to an AND case group. The group matches only when every test matches.
1FCase & maskMatch when the switch value and literal mask share at least one set bit.
20EndCaseGroupEnd a sequence of CaseOR or CaseAND tests.
21Case minimum to maximumMatch an inclusive range.
22BreakCaseLeave the current case and continue after the switch.
23EndSwitchEnd the current switch.

Only the first matching case body runs. Switch blocks may be nested at most eight levels deep.

OpcodeSyntaxDescription
24Set destination sourceResolve the source as an integer and store it in the destination.
25SetConst destination valueStore the second argument literally, without resolving it as a script variable.
26SetF destination sourceResolve the source as a float and store it in the destination.
27Add destination valueAdd an integer value to the destination.
28Sub destination valueSubtract an integer value from the destination.
29Mul destination valueMultiply the destination by an integer value.
2ADiv destination valueDivide the destination by an integer value.
2BMod destination valueReplace the destination with its integer remainder after division by the value.
2CAddF destination valueAdd a floating-point value to the destination.
2DSubF destination valueSubtract a floating-point value from the destination.
2EMulF destination valueMultiply the destination by a floating-point value.
2FDivF destination valueDivide the destination by a floating-point value.

Star Rod’s inline assignment syntax compiles expressions into these commands:

Set *Var0 = *Var1 + 10`
SetF *Var2 = *Var2 / 2.0
OpcodeSyntaxDescription
30UseIntBuffer addressSet the current integer-buffer pointer.
31Get1Int destinationRead one word from the integer buffer and advance it.
32Get2Int a bRead two words into the destinations and advance the buffer.
33Get3Int a b cRead three words into the destinations and advance the buffer.
34Get4Int a b c dRead four words into the destinations and advance the buffer.
35GetIntN destination indexRead one word at an index relative to the current integer buffer without advancing it.
36UseFloatBuffer addressSet the current buffer pointer for floating-point reads. This is the same pointer used by UseIntBuffer.
37Get1Float destinationRead one value through the float accessor and advance the buffer.
38Get2Float a bRead two floating-point values and advance the buffer.
39Get3Float a b cRead three floating-point values and advance the buffer.
3AGet4Float a b c dRead four floating-point values and advance the buffer.
3BGetFloatN destination indexRead one floating-point value at an index without advancing the buffer.
3CUseArray addressSet the storage addressed by *Array.
3DUseFlags addressSet the packed-bit storage addressed by *FlagArray.
3ENewArray length destinationAllocate an array of words, make it the current array, and write its address to the destination.

The current buffer, array, and flag-array pointers belong to the running Evt context. Parallel or child scripts inherit the array pointers, so allocated storage may be used to share values between them.

OpcodeSyntaxDescription
3FAND destination maskResolve the mask, then apply a bitwise AND to the destination.
40ConstAND destination maskApply a literal mask without resolving it as a script variable.
41OR destination maskResolve the mask, then apply a bitwise OR to the destination.
42ConstOR destination maskApply a literal mask without resolving it as a script variable.
OpcodeSyntaxDescription
43Call function ( arguments... )Invoke an EVT-compatible native function. The function may finish immediately or block the script across several frames.
44Exec scriptStart another script and continue without waiting.
45Exec script destinationStart another script, write its script ID to the destination, and continue without waiting.
46ExecWait scriptStart a child script and block until it finishes.
47Bind script trigger target prompt destinationBind a script to a trigger and optionally write the new trigger pointer to a destination.
48UnbindDelete the trigger which owns the current bound script.
49Kill scriptIDTerminate the script selected by ID.
4AJump scriptReplace the current script’s source and restart execution there.
4BSetPriority priorityChange the current script’s execution priority.
4CSetTimescale scaleChange the current script’s time scale.
4DSetGroup groupAssign the current script to a group.
4EBindLock script trigger target itemList tattleMessage promptBind a lock or item-prompt script using an accepted-item list.
4FSuspendAll groupSuspend scripts in the selected group.
50ResumeAll groupResume scripts in the selected group.
51SuspendOthers groupSuspend other scripts in the selected group while leaving the current script running.
52ResumeOthers groupResume other scripts in the selected group.
53Suspend scriptIDSuspend the script selected by ID.
54Resume scriptIDResume the script selected by ID.
55DoesScriptExist scriptID destinationWrite whether the selected script is still running to the destination.

Exec, ExecWait, and the thread commands initialize new local storage from the caller. Later changes to ordinary local variables do not propagate back. See Script Variables for the storage shared between executions.

The arguments accepted by Bind and BindLock depend on the trigger type. Trigger constants and argument types are supplied by the function library for the script’s context.

OpcodeSyntaxDescription
56ThreadBegin an inline block which runs concurrently and independently of the surrounding script.
57EndThreadEnd a Thread block.
58ChildThreadBegin a concurrent inline block which is owned by the surrounding script and ends when its parent ends.
59EndChildThreadEnd a ChildThread block.

The surrounding script skips over the inline block after starting it and continues with the command following its terminator.

OpcodeSyntaxDescription
5BPrintVar valueFormat a value in the engine’s script-debug buffer. This is not ordinary on-screen or console output.