Difference between revisions of "Load.logics.v"

From AGI Wiki
Jump to navigationJump to search
(Created page with "The '''load.logics.v''' command indirectly loads a logic resource onto the memory heap. == Syntax == load.logics.v(var vLOGICNUM); == Remarks == This...")
 
 
Line 8: Line 8:
  
 
This command loads [[logic]] '''B''', where '''B''' equals the value of '''vLOGICNUM''', onto the [[memory heap]], keeping it in memory permanently until it gets unloaded (by ending the game, [[restarting]], [[restoring]], or entering a [[new room]]). This avoids having to load and unload it each time it is called with the '''[[call]]''' command.
 
This command loads [[logic]] '''B''', where '''B''' equals the value of '''vLOGICNUM''', onto the [[memory heap]], keeping it in memory permanently until it gets unloaded (by ending the game, [[restarting]], [[restoring]], or entering a [[new room]]). This avoids having to load and unload it each time it is called with the '''[[call]]''' command.
 +
 +
There is no 'discard logic' command to unload a logic once it is loaded.
  
 
AGI adds a script entry to the [[script stack]] each time a [[logic]] resource is loaded.
 
AGI adds a script entry to the [[script stack]] each time a [[logic]] resource is loaded.

Latest revision as of 15:28, 10 April 2019

The load.logics.v command indirectly loads a logic resource onto the memory heap.

Syntax

load.logics.v(var vLOGICNUM);

Remarks

This command loads logic B, where B equals the value of vLOGICNUM, onto the memory heap, keeping it in memory permanently until it gets unloaded (by ending the game, restarting, restoring, or entering a new room). This avoids having to load and unload it each time it is called with the call command.

There is no 'discard logic' command to unload a logic once it is loaded.

AGI adds a script entry to the script stack each time a logic resource is loaded.

Possible Errors

If you attempt to load a logic that does not exist, AGI will raise a runtime error and crash.

Example

Code:

<syntaxhighlight lang="agi"> v50 = 75; call.v(v50); [ loads and executes logic 75, unloading it after returning load.logics.v(v50); [ loads logic, and adds script entry call.v(v50); [ executes logic, but does not unload it after returning </syntaxhighlight>

Technical Information

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

See Also

call
load.logics
Memory Management
AGI Scripts