AGI Command Reference - Program Control Commands

From AGI Wiki
Revision as of 19:09, 28 December 2013 by Andrew Branscom (talk | contribs)
Jump to navigationJump to search

Tutorials and Guides Table of Contents
AGI Command Reference Index

Page: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16


Program Control Commands
By Chris Cromer

 

new.room command is one of the most powerful commands of the interpreter. It is used to change algorithms of the object behavior, props, etc. Automatic change of EGO coordinates imitates moving into a room adjacent to the edge of the initial one.

Sounds awkward but that's what it says.

The format of the command:


new.room(n); new.room.v(n);

  • These commands do the following:
  • Commands stop_update and unanimate are issued to all objects;
  • All resources except Logic(0) are discarded;
  • Command player_control is issued;
  • unblock command is issued;
  • set_horizon 36' command is issued;
  • Var(1) is assigned the value of Var(0);
  • Var(0) is assigned n (or the value of Var(n)
  • when the command is new_room_v);
  • Var(4) is assigned 0;
  • Var(5) is assigned 0;
  • Var(16) is assigned the ID number of the View resource that was
  • associated with EGO (the player character).
  • Logic(i) resource is loaded where i is the value of Var(0)!
  • Set EGO coordinates according to Var(2):
    • if EGO touched the bottom edge, put it on the horizon;
    • if EGO touched the top edge, put it on the bottom edge of the screen;
    • if EGO touched the right edge, put it at the left and vice versa.
  • Var(2) is assigned 0 (meaning EGO has not touched any edges).
  • Flag(5) is set to 1 (meaning in the first interpreter cycle after the new_room command all initialization parts of all logics loaded and called from the initialization part of the new room's logic will be called. In the subsequent cycle Flag(5) is reset to 0.
  • Clear keyboard input buffer and return to the main AGI loop.

call(n); call.v(n);

Subroutine call commands

LOGIC resource number n (or number i where i the value of Var(n)) is executed as a subroutine. If the logic with the given ID is not loaded in memory, it is temporarily loaded and discarded after returning from the call (this takes extra time). call command does not change any variables or flags.

return();

This command returns control to the interpreter if it is executed in Logic(0), or to the command following the call command which called the current logic.

jump [label]

 This command unconditionally transfers control to a command starting with a symbol combination within the same logic.

set.scan.start reset.scan.start

Normally, when a logic is called using call command, execution begins at the first instruction. set_scan_start command sets the entry point at the command following it, while reset_scan_start returns entry point to the beginning.

 

Page: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16


Tutorials and Guides Table of Contents
AGI Command Reference Index

< Previous: Commands to Load and unLoad ResourcesNext: Object Control Commands >