Script.size

From AGI Wiki
Revision as of 14:01, 20 April 2019 by Andrew Korson (talk | contribs) (Created page with "The '''script.size''' command sets the size of the script table. == Syntax == script.size(byt SIZE); == Remarks == Scripts are used to keep trac...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

The script.size command sets the size of the script table.

Syntax

script.size(byt SIZE);

Remarks

Scripts are used to keep track of resources that are loaded when a game is saved or restored. The default script table size is 50 entries. This command allows the programmer to change the script table size to be more efficient with memory.

See the AGI Scripts topic for more information.

Possible Errors

The script.size command should only be called once, and only before any new.room commands are called. If you use the script.size command after the script table has already been set, the table size is not actually changed. If the attempted new size is larger than the actual size, too many script entries will overwrite memory locations used by other loaded resources, which will result in unpredictable behavior, and most likely crash AGI.

Example

Code:

<syntaxhighlight lang="agi"> if(currentRoom == 0))

 {  [ if game just started, no new.room commands yet
 script.size(100);  [ room for twice as many script entries now
 }

</syntaxhighlight>

Technical Information

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

See Also

System Commands
AGI Scripts