Advanced Said() Strings - Part 1: Difference between revisions
m Andrew Branscom moved page Advanced Said() Strings - Part 1 to Advanced SCI Tutorials - Advanced Said() Strings - Part 1 |
No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[Category:SCI Pages]] | [[Category:SCI Pages]] | ||
[[Category:SCI Pages to be Edited]] | |||
[[SCI Tutorials and Guides|SCI Tutorials and Guides Table of Contents]] | |||
==More About Said Statements== | <div align="center"><span style="font-size: 22pt">Advanced Said() Strings - Part 1</span><br />''By [[]]''</div> | ||
<br /> | |||
==<br /> More About Said Statements == | |||
This chapter explains some common Said usage patterns that aren't fully explained in the other tutorials. | This chapter explains some common Said usage patterns that aren't fully explained in the other tutorials. | ||
=== "Look" vs. "Look thing" === | ===<br /> "Look" vs. "Look thing" === | ||
Often, you might want to enclose all your 'look' handlers in one if statement, but still support just "look" all by itself. | Often, you might want to enclose all your 'look' handlers in one if statement, but still support just "look" all by itself. | ||
Line 33: | Line 37: | ||
Note that more specific Said clauses should always come before more general ones. | Note that more specific Said clauses should always come before more general ones. | ||
===More complex Said strings=== | ===<br /> More complex Said strings === | ||
Consider the following example: | Consider the following example: | ||
Line 66: | Line 70: | ||
| | ||
<!-- | |||
<span style="float: left">[[Advanced_SCI_Tutorials|< Previous: Advanced SCI Tutorials Introductions]]</span> | <span style="float: left">[[Advanced_SCI_Tutorials|< Previous: Advanced SCI Tutorials Introductions]]</span> | ||
<span style="float: right">[[Regions and Locales|Next: Chapter 2 - Regions and Locales >]]</span> | <span style="float: right">[[Advanced SCI Tutorials - Regions and Locales|Next: Chapter 2 - Regions and Locales >]]</span> | ||
--> | |||
| | ||
[[Category:Technical Info]] | [[Category:Technical Info]] | ||
[[Category:SCI Technical Info]] | |||
[[Category:The SCI Parser]] | [[Category:The SCI Parser]] | ||
[[Category:Examples]] | [[Category:Examples]] |
Latest revision as of 13:42, 29 April 2025
SCI Tutorials and Guides Table of Contents
By [[]]
More About Said Statements
This chapter explains some common Said usage patterns that aren't fully explained in the other tutorials.
"Look" vs. "Look thing"
Often, you might want to enclose all your 'look' handlers in one if statement, but still support just "look" all by itself.
(if (Said 'look>')
(if (Said '/wall') (Print {The wall is covered in paint.}))
(if (Said '/floor') (Print {The floor is covered in dust.}))
(if (Said '[/!*]') (Print {You are in a room with a floor and a wall.})) ; this will handle just "look" by itself
(if (Said '/*') (Print {You don't see anything interesting about it.})) ; this will handle "look anyword"
)
If you wanted to handle 'look around' just like look, you could do:
(if (Said 'look>')
(if (Said '/wall') (Print {The wall is covered in paint.}))
(if (Said '/floor') (Print {The floor is covered in dust.}))
(if (Said '[/around]') (Print {You are in a room with a floor and a wall.})) ; this will handle just "look" by itself, and also "look around"
(if (Said '/*') (Print {You don't see anything interesting about it.}))
)
Note that more specific Said clauses should always come before more general ones.
More complex Said strings
Consider the following example:
(if (Said 'give/food/dog')
(Print {You give the food to the dog.})
)
One thing to note is that the order of words in the Said string doesn't necessarily match the order that the words are typed in by the user. There is more meaning to the Said string than that. The above clause will respond positively to the user typing "Give food to the dog", or even "Give dog the food". However, surprisingly (and fortunately), it will not match "Give food the dog". Rather than the particular word order in a sentence, the three parts of the above clause correspond to sentence parts.
Similarly:
(if (Said 'point<up/flashlight')
(Print {You point the flashlight up, and see something curious.})
)
This will respond to "point flashlight up", but not "point up flashlight". (Note: FreeSCI may have some bugs here that make it behave differently than the Sierra parser).
That sums up more about said statements.
References
Also See