Load.view.v

From AGI Wiki
Jump to navigationJump to search

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

Syntax

load.view.v(var vVIEWNUM);

Remarks

This command loads view B, where B equals the value of vVIEWNUM, 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:
[ typical code to assign ego's view upon entering a room
animate.obj(ego);                 [ must initialize the object every time a new room is entered
load.view.v(currentEgoView);      [ this reserved variable (v16) contains current view number of ego
set.view.v(ego, currentEgoView);  [ assign the view
draw(ego);                        [ and then draw ego on screen

Technical Information

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

See Also

load.view
Memory Management
AGI Scripts