From AGI Wiki
Jump to: navigation, search

The discard.pic command unloads a picture resource from the memory heap.


discard.pic(var vA);


The argument for this command is a variable. The picture to be unloaded is determined by the value of vA.

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

Possible Errors

Because of the way that AGI manages memory on the heap, resources must be unloaded in reverse order of the way they were originally loaded, or unexpected results may occur.

Attempting to discard a picture that has not been loaded will raise trappable error #21.


[ 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: 27 (0x1B hex)

See Also

Picture Commands
Working with Pictures