New Room Section: Difference between revisions
From Sierra Wiki
Jump to navigationJump to search
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
The '''new room section''' of a [[AGI Logic Resource|logic]] is a section of code that runs during the first [[AGI Interpreter cycle|interpreter cycle]] in a new [[ROOM (AGI)|room]] and does not run again unless the player leaves the room and re-enters it. This section is used to perform initialization of the [[Variable (AGI)|variables]], [[AGI | The '''new room section''' of a [[AGI Logic Resource|logic]] is a section of code that runs during the first [[AGI Interpreter cycle|interpreter cycle]] in a new [[ROOM (AGI)|room]] and does not run again unless the player leaves the room and re-enters it. This section is used to perform initialization of the [[Variable (AGI)|variables]], [[Flag (AGI)|flags]], [[AGI Animated Object|objects]], and other data used by the room - in other words, the new room section contains code that you would only want to run once in a room. | ||
The new room section is controlled by the [[AGI Special Flags|special flag]] <code>f5</code> (or <code>new_room</code>, in the [[AGI Studio Template Game|AGI Studio Template Game]]). This flag is [[AGI Set|set]] during the first cycle through a new room and is [[AGI Reset|reset]] after that cycle has completed. | The new room section is controlled by the [[AGI Special Flags|special flag]] <code>f5</code> (or <code>new_room</code>, in the [[AGI Studio Template Game|AGI Studio Template Game]]). This flag is [[AGI Set|set]] during the first cycle through a new room and is [[AGI Reset|reset]] after that cycle has completed. | ||
Latest revision as of 18:24, 1 April 2025
The new room section of a logic is a section of code that runs during the first interpreter cycle in a new room and does not run again unless the player leaves the room and re-enters it. This section is used to perform initialization of the variables, flags, objects, and other data used by the room - in other words, the new room section contains code that you would only want to run once in a room.
The new room section is controlled by the special flag f5 (or new_room, in the AGI Studio Template Game). This flag is set during the first cycle through a new room and is reset after that cycle has completed.
A typical new room section will contain code like the following:
Code:
#define new_room f5
#define room_no v0
#define ego o0
if (new_room)
{
/* new room section */
load.pic(room_no);
draw.pic(room_no);
discard.pic(room_no);
draw(ego);
show.pic();
}