• Opcode: 0x006
  • Short name: RET
  • Long name: Return

Argument

Return mode / target priority. Normal RET is emitted with 8 (return to the priority that invoked this script). A value of 9 is the gosub-style return that pops a saved instruction pointer off the stack instead.

Stack

No change (for mode 8). Mode 9 pops one saved IP.

Description

If the script was called by another script, return to the script that requested the current one. Else the script is halted. The handler saves the eight temp-list registers back onto the stack, clears the current priority’s ready bit, restores any interrupted movement state, and resumes the highest still-pending priority (its saved IP from entity +356). Returns 4.

PC handler: SCRIPT_RET.

Function addresses

Function Address Description
SCRIPT_RET 0x51C5C0 Field script opcode handler (verified IDA function)