Opcodes
Last updated
Last updated
This page describes the legacy script format, usually produced by the Sanny disassembler with the "Write opcodes" enabled. It's recommended to use other available in new scripts.
Opcode syntax is the oldest and most basic way of encoding SCM instructions. Each instruction has an associated id (operation code, or opcode). This id can be written in a script as a 4-digit hexadecimal number, followed by a colon:
If the instruction does not require any arguments, that's all you need to compile it. Most of the time, though, instructions need some input values to customize their behavior:
0001:
is an opcode for the WAIT command. It has one input argument that defines how long the game should "wait" until it can proceed to the next instruction. In this case, the wait time is 1000
milliseconds, or one second.
Some instructions may return one or multiple values. Those values will be stored in the variables that you must provide:
00BF:
returns current in-game time (hours and minutes) and requires 2 variables. A choice of variables is on the scripter.
Some instructions can be used as to check on various things. You can combine up to 8 instructions in one check:
Any conditional opcode can be negated by adding 0x8000
to the id. For original opcodes it's as simple as changing the first 0
to 8
: