Note: All instructions take anywhere between zero and three parameters. Parameters expected to be script variables are named v* (where * is any number/character); parameters expected to be state variables are named s* (where * is any number/character). A 'd' suffix denotes a "destination" variable; 's' denotes a "source." Imm denotes an immediate, or numerical value. "string" is an expected string literal (enclosed in quotes). 'label' is an expected label name (no quotes). LONG denotes a 32-bit signed (negative and positive) integer, DWORD denotes a 32-bit unsigned (positive only) integer, and FLOAT denotes a 32-bit floating-point (decimal/high-precision) number. Those three types are the only ones supported. ArenaScript Ltd. has two types of variables, script variables (act like any C variable) and state variables (a DWORD locked to a certain range). There are also reference values, used by the executing program for whatever it needs.


add vd,v1,v2
addf vd,v1,v2
addu vd,v1,v2
alts sv,Imm
and vd,v1,v2
b label
beq v1,v2,label
bge v1,v2,label
bgt v1,v2,label
ble v1,v2,label
blt v1,v2,label
bne v1,v2,label
cchk const,Imm
cgive const,Imm
choice
color Imm
copy vd,vs
ctake const,Imm
disps "string"
dispv var
div vd,v1,v2
divf vd,v1,v2
divu vd,v1,v2
end
ls "string"
mult vd,v1,v2
multf vd,v1,v2
multu vd,v1,v2
nor vd,v1
or vd,v1,v2
point label
rand vd,v1
set vd,Imm
sets sv,Imm
sftl vd,v1,v2
sftr vd,v1,v2
stop
sub vd,v1,v2
subf vd,v1,v2
subu vd,v1,v2
xor vd,v1,v2


add vd,v1,v2
addf vd,v1,v2
addu vd,v1,v2

Adds the variables v1 and v2 together, storing the result in vd. The three perform the same function, but the first requires the destination to be a LONG variable, the second a FLOAT, and the third a DWORD. The operands are not required to be any specific type. The executing program should issue an error and/or terminate execution if overflow occurs (the sum cannot fit into the destination).

Back to Top


alts sv,Imm

Alters the state variable sv by Imm. Imm can be positive or negative. If Imm pushes the state variable too high (above the maximum pre-determined value), the state is set to its upper limit. If Imm pushes the state variable below 0, it is set to 0.

Back to Top


and vd,v1,v2

Performs a bitwise AND on v1 and v2, storing the result in vd. All three variables must be DWORD values.

Back to Top


b label

Immediately skips to the instruction after label. This instruction has been disabled; "beq zero,zero,label" works as a substitute.

Back to Top


beq v1,v2,label

Skips to the instruction after label if v1 and v2 are equal. v1 and v2 can be state or script variables; doesn't matter (this is true for all branching instructions).

Back to Top


bge v1,v2,label

Skips to the instruction after label if v1 is greater than or equal to v2.

Back to Top


bgt v1,v2,label

Skips to the instruction after label if v1 is greater than v2.

Back to Top


ble v1,v2,label

Skips to the instruction after label if v1 is less than or equal to v2.

Back to Top


blt v1,v2,label

Skips to the instruction after label if v1 is less than v2.

Back to Top


bne v1,v2,label

Skips to the instruction after label if v1 and v2 are not equal.

Back to Top


cchk const,Imm

Implementation-defined, but in the case of Resurrection, checks if at least Imm number of the item referenced by const exist in the player's inventory. Stores the result (0 if 'no', 1 if 'yes') in the compiler-provided script variable vd0.

Back to Top


cgive const,Imm

Implementation-defined, but in the case of Resurrection, gives the player Imm number of the item referenced by const.

Back to Top


choice

Indicates the beginning of a choice block. Choice blocks are an easy to present the player with options on screen. All choice blocks contain a number of options; the one picked is stored in the compiler-provided script variable vd0 (the first option is 1, the second is 2, etc.).

Back to Top


color Imm

Changes the text color. The representation of the immediate is VirtualMachine-defined.

Back to Top


copy vd,vs

Copies the value in vs into vd. The two variables can have different types, but the executing program should issue a warning/halt execution if the value in vs cannot fit into vd.

Back to Top


ctake const,Imm

Implementation-defined, but in the case of Resurrection, takes from the player Imm number of the item referenced by const

Back to Top


disps "string"

Displays a string to the screen.

Back to Top


dispv var

Displays the current value of the script or state variable var to the screen.

Back to Top


div vd,v1,v2
divf vd,v1,v2
divu vd,v1,v2

Divides v1 by v2 (v1/v2) and stores the result into vd. The remainder is discarded. The three perform the same function, but the first requires the destination to be a LONG variable, the second a FLOAT, and the third a DWORD. The operands are not required to be any specific type. Should issue an error/halt execution if v2 is equal to zero (division by zero).

Back to Top


end

Denotes the end of a choice block OR the end of the script. Every script must end with this instruction.

Back to Top


ls "string"

Denotes a possible option in a choice block. The only instruction allowed inside a choice block.

Back to Top


mult vd,v1,v2
multf vd,v1,v2
multu vd,v1,v2

Multiples v1 and v2 together, storing the result in vd. The three perform the same function, but the first requires the destination to be a LONG variable, the second a FLOAT, and the third a DWORD. The operands are not required to be any specific type. The executing program should issue an error and/or terminate execution if overflow occurs (the product cannot fit into the destination).

Back to Top


nor vd,v1

Performs a bitwise NOR on v1 and stores the result into vd. Both variables must be DWORD values.

Back to Top


or vd,v1,v2

Performs a bitwise OR on v1 and v2 and stores the result into vd. All three variables must be DWORD values.

Back to Top


point label

Denotes a possible branching point with the name label. Points do not have to be declared anywhere before they are used; they are gathered during compilation and branches are given PC (Program Counter) values based on these points before the final stage of compilation.

Back to Top


rand vd,v1

Generates a random number between 0 and v1 and stores the result into vd. The upper limit is dependent on the executing program's method of calculating random values; C's rand() function has an upper limit of 32767, while the Mersenne Twister allows values as high as 4294967295. Both variables must be DWORDs.

Back to Top


set vd,Imm

Sets vd equal to Imm. The executing program should issue an error and/or terminate execution if Imm cannot fit into vd, and the compiler will issue an error if Imm doesn't match vd's type.

Back to Top


sets sv,Imm

Sets the state variable sv to Imm. The compiler will issue an error if Imm is less than zero or greater than the state's set maximum.

Back to Top


sftl vd,v1,v2

Shifts the bits in v1 to the left by v2, storing the result into vd. All three variables must be DWORD values.

Back to Top


sftr vd,v1,v2

Shifts the bits in v1 to the right by v2, storing the result into vd. All three variables must be DWORD values.

Back to Top


stop

Stops execution of the script until the user presses Enter

Back to Top


sub vd,v1,v2
subf vd,v1,v2
subu vd,v1,v2

Subtracts v2 from v1 and stores the result in vd. The three perform the same function, but the first requires the destination to be a LONG variable, the second a FLOAT, and the third a DWORD. The operands are not required to be any specific type. The executing program should issue an error and/or terminate execution if overflow occurs (the difference cannot fit into the destination).

Back to Top


xor vd,v1,v2

Performs a bitwise XOR on v1 and v2 and stores the result into vd. All three variables must be DWORD values.

Back to Top