AGI Command Reference - String Management Commands and AGI Indirect Command: Difference between pages

From Sierra Wiki
(Difference between pages)
Jump to navigationJump to search
m 1 revision imported
 
sierraw>Andrew Branscom
 
Line 1: Line 1:
[[Category:AGI Pages]]
[[Category:AGI Pages]]
[[AGI Command Reference|AGI Command Reference Index]]<br />
<div align="center" style="font-size: 22pt">AGI Indirect Command</div><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">String Management Commands</span><br />
An indirect command is a [[AGI Logic Resource|logic]] command that requires the number of a [[AGI Resources|resource]] to be specified but uses a [[Variable (AGI)|variable]] to specify the resource number. For example compare the direct command <code>load.view</code> to the indirect command <code>load.view.v</code>:
''By [[agiw:Chris Cromer|Chris Cromer]]''</div>


&nbsp;
load.view(20);
 
== <br />set.string(n, m); ==
 
<blockquote>Stores message number m in the string variable n.</blockquote>


== word.to.string(n, m); ==
v200 = 20;
load.view.v(v200);


<blockquote>Word number m of the user input is stored in String(n).</blockquote>
In the above code, both commands load VIEW.020, but <code>load.view</code> is direct because it accepts the actual number of the [[AGI View Resource|view resource]] that should be loaded. The <code>load.view.v</code> command is indirect because it does not accept the actual number of the resource that should be loaded. You have to put the number into a variable and give that to the <code>load.view.v</code> command.


== get.string(n, m, x, y, l); ==
This probably seems like more work than is necessary, and in many cases it is. But indirect commands do have an advantage over direct commands, namely that they are more flexible. For example, the following code, from the [[agiw:AGI Studio Template Game|AGI Studio Template Game]], allows the player to teleport to any [[ROOM (AGI)|room]] in the game by entering the room number:


<blockquote>User input is stored in String(n). m is the number of the message used as the prompt, x, y, l are input position and maximum string length.</blockquote>
<div class="CodeBlockHeader">Code:</div>
<syntaxhighlight lang="agi">
if (said("tp")) {
  get.num("new room: ", v255);
  new.room.v(v255);
}
</syntaxhighlight>


== parse(n); ==
This function is not possible without indirect commands, because there is no way to know ahead of time which room the player will want to teleport to. The alternate approach of having up to 254 different commands for teleporting to each of the possible rooms in the game is obviously no good.


<blockquote>Parses String(n) as if it were entered by the player.</blockquote>
Indirect command listing


== get.num(n, m); ==
The following is a list of all the indirect commands in AGI logic. Most indirect commands end in <code>.v</code>, but there are exceptions to this rule. Also, not all commands that end in <code>.v</code> are indirect commands.


<blockquote>
* <code>[[add.to.pic.v]]</code>
Enters a number from the keyboard into Var(m). Message n is used as the prompt.
* <code>[[call.v]]</code>
</blockquote>
* <code>[[cycle.time]]</code>
* <code>[[discard.view.v]]</code>
* <code>[[display.v]]</code>
* <code>[[draw.pic]]</code>
* <code>[[get.room.v]]</code>
* <code>[[get.v]]</code>
* <code>[[load.logics.v]]</code>
* <code>[[load.pic]]</code>
* <code>[[load.view.v]]</code>
* <code>[[move.obj.v]]</code>
* <code>[[new.room.v]]</code>
* <code>[[obj.status.v]]</code>
* <code>[[overlay.pic]]</code>
* <code>[[position.v]]</code>
* <code>[[print.at.v]]</code>
* <code>[[print.v]]</code>
* <code>[[put.v]]</code>
* <code>[[reposition]]</code>
* <code>[[reposition.to.v]]</code>
* <code>[[reset.v]]</code>
* <code>[[set.cel.v]]</code>
* <code>[[set.dir]]</code>
* <code>[[set.loop.v]]</code>
* <code>[[set.priority.v]]</code>
* <code>[[set.view.v]]</code>
* <code>[[set.v]]</code>
* <code>[[show.obj.v]]</code>
* <code>[[step.size]]</code>
* <code>[[step.time]]</code>
* <code>[[toggle.v]]</code>


==<br /> References ==
==<br /> References ==
Line 53: Line 65:
<references />
<references />


==<br /> Related Links ==
==<br /> Also See ==


*  
*  
&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 />
[[AGI Command Reference|AGI Command Reference Index]]
<span style="float: left">[[AGI Command Reference - Text Management Commands|&lt; Previous: Text Management Commands]]</span><span style="float: right">[[AGI Command Reference - Initialization Commands|Next: Initialization Commands &gt;]]</span>


&nbsp;
&nbsp;


[[Category:Technical Info]]
[[Category:Technical Info]]
[[Category:Development]]
[[Category:References]]
[[Category:References]]
[[Category:AGI References]]
[[Category:AGI References]]
[[Category:AGI Logic]]
[[Category:Commands]]
[[Category:AGI Variables]]
[[Category:AGI Commands]]
[[Category:AGI Commands]]
[[Category:AGI Strings]]

Revision as of 19:57, 8 February 2022

AGI Indirect Command



An indirect command is a logic command that requires the number of a resource to be specified but uses a variable to specify the resource number. For example compare the direct command load.view to the indirect command load.view.v:

load.view(20);

v200 = 20; load.view.v(v200);

In the above code, both commands load VIEW.020, but load.view is direct because it accepts the actual number of the view resource that should be loaded. The load.view.v command is indirect because it does not accept the actual number of the resource that should be loaded. You have to put the number into a variable and give that to the load.view.v command.

This probably seems like more work than is necessary, and in many cases it is. But indirect commands do have an advantage over direct commands, namely that they are more flexible. For example, the following code, from the AGI Studio Template Game, allows the player to teleport to any room in the game by entering the room number:

Code:
if (said("tp")) {
  get.num("new room: ", v255);
  new.room.v(v255);
}

This function is not possible without indirect commands, because there is no way to know ahead of time which room the player will want to teleport to. The alternate approach of having up to 254 different commands for teleporting to each of the possible rooms in the game is obviously no good.

Indirect command listing

The following is a list of all the indirect commands in AGI logic. Most indirect commands end in .v, but there are exceptions to this rule. Also, not all commands that end in .v are indirect commands.


References



Also See