Difference between revisions of "Indirect Command"
(Created page with "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. Fo...") |
|||
Line 1: | Line 1: | ||
− | An indirect command is a [[ | + | An indirect command is a [[Logic Resource|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 <code>load.view</code> to the indirect command <code>load.view.v</code>: |
load.view(20); | load.view(20); | ||
Line 25: | Line 25: | ||
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. | 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. | ||
− | * [[add.to.pic.v]] | + | * <code>[[add.to.pic.v]]</code> |
− | * [[call.v]] | + | * <code>[[call.v]]</code> |
− | * [[cycle.time | + | * <code>[[cycle.time]]</code> |
− | * [[discard.view.v]] | + | * <code>[[discard.view.v]]</code> |
− | * [[display.v]] | + | * <code>[[display.v]]</code> |
− | * [[draw.pic | + | * <code>[[draw.pic]]</code> |
− | * [[get.room.v]] | + | * <code>[[get.room.v]]</code> |
− | * [[get.v]] | + | * <code>[[get.v]]</code> |
− | * [[load.logics.v]] | + | * <code>[[load.logics.v]]</code> |
− | * [[load.pic | + | * <code>[[load.pic]]</code> |
− | * [[load.view.v]] | + | * <code>[[load.view.v]]</code> |
− | * [[move.obj.v]] | + | * <code>[[move.obj.v]]</code> |
− | * [[new.room.v]] | + | * <code>[[new.room.v]]</code> |
− | * [[obj.status.v]] | + | * <code>[[obj.status.v]]</code> |
− | * [[overlay.pic | + | * <code>[[overlay.pic]]</code> |
− | * [[position.v]] | + | * <code>[[position.v]]</code> |
− | * [[print.at.v]] | + | * <code>[[print.at.v]]</code> |
− | * [[print.v]] | + | * <code>[[print.v]]</code> |
− | * [[put.v]] | + | * <code>[[put.v]]</code> |
− | * [[reposition | + | * <code>[[reposition]]</code> |
− | * [[reposition.to.v]] | + | * <code>[[reposition.to.v]]</code> |
− | * [[reset.v]] | + | * <code>[[reset.v]]</code> |
− | * [[set.cel.v]] | + | * <code>[[set.cel.v]]</code> |
− | * [[set.dir | + | * <code>[[set.dir]]</code> |
− | * [[set.loop.v]] | + | * <code>[[set.loop.v]]</code> |
− | * [[set.priority.v]] | + | * <code>[[set.priority.v]]</code> |
− | * [[set.view.v]] | + | * <code>[[set.view.v]]</code> |
− | * [[set.v]] | + | * <code>[[set.v]]</code> |
− | * [[show.obj.v]] | + | * <code>[[show.obj.v]]</code> |
− | * [[step.size | + | * <code>[[step.size]]</code> |
− | * [[step.time | + | * <code>[[step.time]]</code> |
− | * [[toggle.v]] | + | * <code>[[toggle.v]]</code> |
| |
Revision as of 15:56, 28 December 2013
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:
<syntaxhighlight lang="agi"> if (said("tp")) {
get.num("new room: ", v255); new.room.v(v255);
}
</syntaxhighlight>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.
add.to.pic.v
call.v
cycle.time
discard.view.v
display.v
draw.pic
get.room.v
get.v
load.logics.v
load.pic
load.view.v
move.obj.v
new.room.v
obj.status.v
overlay.pic
position.v
print.at.v
print.v
put.v
reposition
reposition.to.v
reset.v
set.cel.v
set.dir
set.loop.v
set.priority.v
set.view.v
set.v
show.obj.v
step.size
step.time
toggle.v