TrustedUser
2,147
edits
(Created page with "__NOTOC__ {{AGIWiki}} The '''new.room''' command changes the current room number to a new room and forces an update. There is an [[AGIWiki/Indirect command|ind...") |
m (Text replacement - "</source>" to "</syntaxhighlight>") |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{AGIWiki}} | {{AGIWiki}} | ||
{{AGIWiki/Control Flow Commands}} | |||
The '''new.room''' command changes the current room number to a new [[AGIWiki/Room|room]] and forces an update. There is an [[AGIWiki/Indirect command|indirect]] version of this command called '''new.room.v'''. | The '''new.room''' command changes the current room number to a new [[AGIWiki/Room|room]] and forces an update. There is an [[AGIWiki/Indirect command|indirect]] version of this command called '''[[AGIWiki/new.room.v|new.room.v]]'''. | ||
== Syntax == | == Syntax == | ||
Line 16: | Line 15: | ||
* The keyboard buffer and [[AGIWiki/Controller|controller]] state are cleared. | * The keyboard buffer and [[AGIWiki/Controller|controller]] state are cleared. | ||
* The [[AGIWiki/Memory and Script#Script Buffer|script table]] is cleared. | * The [[AGIWiki/Memory and Script#Script Buffer|script table]] is cleared. | ||
* All [[AGIWiki/Animated | * All [[AGIWiki/Animated object|objects]] are unanimated. | ||
* All resources except [[AGIWiki/Logic 0|logic 0]] are discarded (removed from memory). | * All resources except [[AGIWiki/Logic 0|logic 0]] are discarded (removed from memory). | ||
* The [[AGIWiki/player.control|player.control]] command is executed. | * The [[AGIWiki/player.control|player.control]] command is executed. | ||
Line 37: | Line 36: | ||
* <code>roomNumber</code><nowiki>: a number, 0-255, specifying which room to switch to </nowiki> | * <code>roomNumber</code><nowiki>: a number, 0-255, specifying which room to switch to </nowiki> | ||
== Possible errors == | == Possible errors == | ||
Line 50: | Line 45: | ||
The following code goes to room 25 if [[AGIWiki/Ego|ego]] is touching the left edge of the screen: | The following code goes to room 25 if [[AGIWiki/Ego|ego]] is touching the left edge of the screen: | ||
< | <syntaxhighlight lang="cpp"> | ||
#define ego_edge_code v2 | #define ego_edge_code v2 | ||
#define left_edge 4 | #define left_edge 4 | ||
Line 58: | Line 53: | ||
new.room(25); | new.room(25); | ||
} | } | ||
</ | </syntaxhighlight> | ||
The next example accomplishes the same task with <code>new.room.v</code><nowiki>: </nowiki> | The next example accomplishes the same task with <code>new.room.v</code><nowiki>: </nowiki> | ||
< | <syntaxhighlight lang="cpp"> | ||
#define ego_edge_code v2 | #define ego_edge_code v2 | ||
#define left_edge 4 | #define left_edge 4 | ||
Line 71: | Line 66: | ||
new.room.v(v202); | new.room.v(v202); | ||
} | } | ||
</ | </syntaxhighlight> | ||
== Technical Information == | == Technical Information == |