Difference between revisions of "Load.pic"

From AGI Wiki
Jump to navigationJump to search
(Created page with "The '''load.pic''' command indirectly loads a picture resource onto the memory heap. == Syntax == load.pic(var vPICNUM); == Remarks == This command lo...")
(No difference)

Revision as of 07:05, 10 April 2019

The load.pic command indirectly loads a picture resource onto the memory heap.

Syntax

load.pic(var vPICNUM);

Remarks

This command loads picture B, where B equals the value of vPICNUM, onto the memory heap. Picture resources must be loaded before being used in any other commands, otherwise AGI will raise trappable error #18.

Pictures are typically used to graphically represent 'rooms' in an AGI game, but can also be used for any display that needs to take up the entire screen.

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

Note that the load.pic command uses a variable argument and that there is no equivalent command to load a picture by number.

Possible Errors

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

Example

Code:

<syntaxhighlight lang="agi"> [ load and display the current room's picture: load.pic(currentRoom); [ first load the picture resource draw.pic(currentRoom); [ then draw the picture to memory discard.pic(currentRoom); [ resource no longer needed, so discard it ... show.pic(); [ now display the picture on screen </syntaxhighlight>

Technical Information

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

See Also

Picture Commands
Memory Management
AGI Scripts