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

From AGI Wiki
Jump to navigationJump to search
(Blanked the page)
 
(6 intermediate revisions by one other user not shown)
Line 1: Line 1:
[[AGI Tutorials|Tutorials 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">Arithmetic Commands</span><br />
 
''By [[Chris Cromer]]''</div>
 
 
 
Commands that operate on variables.
 
 
&nbsp;
 
 
=== <br />increment(n); ===
 
 
<blockquote>The value of the variable Var(n) is incremented by one.
 
 
'''Examples:'''<br />
 
Var(n) = Var(n)+1. If the value is already 255, it is left unchanged.</blockquote>
 
 
=== decrement(n); ===
 
 
<blockquote>The value of the variable Var(n) is decremented by one.
 
 
'''Examples:'''<br />
 
Var(n) = Var(n)-1. If the value is 0, it is left unchanged.</blockquote>
 
 
=== assign(n, m); ===
 
 
<blockquote>Variable Var(n) is assigned the value m.
 
 
'''Examples:'''<br />Var(n) = m</blockquote>
 
 
=== assignv(n, m); ===
 
 
<blockquote>Variable Var(n) is assigned the value of Var(m).
 
 
'''Examples:'''<br />
 
Var(n) = Var(m).</blockquote>
 
 
=== addn(n, m); ===
 
 
<blockquote>The value of variable Var(n) is incremented by m.
 
 
'''Examples:'''<br />
 
Var(n) = Var(n) + m.</blockquote>
 
 
=== addv(n, m); ===
 
 
<blockquote>The value of variable Var(n) is incremented by the value of Var(m).
 
 
'''Examples:'''<br />
 
Var(n) = Var(n) + m.
 
 
'''Notes:'''<br />
 
Now what happens in the above two commands on 8-bit overflow: does the result wrap over 0 or stays 255? i.e. is 250 + 10 == 4 or 250 + 10 == 255?]</blockquote>
 
 
=== subn(n, m); ===
 
 
<blockquote>The value of Var(n) is decremented by m.
 
 
'''Examples:'''<br />
 
Var(n) = Var(n) - m</blockquote>
 
 
=== subv(n, m); ===
 
 
<blockquote>The value of Var(n) is decremented by Var(m).
 
 
'''Examples:'''<br />
 
Var(n) = Var(n) - Var(m).
 
 
'''Notes:'''<br />
 
Again, what happens when the result must be negative: is 1 - 2 == 255 or 1 - 2 == 0?</blockquote>
 
 
=== lindirectn(n, m); ===
 
 
<blockquote>Variable Var(i) where i is the value of Var(n) is assigned a value m.
 
 
'''Examples:'''<br />
 
Var(Var(n)) = m.</blockquote>
 
 
=== lindirectv(n, m); ===
 
 
<blockquote>Variable Var(i) where i is the value of Var(n) is assigned the value of Var(m).
 
 
'''Examples:'''<br />
 
Var(Var(n)) = Var(m).</blockquote>
 
 
=== rindirect(n, m); ===
 
 
<blockquote>Variable Var(n) is assigned the value of Var(i) where i is the value of Var(m).
 
 
'''Examples:'''<br />
 
Var(n) = Var(Var(m)).</blockquote>
 
 
=== muln(n, m); ===
 
 
<blockquote>Variable Var(n) is multiplied by m.
 
 
'''Examples:'''<br />
 
Var(n) = Var(n) * m.</blockquote>
 
 
=== mulv(n, m); ===
 
 
<blockquote>Variable Var(n) is multiplied by the value of Var(m).
 
 
'''Examples:'''<br />
 
Var(n) = Var(n) * Var(m).<br />
 
 
'''Notes:'''<br />
 
What happens on overflow?</blockquote>
 
 
=== divn(n, m) ===
 
 
<blockquote>Variable Var(n) is divided by m.
 
 
'''Examples:'''<br />
 
Var(n) = Var(n) / m.</blockquote>
 
 
=== divv(n, m) ===
 
 
<blockquote>Variable Var(n) is divided by the value of Var(m).
 
 
'''Examples:'''<br />
 
Var(n) = Var(n) / Var(m).
 
 
'''Notes:'''<br />
 
What happens on division by 0?</blockquote>
 
 
=== random(n, m, k) ===
 
 
<blockquote>Variable Var(k) is assigned a random value in the range between n and m. Now let us consider the commands changing flag values.
 
 
'''Notes:'''<br />
 
Remember that a flag can only have a value 0 or 1.</blockquote>
 
 
=== set(n) ===
 
 
<blockquote>flag(n) is set to 1.</blockquote>
 
 
 
=== set.v(n) ===
 
 
<blockquote>flag(i), where i is the value of var (n), is set to 1.
 
 
'''Examples:'''<br />
 
flag(var(n)) = 1.</blockquote>
 
 
=== reset(n) ===
 
 
<blockquote>flag(n) is set to 0.
 
 
=== reset.v(n) ===
 
 
<blockquote>flag(i), where i is the value of var (n), is set to 0.<br />
 
<br />
 
'''Examples:'''<br />
 
flag(var(n)) = 0.</blockquote>
 
 
=== toggle(n) ===
 
 
<blockquote>flag(n) toggles its value.</blockquote>
 
 
=== toggle.v(n) ===
 
 
<blockquote>flag(i), where i is the value of var (n)
 
 
'''Examples:'''<br />
 
flag(var(n)), toggles is value.</blockquote>
 
 
&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>
 
 
&nbsp;
 
 
[[AGI Tutorials|Tutorials Table of Contents]]<br />
 
[[AGI Command Reference|AGI Command Reference Index]]
 
 
<span style="float: left">[[AGI Command Reference|&lt; Previous: Index]]</span><span style="float: right">[[AGI Command Reference - Commands to Load and unLoad Resources|Next: Commands to Load and unLoad Resources &gt;]]</span>
 
 
&nbsp;
 
 
[[Category:Commands]]
 
[[Category:References]]
 
[[Category:Tutorials]]
 
[[Category:Arithmetic Operators]]
 

Latest revision as of 19:51, 22 March 2019