|
|
(20 intermediate revisions by one other user not shown) |
Line 1: |
Line 1: |
− | [[AGI Tutorials|Tutorials Table of Contents]]<br />
| |
| | | |
− | <div align="center">
| |
− | Page:
| |
− | '''[ 1 ]''' |
| |
− | [[AGI Command Reference 2 - Commands to Load and Unload Resources|2]] |
| |
− | [[AGI Command Reference 3 - Program Control Commands|3]] |
| |
− | [[AGI Command Reference 4 - Object Control Commands|4]] |
| |
− | [[AGI Command Reference 5 - Object Description Commands|5]] |
| |
− | [[AGI Command Reference 6 - Object Motion Control Commands|6]] |
| |
− | [[AGI Command Reference 7 - Inventory Item Management Commands|7]] |
| |
− | [[AGI Command Reference 8 - Picture Resource Management Commands|8]] |
| |
− | [[AGI Command Reference 9 - Sound Resource Management Commands|9]] |
| |
− | [[AGI Command Reference 10 - Text Management Commands|10]] |
| |
− | [[AGI Command Reference 11 - String Management Commands|11]] |
| |
− | [[AGI Command Reference 12 - Initialization Commands|12]] |
| |
− | [[AGI Command Reference 13 - Menu Management Commands|13]] |
| |
− | [[AGI Command Reference 14 - Test Commands|14]] |
| |
− | [[AGI Command Reference 15 - Other Commands|15]] |
| |
− | [[AGI Command Reference 16 - Unknown Commands|16]]
| |
− | </div><br />
| |
− |
| |
− |
| |
− | <div align="center"><span style="font-size: 22pt">Arithmetic Commands</span></div><br />
| |
− | ''By [[Chris Cromer]]''</div>
| |
− |
| |
− |
| |
− | Commands that operate on variables.
| |
− |
| |
− |
| |
− |
| |
− | === <br />increment(n); ===
| |
− |
| |
− | The value of the variable Var(n) is incremented by one, i.e.<br />
| |
− | Var(n) = Var(n)+1. If the value is already 255, it is left unchanged.
| |
− |
| |
− | === decrement(n); ===
| |
− |
| |
− | The value of the variable Var(n) is decremented by one, i.e.<br />
| |
− | Var(n) = Var(n)-1. If the value is 0, it is left unchanged.
| |
− |
| |
− | === assign(n, m); ===
| |
− |
| |
− | Variable Var(n) is assigned the value m, i.e. Var(n) = m
| |
− |
| |
− | === assignv(n, m); ===
| |
− |
| |
− | Variable Var(n) is assigned the value of Var(m), i.e.<br />
| |
− | Var(n) = Var(m).
| |
− |
| |
− | === addn(n, m); ===
| |
− |
| |
− | The value of variable Var(n) is incremented by m, i.e.<br />
| |
− | Var(n) = Var(n) + m.
| |
− |
| |
− | === addv(n, m); ===
| |
− |
| |
− | 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.
| |
− |
| |
− |
| |
− |
| |
− | <div align="center">
| |
− | Page:
| |
− | '''[ 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>
| |
− |
| |
− |
| |
− |
| |
− | [[AGI Tutorials|Tutorials Table of Contents]]
| |
− | [[AGI Command Reference|Table of Contents]]
| |
− |
| |
− | <span style="float: left">[[AGI Command Reference - |< Previous: ]]</span><span style="float: right">[[AGI Command Reference - |Next: >]]</span>
| |
− |
| |
− |
| |
− | <span style="float: left">[[AGI Command Reference|< Previous: Index]]</span><span style="float: right">[[AGI Command Reference - Commands to Load and unLoad Resources|Next: Commands to Load and unLoad Resources >]]</span>
| |
− |
| |
− |
| |
− |
| |
− | [[Category:References]]
| |
− | [[Category:Tutorials]]
| |