Discard.pic
The discard.pic command unloads a picture resource from the memory heap.
Syntax
discard.pic(var vA);
Remarks
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.
Example
<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: | 27 (0x1B hex) |