From AGI Wiki
Jump to: navigation, search

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


load.pic(var vPICNUM);


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 should be unloaded using the discard.pic command once they are no longer needed.

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.


[ 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

Technical Information

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

See Also

Picture Commands
Memory Management
AGI Scripts