Set.scan.start
The set.scan.start command sets the entry point for a logic script.
Syntax
set.scan.start();
Remarks
When the set.scan.start command is executed, AGI stores the current script position of the running logic in a scan start table, and subsequent calls to this logic will start at that stored position, instead of starting at the beginning.
This could be useful if a logic has a large section at the beginning that only needs to be executed once. At the end of that section, the set.scan.start command can be used to make AGI skip over the initialization section on subsequent iterations.
Use the reset.scan.start command to reset the entry point back to the beginning of the logic.
In the following example, you will only see the first message one time. After that, the logic begins execution at the second print statement. If flag f99 is set to TRUE at some point, the scan point is reset back to the beginning, and the next iteration will show the first command again.
Possible Errors
None.
Example
<syntaxhighlight lang="agi"> print("this is first command."); set.scan.start(); [ subsequent calls to this logic will start at the
[ command following this call to set.scan.start
print("this is second command."); if(isset(f99))
{ reset.scan.start(); }
</syntaxhighlight>
Technical Information
Required Interpreter Version: | Available in all AGI versions. |
Byte-Code Value: | 145 (0x91 hex) |