Difference between revisions of "AGI Command Reference - Test Commands"

From AGI Wiki
Jump to navigationJump to search
(Blanked the page)
 
Line 1: Line 1:
[[Tutorials and Guides|Tutorials and Guides Table of Contents]]<br />
 
[[AGI Command Reference|AGI Command Reference Index]]<br />
 
  
<div align="center">
 
Page:
 
[[AGI Command Reference - Arithmetic Commands|1]] |
 
[[AGI Command Reference - Commands to Load and unLoad Resources|2]] |
 
[[AGI Command Reference - Program Control Commands|3]] |
 
[[AGI Command Reference - Object Control Commands|4]] |
 
[[AGI Command Reference - Object Description Commands|5]] |
 
[[AGI Command Reference - Object Motion Control Commands|6]] |
 
[[AGI Command Reference - Inventory Item Management Commands|7]] |
 
[[AGI Command Reference - Picture Resource Management Commands|8]] |
 
[[AGI Command Reference - Sound Resource Management Commands|9]] |
 
[[AGI Command Reference - Text Management Commands|10]] |
 
[[AGI Command Reference - String Management Commands|11]] |
 
[[AGI Command Reference - Initialization Commands|12]] |
 
[[AGI Command Reference - Menu Management Commands|13]] |
 
[[AGI Command Reference - Test Commands|14]] |
 
[[AGI Command Reference - Other Commands|15]] |
 
[[AGI Command Reference - Unknown Commands|16]]
 
</div><br />
 
 
<div align="center"><span style="font-size: 22pt">Test Commands</span><br />
 
''By [[Chris Cromer]]''</div>
 
 
&nbsp;
 
 
The result of test command can be either TRUE or FALSE.
 
 
== <br />equaln(n,m); ==
 
 
<blockquote>True if Var(n) = m.</blockquote>
 
 
== equalv(n, m); ==
 
 
<blockquote>true if Var(n) = Var(m).</blockquote>
 
 
== lessn(n,m); ==
 
 
<blockquote>True if Var(n) < m.</blockquote>
 
 
== lessv(n, m); ==
 
 
<blockquote>True if Var(n) < Var(m)</blockquote>.
 
 
== greatern(n, m); ==
 
 
<blockquote>True if Var(n) > m.</blockquote>
 
 
== greaterv(n, m); ==
 
 
<blockquote>True if Var(n) > Var(m).</blockquote>
 
 
== isset(n); ==
 
 
<blockquote>True if Flag(n) = 1 (set).</blockquote>
 
 
== isset.v(n); ==
 
 
<blockquote>True if Flag(Var(n)) = 1 (set).</blockquote>
 
 
== has(n); ==
 
 
<blockquote>True if the room field of item n is 255, i.e. the item belongs to the player.</blockquote>
 
 
== obj.in.room(n, m); ==
 
 
<blockquote>True if room field of the object n is Var(m).</blockquote>
 
 
== posn(n, x1, y1, x2, y2); ==
 
 
<blockquote>True if the coordinates of the base point of the cel which is the current image of object n satisfies the equation x1 < = x < = x2, y1 < = y < = y2.</blockquote>
 
 
== obj.in.box(n, x1, y1, x2, y2); ==
 
 
<blockquote>True if the base of the object n is completely within the rectangle specified using its top left (x1,y1) and bottom right (x2,y2) corners.
 
{|
 
|<pre>
 
(x1, y1)
 
  ------------------
 
  |                |
 
  |                |
 
  |                |
 
  ------------------
 
                  (x2, y2)
 
</pre>
 
|}</blockquote>
 
 
== center.position(n, x1, y1, x2, y2); ==
 
 
<blockquote>True of the center of the base line of the object n is inside the rectangle specified as its top left and bottom right corners.</blockquote>
 
 
== right.position(n, x1, y1, x2, y2); ==
 
 
<blockquote>True of the right side of the base line of the object n is inside the rectangle specified as its top left and bottom right corners</blockquote>.
 
 
== have.key(); ==
 
 
<blockquote>True if the user has pressed any key on the keyboard. Used to create cycles to wait until any key is pressed</blockquote>.
 
 
== compare.strings(s1, s2); ==
 
 
<blockquote>True if string(s1) = string(s2).</blockquote>
 
 
== said(n, W(i)); ==
 
 
where i = 1, ..., n True if the player has entered a phrase that completely matches W(1),...W(n), where n is the number of W(i) which are codes of the vocabulary words.<br />
 
