Load.logics

From AGI Wiki
Revision as of 15:23, 10 April 2019 by Andrew Korson (talk | contribs) (→‎Remarks)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

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