LBA1:Track script
Track Script is the simpler of two kinds of Scripts that define behaviour of Scene Actors in LBA1. Its main purpose is to provide a set of functions for use in Life Script, that make the Actor move in specified ways and produce specified sounds.
Initially the Track Script is stopped (this depends on Actor control mode). It can be started only by calling SET_TRACK(_OBJ) Life Script command. Once started, the commands are executed one after another to the end or to a STOP command. Track Scripts of each Actor are run simultaneously.
Each command code is one byte long, and after it there are parameters (or not), or other things. After a command's parameters there is a next command byte, and so on. At the end of the script there is a 0x00 (END) command.
This document describes the commands and their parameters in a technical way. For more details on usage and effects see other sources (LBArchitect's help may contain some).
If the command does not have any additional bytes, next command starts immediately after the command byte.
Track Script commands are blocking (with some exceptions), which means that a next command will be executed only after the previous command has done what it had to do. For example GOTO_POINT command will block script execution until the actor has reached the specified Point. In a situation where the Actor cannot reach that Point (e.g. because there is a terrain obstacle, or the Actor rotation speed is too low), the command will never finish, so the script will never advance to the next command (unless a Life Script command forces another LABEL to execute).
Code | (dec) | Name | Description | Parameters |
---|---|---|---|---|
0x00 | 0 | END | Marks end of the script | |
0x01 | 1 | NOP | No operation (never used) | |
0x02 | 2 | BODY | Selects new Body for the Actor | param1: 1 byte (0..255) - virtual index of the new Body |
0x03 | 3 | ANIM | Selects new Animation for the Actor | param1: 1 byte (0..255) - virtual index of the new Animation |
0x04 | 4 | GOTO_POINT | Rotates Actor towards the Point | param1: 1 byte (0..255) - index of the Point |
0x05 | 5 | WAIT_ANIM | Waits till the current Actor animation finishes | |
0x06 | 6 | LOOP | Unknown (never used) | |
0x07 | 7 | ANGLE | Makes the Actor rotate | param1: 2 bytes (-32768..32767) - new angle in Scene units |
0x08 | 8 | POS_POINT | Instantly sets position of the Actor | param1: 1 byte (0..255) - index of the target Point |
0x09 | 9 | LABEL | Marks command group (a function) | param1: 1 byte (0..255) - ID of the label |
0x0A | 10 | GOTO | Jumps to specified LABEL | param1: 2 bytes (-1..32767) - address (offset) in the script to go to; -1 causes stop of the script execution (like STOP command) |
0x0B | 11 | STOP | Stops the Track Script execution | |
0x0C | 12 | GOTO_SYM_POINT | Rotates Actor away from the Point (back to the Point) | param1: 1 byte (0..255) - index of the target Point |
0x0D | 13 | WAIT_NUM_ANIM | Waits till the current Actor animation plays number of times |
|
0x0E | 14 | SAMPLE | Plays a sound sample | param1: 2 bytes (0..32767) - index of the sound sample to play |
0x0F | 15 | GOTO_POINT_3D | Makes the Sprite Actor move to specified Point | param1: 1 byte (0..255) - index of the target Point |
0x10 | 16 | SPEED | Sets movement speed for the Sprite Actor | param1: 2 bytes (0..32737) - new speed |
0x11 | 17 | BACKGROUND | Controls redrawing of the Actor | param1: 1 byte (0..1) - if Actor is backgrounded (boolean flag) |
0x12 | 18 | WAIT_NUM_SECOND | Waits number of seconds |
|
0x13 | 19 | NO_BODY | Makes the Actor disappear | |
0x14 | 20 | BETA | Instantly sets angle of the Actor | param1: 2 bytes (-32768..32767) - angle in Scene units |
0x15 | 21 | OPEN_LEFT | Moves sprite Actor to the far-left | param1: 2 bytes (-32768..32767) - distance to move |
0x16 | 22 | OPEN_RIGHT | Moves sprite Actor to the near-right | param1: 2 bytes (-32768..32767) - distance to move |
0x17 | 23 | OPEN_UP | Moves sprite Actor to the far-right | param1: 2 bytes (-32768..32767) - distance to move |
0x18 | 24 | OPEN_DOWN | Moves sprite Actor to the near-left | param1: 2 bytes (-32768..32767) - distance to move |
0x19 | 25 | CLOSE | Moves sprite Actor back to original position | |
0x1A | 26 | WAIT_DOOR | Waits for sprite Actor to open/close | |
0x1B | 27 | SAMPLE_RND | Plays a sound sample with randomly lowered pitch | param1: 2 bytes (0..32767) - index of the sample |
0x1C | 28 | SAMPLE_ALWAYS | Plays a sound sample repeatedly (until stopped) | param1: 2 bytes (0..32767) - index of the sample |
0x1D | 29 | SAMPLE_STOP | Stops playing a sample | param1: 2 bytes (0..32767) - index of the sample |
0x1E | 30 | PLAY_FLA | Plays FLA animation | param1: null-terminated string - name of the FLA file to play (with or without extension) |
0x1F | 31 | REPEAT_SAMPLE | Sets number of repetitions for SIMPLE_SAMPLE | param1: 2 bytes (0..32767) - number of repetitions |
0x20 | 32 | SIMPLE_SAMPLE | Plays a sound sample a number of times | param1: 2 bytes (0..32767) - index of the sample |
0x21 | 33 | FACE_HERO | Rotates the Actor towards the Hero | param1: 2 bytes - used internally, should be set to 0xFFFF in the script |
0x22 | 34 | ANGLE_RND | Makes the Actor rotate in random direction by about 90° |
|
Information provided by: alexfont and Zink