Difference between revisions of "AGI Command Reference"

From AGI Wiki
Jump to navigationJump to search
 
(36 intermediate revisions by 2 users not shown)
Line 1: Line 1:
AGI Command Reference
+
<div align="center"><span style="font-size: 22pt">AGI Logic Command Reference</span><br /></div>
 +
The AGI commands provide the "brains" of AGI games. [[Logic]] scripts contain the commands that AGI uses to perform game functions, control game play and manipulate other resources such as [[picture|pictures]] and [[view|views]]. Logic source code is written in a scripting language that can be compiled into pseudo-code, which is what AGI reads during game play.
  
Thanks to the Sarien team and to Nick Sonneveld for some info on the unknown commands.
+
Although it may seem that AGI is not an overly complex language, it does take a full understanding of its inner workings to be able to successfully create a full featured AGI game. Understanding how the main [[interpreter cycle]] works, as well as how the different resources are loaded and accessed is critical in being able to create workable AGI games.
  
 +
Detailed information is provided in this section on each command available in AGI, as well as a description of syntax rules. There are also some introductory topics dealing with common AGI programming tasks, such as working with objects, the text mode, debugging, etc.<br/>
  
'''Table of Contents'''
+
==[[:Category:Commands|Commands by Name]]==
 +
A list of all AGI commands alphabetically by name.
  
# [[AGI Command Reference 1 - ARITHMETIC COMMANDS|ARITHMETIC COMMANDS]]
+
==Commands by Category:==
# [[AGI Command Reference 2 - COMMANDS TO LOAD AND UNLOAD RESOURCES|COMMANDS TO LOAD AND UNLOAD RESOURCES]]
 
# [[AGI Command Reference 3 - PROGRAM CONTROL COMMANDS|PROGRAM CONTROL COMMANDS]]
 
# [[AGI Command Reference 4 - OBJECT CONTROL COMMANDS|OBJECT CONTROL COMMANDS]]
 
# [[AGI Command Reference 5 - OBJECT DESCRIPTION COMMANDS|OBJECT DESCRIPTION COMMANDS]]
 
# [[AGI Command Reference 6 - OBJECT MOTION CONTROL COMMANDS|OBJECT MOTION CONTROL COMMANDS]]
 
# [[AGI Command Reference 7 - INVENTORY ITEM MANAGEMENT COMMANDS|INVENTORY ITEM MANAGEMENT COMMANDS]]
 
# [[AGI Command Reference 8 - PICTURE RESOURCE MANAGEMENT COMMANDS|PICTURE RESOURCE MANAGEMENT COMMANDS]]
 
# [[AGI Command Reference 9 - SOUND RESOURCE MANAGEMENT COMMANDS|SOUND RESOURCE MANAGEMENT COMMANDS]]
 
# [[AGI Command Reference 10 - TEXT MANAGEMENT COMMANDS|TEXT MANAGEMENT COMMANDS]]
 
# [[AGI Command Reference 11 - STRING MANAGEMENT COMMANDS|STRING MANAGEMENT COMMANDS]]
 
# [[AGI Command Reference 12 - INITIALIZATION COMMANDS|INITIALIZATION COMMANDS]]
 
# [[AGI Command Reference 13 - MENU MANAGEMENT COMMANDS|MENU MANAGEMENT COMMANDS]]
 
# [[AGI Command Reference 14 - TEST COMMANDS|TEST COMMANDS]]
 
# [[AGI Command Reference 15 - OTHER COMMANDS|OTHER COMMANDS]]
 
# [[AGI Command Reference 16 - UNKNOWN COMMANDS|UNKNOWN COMMANDS]]<br />
 
&nbsp;
 
  
<h2 align="center">I ARITHMETIC COMMANDS</h2>
+
*'''[[:Category:Test Commands|Test Commands]]'''
Commands that operate on variables:<br />
+
:Test commands return a boolean result and are used in [[if]] statements.
 
