Difference between revisions of "Load.pic"
(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...") |
|||
Line 7: | Line 7: | ||
== Remarks == | == 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]]. | + | 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]]. [[Picture|Pictures]] should be unloaded using the '''[[discard.pic]]''' command once they are no longer needed. |
Pictures are typically used to graphically represent '[[room|rooms]]' in an AGI game, but can also be used for any display that needs to take up the entire screen. | Pictures are typically used to graphically represent '[[room|rooms]]' in an AGI game, but can also be used for any display that needs to take up the entire screen. |
Latest revision as of 15:39, 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 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.
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: | 24 (0x18 hex) |