Global Said() Statements
About Global Said Statements
Global said statements are essential to all good adventure games. They add a greater feel of freedom to explore and interact with the game's environment. Every SCI game needs to be able to react to certain phrases in every room, and there's no reason to repeat code if it's unnecessary.
Sierra's games all had global phrases, many to add humor to the game. For example, if you type "Hello", the game will respond "Hi." back, or if you type "jump", it will respond "Whee!".
Adding Global Said Statements To The Game
Global said statements are no harder to add to your game than any other said statements. Instead of adding them to the room script's handleEvent method, simply add them to the game instance's handleEvent method found in the main script.
First, open up your game's "main.sc" script.
Scroll down to the game's instance.
Next, scroll down to the handleEvent method (at the bottom of the instance).
The area in the red box is where you add the global said statements. |
You can add the said statements like you do in any other area of the game. As long at they are in the game instance's handleEvent method, they will be parsed by every room automatically.
Examples of Using The Global Said Statements
The best thing about global said statements is that you can override them in your room, In other words, the rooms script handles the statement if it can, it's only when it can't that the main scripts global said statements even try. They are only parsed if the the player did not enter a phrase handled by the room. I'll explain this with a global "look" said statement.
Code:(if(Said('look\) Print("You see nothing special.") )Now, if the room doesn't have a said handler for the phrase "look", it will display the message "You see nothing special.". However, if the room does have a said handler for "look", it will execute the room's handler. It's a perfect example of how global said statements will not interfere with your rooms.
You can do much more with global said statements though. Here's another example:
Code:(if(Said('change/clothes')) SetUpEgo(2 1) Print("You are now view.001 with loop 2 active!") )Now, if you type "change clothes", it will set the ego to view.001 and change it's loop to 2.
That sums up global said statements.
< Previous: SCI Studio Tutorial 2 Next: Chapter 2 - Oh, yeah? Well, "%s" this! >