Load.view

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

The load.view command loads a view resource onto the memory heap.

Syntax

load.view(byt VIEWNUM);

Remarks

This command loads view VIEWNUM onto the memory heap. View resources must be loaded before being used in any other commands. If a view is not loaded before being used in commands, AGI will generate one of several trappable errors. Views should be unloaded using the discard.view or discard.view.v command once they are no longer needed.

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

Possible Errors

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

Example

Code:

<syntaxhighlight lang="agi"> [ typical code to assign a view to an object [ assume there is a view with ResourceID of 'Armor'

  1. define o1 Guard;

animate.obj(Guard); [ initialize the Guard object load.view(Armour); [ load the view with the guard in armor set.view(Guard, Armour); [ assign the view draw(Guard); [ and then draw the object on screen </syntaxhighlight>

Technical Information

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

See Also

Screen Object/View Commands
load.view.v
Memory Management
AGI Scripts