Difference between revisions of "AGIWiki/discard.view"
< AGIWiki
Jump to navigation
Jump to search
(→Examples: dix syntax highlighting) |
m (Text replacement - "</source>" to "</syntaxhighlight>") |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 37: | Line 37: | ||
The following example uses <code>discard.view</code> to remove view 203 from memory: | The following example uses <code>discard.view</code> to remove view 203 from memory: | ||
< | <syntaxhighlight lang="cpp"> | ||
load.view(203); | load.view(203); | ||
discard.view(203); | discard.view(203); | ||
</ | </syntaxhighlight> | ||
== Technical Information == | == Technical Information == | ||
Line 56: | Line 56: | ||
* [[AGIWiki/discard.view.v|discard.view.v]] | * [[AGIWiki/discard.view.v|discard.view.v]] | ||
* [[AGIWiki/load.view|load.view]] | * [[AGIWiki/load.view|load.view]] | ||
* [[AGIWiki/load.view | * [[AGIWiki/load.view|load.view.v]] | ||
== Sources == | == Sources == |
Latest revision as of 15:17, 25 October 2018
The discard.view command removes a view resource from memory. There is an indirect version of this command called discard.view.v.
Syntax
- discard.view(byt viewNumber);
View viewNumber
is discarded from memory.
Remarks
Resources must be unloaded in reverse order of the way they were originally loaded, or unexpected results may occur.
Attempting to discard a resource that has not been loaded will generate an error.
Before unloading a view, make certain it is not in use by any active screen objects. If a view is unloaded while still assigned to an object, the interpreter will most likely crash.
AGI adds a script entry to the script stack each time a view resource is unloaded.
Parameters
For discard.view
viewNumber
: a number, 0-255, specifying which view resource to remove from memory
Possible errors
- if the view is not already loaded, the game will crash with a view not loaded error
- if the view is assigned to an object when it is discarded, the game may crash or exhibit other odd behavior; it may not even generate an error message
- resources must be discarded in exactly the reverse order that they were loaded, or subsequent
discard.view
commands may generate a view not loaded error, even if the view has actually been loaded; see Memory and Script for more details on this issue - the
discard.view
anddiscard.view.v
commands add to the script buffer; this can cause a script buffer overflow error
Examples
The following example uses discard.view
to remove view 203 from memory:
load.view(203);
discard.view(203);
Technical Information
Required interpreter version | Available in all AGI versions |
Bytecode value | 32 (0x20 hex) |
See also
Sources
- Some of the text in the article is taken from the AGI Studio & WinAGI help files.