SCI Kernel Documentation/Resource Functions
Official SCI Documentation
Table of Contents
Resource Functions
Resources are the various components of a game: views, pictures, scripts, etc. and, except for the MEMORY resource, reside on disk, waiting to be loaded when needed. Resources are handled automatically by the kernel, but several functions are provided to allow the programmer a bit more control over how the handling is done.
(Load resType resID)
Loads a resource of type resType and ID (number) resID into hunk space. While any attempt to use a resource which is not loaded will cause the resource to be loaded, it is not generally a good idea to rely on this as it may cause a disk-access delay in the midst of a crucial animation sequence. It is best to do an explicit Load of all resources during the initialization phase of a room to insure that everything is in memory. The resource types are:
VIEW
PICTURE
SCRIPT
TEXT
SOUND
MEMORY (used internally by the kernel)
VOCAB (used internally by the kernel)
FONT
CURSOR
Example: (Load SCRIPT forest) loads the script whose number is in the variable forest into memory.
(UnLoad resType resID)
Purges the resource of type resType and ID (number) resID from hunk space. This is not normally needed, as the kernel will automatically purge the least recently used resource when it doesn't have enough memory to load a new resource. This function is provided for a situation in which it is advantageous to override this automatic purging. Such a situation is unlikely.
Example: (UnLoad SOUND EXPLOSION) purges the sound whose number is EXPLOSION from memory.
(ScriptID script [entry])
Return the object ID for the object which at entry number entry in the publics table of script number script. This will load the script if it is not already in memory. If entry is not present, this returns the ID of entry number 0 of script.
(DisposeScript script)
While resources loaded into hunk space are automatically disposed of when no longer used, when a script is loaded it is loaded into the heap and remains there until disposed of by DisposeScript. This disposes of script number script and should be called when you no longer need the script. This is especially useful for discarding classes and regions that no longer need to be in memory.
(FlushResources roomNum)
If we are tracking resource usage (if run with 'sci -u'), set the internal room number of the room to roomNum, then flush all unlocked resources.
References
Also See
- Official Documentation
- Resource Articles
- Script Resource (SCI)
- SCRIPT in the SCI Specifications
- Script Resource Articles
- Text Resource (SCI)
- TEXT in the SCI Specifications
- Text Resource Articles
- Vocab Resource (SCI)
- Vocab in the SCI Specifications
- Vocab Resource Articles
- Picture Resource (SCI)
- PIC in the SCI Specifications
- Picture Resource Articles
- View Resource (SCI)
- VIEW in the SCI Specifications
- View Resource Articles
- Cursor Resource (SCI)
- Cursor in the SCI Specifications
- Cursor Resource Articles
- Font Resource (SCI)
- Font in the SCI Specifications
- Font Resource Articles
- Sound Resource (SCI)
- Sound Resources in the SCI Specifications
- Sound Resource Articles
- SCI Pages
- SCI References
- Historical Pages
- SCI Historical Pages
- Development
- SCI Development
- SCI Documentation
- Official Documentation
- Official SCI Documentation
- Technical Info
- SCI Technical Info
- Kernel Functions
- SCI Kernel Functions
- SCI Scripting
- SCI Script Resources
- SCI Memory Resources
- Text Resources
- SCI Text Resources
- SCI Vocab Resources
- Picture Resources
- SCI Picture Resources
- SCI View Resources
- SCI Cursor Resources
- SCI Font Resources
- SCI Sound Resources
- SCI Resource Functions