126
edits
Jestar jokin (talk | contribs) (Added info to v3/4 script blocks, clarified table entries & other bits.) |
|||
Line 58: | Line 58: | ||
== Object Scripts V5+ (OBCD) == | == Object Scripts V5+ (OBCD) == | ||
These are scripts that correspond to VERB actions. VERBs are predefined activities at the bottom of the screen, e.g. "Open", "Look", "Give" etc. For each named object in a room, the game designer could define responses to the players actions. Starting with version 5, the whole code can be found in an [[Object resources|Object Resource]]. | These are scripts that correspond to VERB actions. VERBs are predefined activities at the bottom of the screen, e.g. "Open", "Look", "Give" etc. For each named object in a room, the game designer could define responses to the players actions. A single VERB block contains the code for all possible player actions on the object. Starting with version 5, the whole code can be found in an [[Object resources|Object Resource]]. | ||
OBCD | OBCD | ||
Line 73: | Line 73: | ||
Block name 4 bytes ("VERB") | Block name 4 bytes ("VERB") | ||
Block size 4 bytes | Block size 4 bytes | ||
offset table variable | offset table variable { | ||
verb 1 byte (0xFF is default) | |||
offset 2 bytes | |||
table end 1 byte(must be | } | ||
table end 1 byte (must be 0x00) | |||
object code variable | object code variable | ||
OBNA | |||
Block name 4 bytes ("OBNA") | |||
Block size 4 bytes | |||
object name null-terminated string | |||
Line 85: | Line 91: | ||
OC | OC | ||
Block size 4 bytes | Block size 4 bytes (LE) | ||
Block name 2 bytes ("OC") | Block name 2 bytes ("OC") | ||
Object ID 1 byte ( | Object ID 2 bytes (LE) | ||
unknown 3 bytes | |||
image width / 8 1 byte | |||
unknown 5 bytes | |||
height & 0xF8 1 byte | |||
name offset 1 byte | |||
offset table variable { | |||
verb 1 byte (0xFF is default) | |||
offset 2 bytes | |||
} | |||
table end 1 byte (must be 0x00) | |||
object name null-terminated string | |||
object code variable | |||
This block contains all object data except for the actual image bitmap. Compare this to V5+ objects, where metadata is split into seperate CDHD and OBNA blocks. | |||
Image width is given in strips, which are 8 pixels wide. Name offset is the absolute offset of object name (or, if you prefer, the position after table end). | |||
The offset table is a variable block like that used in the VERB block in later games, which contains the verb identifier (1 byte) and the absolute offset (2 bytes). The table end is marked with 0x00. Next is the object's name, which is a standard null-terminated string. After this follows the actual object code. Note that unlike other script types, because there are multiple entry points (one for each supported verb), there are also multiple exit points (or "stopObjectCode" instructions). | |||
edits