Call.v

From AGI Wiki
Revision as of 11:49, 14 April 2019 by Andrew Korson (talk | contribs) (→‎Example)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

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