Script Classes for Adventure Games/Script Class: Difference between revisions
No edit summary |
No edit summary |
||
| (7 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
[[Category:SCI Pages]] | |||
[[Official SCI Documentation]]<br /> | [[Official SCI Documentation]]<br /> | ||
[[Script Classes for Adventure Games | Table of Contents]] | [[Script Classes for Adventure Games | Table of Contents]] | ||
<div align="center"> | <div align="center"> | ||
Chapter: | Chapter: | ||
[[Script Classes for Adventure Games/Introduction|1]] | | [[Script Classes for Adventure Games/Introduction|1]] | | ||
[[Script Classes for Adventure Games/RootObj Class|2]] | | [[Script Classes for Adventure Games/RootObj Class|2]] | | ||
| Line 32: | Line 32: | ||
[[Script Classes for Adventure Games/Global Variables|27]] | | [[Script Classes for Adventure Games/Global Variables|27]] | | ||
[[Script Classes for Adventure Games/Index|Index]] | [[Script Classes for Adventure Games/Index|Index]] | ||
</div> | </div> | ||
<div align="center"><span style="font-size: 22pt">The Script Class</span><br />''Author: [[Jeff Stephenson]]''<br />''1988-04-05''</div></div> | |||
<div align="center"><span style="font-size: 22pt">The Script Class</span><br /> | |||
''Author: [[Jeff Stephenson]]''<br /> | |||
'' | |||
<br /> | |||
==<br /> The Script Class == | ==<br /> The Script Class == | ||
| Line 116: | Line 112: | ||
==<br /> References == | ==<br /> References == | ||
<references /> | <references /><!-- Do not edit this section. It is autopopulated by <ref></ref> tags --> | ||
==<br /> See | ==<br /> Also See == | ||
* [[:Category:SCI Documentation|SCI Documentation]] | |||
* [[:Category:Official SCI Documentation|Official SCI Documentation]] | |||
* [[:Category:SCI Scripting|SCI Scripting]] | |||
* [[:Category:SCI Classes|SCI]] | |||
* [[:Category:SCI Script Classes | The SCI Script Classes]] | |||
* [[SCI Specifications]] | * [[SCI Specifications]] | ||
| | ||
[[Official SCI Documentation]]<br /> | |||
[[Script Classes for Adventure Games | Table of Contents]] | [[Script Classes for Adventure Games | Table of Contents]] | ||
<span style="float: left">[[Script Classes for Adventure Games/Inventory Class|< Previous: The Inventory Class]]</span> | <span style="float: left">[[Script Classes for Adventure Games/Inventory Class|< Previous: The Inventory Class]]</span> | ||
<span style="float: right">[[Script Classes for Adventure Games/Timer Class|Next: The Timer Class >]]</span> | <span style="float: right">[[Script Classes for Adventure Games/Timer Class|Next: The Timer Class >]]</span> | ||
| | ||
[[Category:References]] | [[Category:References]] | ||
[[Category:SCI References]] | [[Category:SCI References]] | ||
[[Category:Historical Pages]] | |||
[[Category:SCI Historical Pages]] | |||
[[Category:Development]] | |||
[[Category:SCI Development]] | |||
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:SCI Documentation]] | [[Category:SCI Documentation]] | ||
[[Category:Official Documentation]] | |||
[[Category:Official SCI Documentation]] | |||
[[Category:Scripting]] | [[Category:Scripting]] | ||
[[Category:SCI Scripting]] | [[Category:SCI Scripting]] | ||
[[Category:Classes]] | [[Category:Classes]] | ||
[[Category:SCI Classes]] | [[Category:SCI Classes]] | ||
Latest revision as of 22:06, 6 January 2026
Official SCI Documentation
Table of Contents
Chapter:
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
Index
The Script Class
A Script is a kind of Object which has a state, methods to change that state, and code to execute when the state changes. It is used to model a sequence of actions which should be executed by an object, such as an Actor walking to the base of some stairs, walking up the stairs, and opening a door.
| In file: | system.sc |
| Inherits from: | Object |
| Inherited by: | none |
Properties
clientThe object (a Prop, Actor, Ego, Room, etc.) whose Script this is. Used to communicate with the Script's client.
stateThe state of the Script.
startThe desired initial state of the Script.
timerThe ID of a timer which has been set to cue: the Script after a certain interval.
registerA property that allows you to store what ever you want. This is very useful in a Script since a temporary variable will not hold its value longer that the life of one method, thus without this property the only way to keep a value fro. state to state through a Script would have been a local o. global variable. If more than one value needs to be stored the register property could be used as a pointer to a Collection, List or Set.
callerThe is where the Script keeps the ID of the object to cue: upon completion.
secondsThis contains the number of seconds until a state change wil. occur. This is generally set in one of the scripts states to signal the number of seconds until a state change should occur.
cyclesThis contains the number of animation cycles until a stat. change will occur. This is generally set in one of the script. states to signal the number of animation cycles until a stat. change should occur.
scriptThe ID of this script's script if it has one. This property is filled by the setScript method and should not be set directly.
Methods
init: [client]Initialize the Script entering the initial state by doing a (self changeState:start). Set the Script's client to client if present.
changeState: newStateChange the Script's state to newState. This method is where to put the code to be executed on state transitions. It should store the new state in the state property, then switch to the appropriate code based on the new state:
Code:(method (changeState newState) (switch (= state newState) transition code... ) )
cue:Do a changeState: to the next state. Default is to invoke (self changeState:(+ state 1))
handleEvent: eventThis method of an active script is called whenever there is an input event (see class Event). If (event claimed:) is TRUE, someone else has already responded to the event. Whether or not someone else has responded, if the Script responds to the event it should claim it by doing an (event claimed:TRUE). This method ca. be used to add additional responses to an Actor ,Prop etc.
setScript: newScript whoCares registerA Script can also have a script. This adds subroutine style capability to scripts. If the optional parameter whoCares is present the newScript will cue: whoCares and pass on the content. its register when it is disposed (i.e. (client cue:register)). In this case, the last state of the newScript should dispose o. itself i.e. (self dispose:) or (client setScript:0). The third parameter (if present) sets the newScript's register property. If a Script has a newScript the newScript will receive all the events the the parenet script receives.
References
Also See
- SCI Documentation
- Official SCI Documentation
- SCI Scripting
- SCI
- The SCI Script Classes
- SCI Specifications