+
*'''[[:Category:Mathematical Commands|Mathematical Commands]]
=== increment(n); ===
+
:Mathematical commands are used for working with [[variables]] and [[number|numbers]] in AGI.
 
+
*'''[[:Category:Flag Commands|Flag Commands]]'''
The value of the variable Var(n) is incremented by one, i.e.<br />
+
:These commands are used to test the status of [[flags]], and to set, reset, and toggle flag values.
Var(n) = Var(n)+1. If the value is already 255, it is left unchanged.
+
*'''[[:Category:Flow Control Commands|Flow Control Commands]]'''
 
+
:This group of commands deals with control of [[logic]] scripts and [[room]] changes.
=== decrement(n); ===
+
*'''[[:Category:Picture Commands|Picture Commands]]'''
 
+
:Commands for manipulating [[picture]] resources.
The value of the variable Var(n) is decremented by one, i.e.<br />
+
*'''[[:Category:Screen Object Control Commands|Screen Object Control Commands]]'''
Var(n) = Var(n)-1. If the value is 0, it is left unchanged.
+
:These commands are used to set up and manipulate [[screen objects]].
 
+
*'''[[:Category:Screen Object Motion Control Commands|Screen Object Motion Control Commands]]'''
=== assign(n, m); ===
+
:Commands to control the motion of [[screen objects]].
 
+
*'''[[:Category:Inventory Item Commands|Inventory Item Commands]]'''
Variable Var(n) is assigned the value m, i.e. Var(n) = m
+
:This group has the commands used to control and manage the [[inventory items]] listed in the [[OBJECT]] file.
 
+
*'''[[:Category:Sound Commands|Sound Commands]]'''
=== assignv(n, m); ===
+
:Commands for manipulating [[sound]] resources.
 
+
*'''[[:Category:String Commands|String Commands]]'''
Variable Var(n) is assigned the value of Var(m), i.e.<br />
+
:The few commands that can be used to manipulate [[strings]] are listed in this topic.
Var(n) = Var(m).
+
*'''[[:Category:Display Commands|Display Commands]]'''
 
+
:The display commands control printing and displaying text in AGI.
=== addn(n, m); ===
+
*'''[[:Category:Player Input Commands|Player Input Commands]]'''
 
+
:These commands deal with collecting [[player input]] via the [[keyboard]], [[joystick]], and [[mouse]]. It also includes commands for managing [[menus]].
The value of variable Var(n) is incremented by m, i.e.<br />
+
*'''[[:Category:System Commands|System Commands]]'''
Var(n) = Var(n) + m.
+
:Commands for dealing with system activities such as [[saving/restoring/restarting]] and controlling input related activities.
 
+
*'''[[:Category:Debugging Commands|Debugging Commands]]'''
=== addv(n, m); ===
+
:Commands that allow AGI programmers to do limited [[debugging]] of games during development.
 
 
The value of variable Var(n) is incremented by the value of Var(m), i.e. Var(n) = Var(n) + m.<br />
 
[Now what happens in the above two commands on 8-bit overflow: does the result wrap over 0 or stays 255?<br />
 
I.e. is 250 + 10 == 4 or 250 + 10 == 255?]  
 
 
 
=== subn(n, m); ===
 
 
 
The value of Var(n) is decremented by m, I.e. Var(n) = Var(n) - m
 
 
 
=== subv(n, m); ===
 
 
 
The value of Var(n) is decremented by Var(m), i.e. Var(n) = Var(n) - Var(m).<br />
 
[Again, what happens when the result must be negative: is<br />
 
1 - 2 == 255 or 1 - 2 == 0?]  
 
 
 
=== lindirectn(n, m); ===
 
 
 
Variable Var(i) where i is the value of Var(n) is assigned a value m, i.e. Var(Var(n)) = m.
 
 
 
=== lindirectv(n, m); ===
 
 
 
Variable Var(i) where i is the value of Var(n) is assigned the value of Var(m), i.e. Var(Var(n)) = Var(m).  
 
 
 
=== rindirect(n, m); ===
 
 
 
Variable Var(n) is assigned the value of Var(i) where i is the value of Var(m), i.e. Var(n) = Var(Var(m)).  
 
 
 
=== muln(n, m); ===
 
 
 
Variable Var(n) is multiplied by m, i.e. Var(n) = Var(n) * m.
 
 
 
=== mulv(n, m); ===
 
 
 
Variable Var(n) is multiplied by the value of Var(m), i.e.<br />
 
Var(n) = Var(n) * Var(m).<br />
 
[What happens on overflow?]  
 
 
 
=== divn(n, m) ===
 
 
 
Variable Var(n) is divided by m, i.e. Var(n) = Var(n) / m.
 
 
 
=== divv(n, m) ===
 
 
 
Variable Var(n) is divided by the value of Var(m),<br />
 
i.e. Var(n) = Var(n) / Var(m). [What happens on division by 0?]  
 
 
 
=== random(n, m, k) ===
 
 
 
Variable Var(k) is assigned a random value in the range between n and m. Now let us consider the commands changing flag values. Remember that a flag can only have a value 0 or 1.
 
 
 
=== set(n) ===
 
 
 
flag(n) is set to 1.
 
 
 
=== set.v(n) ===
 
 
 
flag(i), where i is the value of var (n), is set to 1. i.e.<br />
 
flag(var(n)) = 1.
 
 
 
=== reset(n) ===
 
 
 
flag(n) is set to 0.
 
 
 
=== reset.v(n) ===
 
 
 
flag(i), where i is the value of var (n), is set to 0, i.e.<br />
 
flag(var(n)) = 0.
 
 
 
=== toggle(n) ===
 
 
 
flag(n) toggles its value.
 
 
 
=== toggle.v(n) ===
 
 
 
flag(i), where i is the value of var (n), i.e. flag(var(n)), toggles is value.
 
 
 
Page:
 
'''[ 1 ]''' |
 
[[AGI Command Reference 1 - ARITHMETIC COMMANDS|AGI Command Reference 1]] |
 
[[AGI Command Reference 2 - COMMANDS TO LOAD AND UNLOAD RESOURCES|AGI Command Reference 2]] |
 
[[AGI Command Reference 3 - PROGRAM CONTROL COMMANDS|AGI Command Reference 3]] |
 
[[AGI Command Reference 4 - OBJECT CONTROL COMMANDS|AGI Command Reference 4]] |
 
[[AGI Command Reference 5 - OBJECT DESCRIPTION COMMANDS|AGI Command Reference 5]] |
 
[[AGI Command Reference 6 - OBJECT MOTION CONTROL COMMANDS|AGI Command Reference 6]] |
 
[[AGI Command Reference 7 - INVENTORY ITEM MANAGEMENT COMMANDS|AGI Command Reference 7]] |
 
[[AGI Command Reference 8 - PICTURE RESOURCE MANAGEMENT COMMANDS|AGI Command Reference 8]] |
 
[[AGI Command Reference 9 - SOUND RESOURCE MANAGEMENT COMMANDS|AGI Command Reference 9]] |
 
[[AGI Command Reference 10 - TEXT MANAGEMENT COMMANDS|AGI Command Reference 10]] |
 
[[AGI Command Reference 11 - STRING MANAGEMENT COMMANDS|AGI Command Reference 11]] |
 
[[AGI Command Reference 12 - INITIALIZATION COMMANDS|AGI Command Reference 12]] |
 
[[AGI Command Reference 13 - MENU MANAGEMENT COMMANDS|AGI Command Reference 13]] |
 
[[AGI Command Reference 14 - TEST COMMANDS|AGI Command Reference 14]] |
 
[[AGI Command Reference 15 - OTHER COMMANDS|AGI Command Reference 15]] |
 
[[AGI Command Reference 16 - UNKNOWN COMMANDS|AGI Command Reference 16]]
 

Latest revision as of 19:48, 22 March 2019

AGI Logic Command Reference

The AGI commands provide the "brains" of AGI games. Logic scripts contain the commands that AGI uses to perform game functions, control game play and manipulate other resources such as pictures and views. Logic source code is written in a scripting language that can be compiled into pseudo-code, which is what AGI reads during game play.

Although it may seem that AGI is not an overly complex language, it does take a full understanding of its inner workings to be able to successfully create a full featured AGI game. Understanding how the main interpreter cycle works, as well as how the different resources are loaded and accessed is critical in being able to create workable AGI games.

Detailed information is provided in this section on each command available in AGI, as well as a description of syntax rules. There are also some introductory topics dealing with common AGI programming tasks, such as working with objects, the text mode, debugging, etc.

Commands by Name

A list of all AGI commands alphabetically by name.

Commands by Category:

Test commands return a boolean result and are used in if statements.
Mathematical commands are used for working with variables and numbers in AGI.
These commands are used to test the status of flags, and to set, reset, and toggle flag values.
This group of commands deals with control of logic scripts and room changes.
Commands for manipulating picture resources.
These commands are used to set up and manipulate screen objects.
Commands to control the motion of screen objects.
This group has the commands used to control and manage the inventory items listed in the OBJECT file.
Commands for manipulating sound resources.
The few commands that can be used to manipulate strings are listed in this topic.
The display commands control printing and displaying text in AGI.
These commands deal with collecting player input via the keyboard, joystick, and mouse. It also includes commands for managing menus.
Commands for dealing with system activities such as saving/restoring/restarting and controlling input related activities.
Commands that allow AGI programmers to do limited debugging of games during development.