Control Flow Commands |
The new.room.v command changes the current room number to a new room and forces an update. There is an direct version of this command called new.room.
Syntax
- new.room.v(var roomNumber);
Remarks
The new.room.v command causes the interpreter to halt execution of the current script. The resources on the memory heap are dumped (with the exception of logic 0). The following things happen automatically when this command is issued:
- If a sound is playing, it is stopped.
- The keyboard buffer and controller state are cleared.
- The script table is cleared.
- All objects are unanimated.
- All resources except logic 0 are discarded (removed from memory).
- The player.control command is executed.
- The unblock command is executed.
- The horizon is set to 36.
v1
(previous room number) is set to the value ofv0
(room number)v0
(room number) is assignedroomNumber
v16
(ego view number) is set to the view number assigned to ego.v8
(free memory pages) is set to 10.- The logic for the new room is loaded (logic
roomNumber
). - If ego was touching an edge of the screen, it is placed on the opposite side (i.e. if ego touched right edge, it is moved to left edge).
v2
(ego_edge_code) is set to zero.- Status line is redrawn.
- Flag 5 (new room flag) is set (the flag is reset after the first cycle in the new room).
- Execution jumps to the start of logic 0.
Parameters
For new.room.v
roomNumber
: a variable,v0
-v255
, whose value specifies which room to switch to
Possible errors
- the logic resource must exist, or the game will crash with a logic not found error
Examples
The following code goes to room 25 if ego is touching the left edge of the screen:
<syntax type = "C++">
#define ego_edge_code v2 #define left_edge 4
if (ego_edge_code == left_edge) { v202 = 25; new.room.v(v202); }
</syntax>
Technical Information
Required interpreter version | Available in all AGI versions |
Bytecode value | 19 (0x13 hex) |
See also
Sources
- AGI Studio help file
- AGIwiki help file