Difference between revisions of "Call.v"

From AGI Wiki
Jump to navigationJump to search
(Created page with "The '''call.v''' command executes a logic script by reference. == Syntax == call.v(var vA); == Remarks == The logic with resource number equal to value of...")
 
 
Line 21: Line 21:
 
[ assume logic #98 is error handling logic
 
[ assume logic #98 is error handling logic
 
v50 = 98;
 
v50 = 98;
if(errorNumber > 0) {
+
if(errorNumber > 0)
 +
  {
 
   call.v(v50);
 
   call.v(v50);
}
+
  }
 
</syntaxhighlight>
 
</syntaxhighlight>
  

Latest revision as of 11:49, 14 April 2019

The call.v command executes a logic script by reference.

Syntax

call.v(var vA);

Remarks

The logic with resource number equal to value of variable vA is executed one time. If it is not currently loaded when called, it is loaded, then executed, and then unloaded after returning. A script entry is not made for logics that are loaded/unloaded in support of the call.v command.

If a logic is likely to be called more than once or twice, it is better to load it using the load.logics.v command. This avoids having AGI continually load and unload the same logic over and over.

Possible Errors

If the logic does not exist, AGI will display a 'resource not found' message, and immediately quit.

Example

Code:

<syntaxhighlight lang="agi"> [ assume logic #98 is error handling logic v50 = 98; if(errorNumber > 0)

 {
 call.v(v50);
 }

</syntaxhighlight>

Technical Information

Required Interpreter Version: Available in all AGI versions.
Byte-Code Value: 23 (0x17 hex)

See Also

Flow Control Commands
call
load.logics.v