Call

From AGI Wiki
Jump to: navigation, search

The call command executes a logic script.

Syntax

call(byt A);

Remarks

The logic with resource number A 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 command.

If a logic is likely to be called more than once or twice, it is better to load it using the load.logics 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:
[ typical error handler
[ assume logic ID for error handling logic is 'ErrHandler'
if(errorNumber > 0)
  {
  call(ErrHandler);
  }

Technical Information

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

See Also

Flow Control Commands
call.v
load.logics