Difference between revisions of "New Room Section"

From AGI Wiki
Jump to navigationJump to search
 
Line 1: Line 1:
The '''new room section''' of a [[Logic Resource|logic]] is a section of code that runs during the first [[Interpreter Cycle|interpreter cycle]] in a new [[Room|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|variables]], [[Flag|flags]], [[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''' of a [[Logic Resource|logic]] is a section of code that runs during the first [[Interpreter cycle|interpreter cycle]] in a new [[Room|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|variables]], [[Flag|flags]], [[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 [[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 [[Set|set]] during the first cycle through a new room and is [[Reset|reset]] after that cycle has completed.
 
The new room section is controlled by the [[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 [[Set|set]] during the first cycle through a new room and is [[Reset|reset]] after that cycle has completed.

Latest revision as of 02:09, 29 December 2013

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:

<syntaxhighlight lang="agi">

 #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();
 }

</syntaxhighlight>

 

See also