Difference between revisions of "Load.logics"

From AGI Wiki
Jump to navigationJump to search
(Created page with "The '''load.logics''' command loads a logic resource onto the memory heap. == Syntax == load.logics(byt LOGICNUM); == Remarks == This command loads lo...")
 
 
Line 7: Line 7:
 
== Remarks ==
 
== Remarks ==
  
This command loads [[logic]] LOGICNUM onto the [[memory heap]], keeping it in memory 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]] LOGICNUM onto the [[memory heap]], keeping it in memory 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:23, 10 April 2019

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

Syntax

load.logics(byt LOGICNUM);

Remarks

This command loads logic LOGICNUM onto the memory heap, keeping it in memory 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"> call(75); [ loads and executes logic 75, unloading it after returning load.logics(75); [ loads logic, and adds script entry call(75); [ executes logic, but does not unload it after returning </syntaxhighlight>

Technical Information

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

See Also

call
load.logics.v
Memory Management
AGI Scripts