Here is how the input is matched. After the player types a message and presses Enter, the input line is processed by the interpreter.<br />
 
Interpreter removes all punctuation marks.<br />
 
All characters are converted to lowercase.<br />
 
All sequences of more than one space are replaced with a single space.<br />
 
Starting with the first word of the input, the interpreter looks up the vocabulary, trying to find the longest character sequence matching the entered.<br />
 
If the search is unsuccessful, Var(9) is assigned the number of the word in the message that failed to match and the processing ends.<br />
 
If all the words have been assigned some codes:<br />
 
* The Interpreter removes from the sequence of codes all zeros (that means all vocabulary words with zero codes are ignored).
 
* Flag(2) (the user has entered an input line) is set to 1
 
* Flag(4) ('said' command accepted the user input) is set to 0.<br />
 
If the sequence of code produced by the interpreter is V(1), V(2),...V(m).
 
The test is performed as follows:
 
If Flag(2) = 0 or Flag(4) = 1, return FALSE.
 
Compare parameters W(i) and codes V(i) as follows:
 
* if W(i) = 1, it matches any V(i);
 
* if W(i) = 9999, it matches the whole remaining input i.e. the codes V(i), V(i+1),...V(m).<br />
 
<br />
 
Otherwise W(i) should be equal to V(i).<br />
 
If all elements match, Flag(4) ('said' accepted the user input) is set to 1 and the command returns TRUE. Otherwise, FALSE is returned.
 
 
== controller(n); ==
 
 
True if the event with code n has occurred:<br />
 
* a key with the code n was pressed (set using set_key);
 
menu item with code n was selected in command menu_input.
 
 
&nbsp;
 
 
<div align="center">
 
Page:
 
[[AGI Command Reference - Arithmetic Commands|1]] |
 
[[AGI Command Reference - Commands to Load and unLoad Resources|2]] |
 
[[AGI Command Reference - Program Control Commands|3]] |
 
[[AGI Command Reference - Object Control Commands|4]] |
 
[[AGI Command Reference - Object Description Commands|5]] |
 
[[AGI Command Reference - Object Motion Control Commands|6]] |
 
[[AGI Command Reference - Inventory Item Management Commands|7]] |
 
[[AGI Command Reference - Picture Resource Management Commands|8]] |
 
[[AGI Command Reference - Sound Resource Management Commands|9]] |
 
[[AGI Command Reference - Text Management Commands|10]] |
 
[[AGI Command Reference - String Management Commands|11]] |
 
[[AGI Command Reference - Initialization Commands|12]] |
 
[[AGI Command Reference - Menu Management Commands|13]] |
 
[[AGI Command Reference - Test Commands|14]] |
 
[[AGI Command Reference - Other Commands|15]] |
 
[[AGI Command Reference - Unknown Commands|16]]
 
</div><br />
 
 
[[Tutorials and Guides|Tutorials and Guides Table of Contents]]<br />
 
[[AGI Command Reference|AGI Command Reference Index]]
 
 
<span style="float: left">[[AGI Command Reference - Menu Management Commands|&lt; Previous: Menu Management Commands]]</span><span style="float: right">[[AGI Command Reference - Other Commands|Next: Other Commands &gt;]]</span>
 
 
&nbsp;
 
 
[[Category:Logic]]
 
[[Category:Commands]]
 
[[Category:References]]
 
[[Category:Tutorials]]
 

Latest revision as of 19:57, 22 March 2019