Script Programming Language/Definitions: Difference between revisions

From Sierra Wiki
Jump to navigationJump to search
Andrew Branscom (talk | contribs)
m 1 revision imported
Andrew Branscom (talk | contribs)
 
(16 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[The Original SCI Documentation]]<br />
[[Category:SCI Pages]]
 
[[Official SCI Documentation]]<br />
[[Script Programming Language | Table of Contents]]
&nbsp;
<div align="center">
<div align="center">
Chapter:  
Chapter:  
Line 12: Line 14:
[[The Script Programming Language/Using SC|8]] |  
[[The Script Programming Language/Using SC|8]] |  
[[The Script Programming Language/Index|Index]]
[[The Script Programming Language/Index|Index]]
</div><br />
</div>
 
<div align="center"><span style="font-size: 22pt">Definitions</span><br />''Author: [[Jeff Stephenson]]''<br />''1988-04-04''</div></div>
<div align="center"><span style="font-size: 22pt">The Script Programming Language</span><br />
<span style="font-size: 22pt">Definitions</span><br />
''Author: [[Jeff Stephenson]]''</div>
 
&nbsp;


<br />
== <br /> Definitions ==
== <br /> Definitions ==


Line 139: Line 137:
defines the words synonym1, synonym2, etc. to be synonyms of main-word. In input being interpreted by the script in which the synonym statement is defined, user input of synonym1 will be interpreted as if the user had typed main-word.
defines the words synonym1, synonym2, etc. to be synonyms of main-word. In input being interpreted by the script in which the synonym statement is defined, user input of synonym1 will be interpreted as if the user had typed main-word.


==<br /> References ==


&nbsp;
<references /><!-- Do not edit this section. It is autopopulated by <ref></ref> tags -->


;Notes
==<br /> Also See ==
<references />


* [[:Category:SCI Documentation|SCI Documentation]]
* [[:Category:SCI Scripting|SCI Scripting Articles]]
* [[:Category:Definitions|Definitions Articles]]
* [[Script Resource (SCI)]]
* [[SCI Specifications: Chapter 1 - Introduction#SCRIPT|SCRIPT in the SCI Specifications]]
&nbsp;
&nbsp;


[[The Script Programming Language | Table of Contents]]
[[Official SCI Documentation]]<br />
 
[[Script Programming Language | Table of Contents]]
<span style="float: left">[[The Script Programming Language/Files | &lt; Previous: Files]]</span><span style="float: right">[[The Script Programming Language/Data Types and Variables | Next: Data Types and Variables &gt;]]</span>


<span style="float: left">[[Script Programming Language/Files|&lt; Previous: Files]]</span><span style="float: right">[[Script Programming Language/Data Types and Variables|Next: Data Types and Variables &gt;]]</span>
&nbsp;
&nbsp;
 
[[Category:References]]
[[Category:SCI References]]
[[Category:Historical Pages]]
[[Category:SCI Historical Pages]]
[[Category:Development]]
[[Category:SCI Development]]
[[Category:Documentation]]
[[Category:SCI Documentation]]
[[Category:SCI Documentation]]
[[Category:Official Documentation]]
[[Category:Official SCI Documentation]]
[[Category:Technical Info]]
[[Category:SCI Technical Info]]
[[Category:Scripting]]
[[Category:Scripting]]
[[Category:Definitions]]
[[Category:SCI Scripting]]
[[Category:Define]]
[[Category:SCI Definitions]]
[[Category:Script Resources]]
[[Category:SCI Script Resources]]

Latest revision as of 19:09, 5 January 2026

Official SCI Documentation
Table of Contents  

Chapter: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Index

Definitions
Author: Jeff Stephenson
1988-04-04



Definitions


define:

The define statement allows you to define a symbol which will stand for a string of text:

Code:
(define symbol lots of text)

will replace symbol, wherever it is encountered as a token, with lots of text and then continue scanning at the beginning of the replacement text. Thus, if we write

Code:
(define symbol some text) 
(define some even more)

then

Code:
(symbol)

will become

Code:
(some text)

which then becomes

Code:
(even more text)


enum:

A construct for easing the definition of various states of a state-variable is enum. Say you want to walk an actor from the door of a room across the floor, up the stairs, and through another door. You have a state-variable called actor-pos which will take on a number of values, which could be defined with defines:

Code:
(local    actor-pos 
     (define at-front-door    0) 
     (define in-room          1) 
     (define on-stairs        2) 
     (define top-of-stairs    3) 
     (define upper-door       4) 
)

or you could get the same result with enum:

Code:
(local    actor-pos 
     (enum 
          at-front-door 
          in-room 
          on-stairs 
          top-of-stairs 
          upper-door 
     ) 
)

Enum defaults its first symbol to 0. If you want a different starting value, put it right after the word enum:

Code:
(enum 7 
     at-front-door 
     in-room 
     on-stairs 
     top-of-stairs 
     upper-door 
)

sets at-front-door to 7, in-room to 8, etc.


synonyms:

The synonyms statement defines synonyms of words. All words must have been defined in the vocabulary file (see separate Vocabulary documentation). The statement

Code:
(synonyms 
     (main-word  synonym1 synonym2 ...) 
     ... 
)

defines the words synonym1, synonym2, etc. to be synonyms of main-word. In input being interpreted by the script in which the synonym statement is defined, user input of synonym1 will be interpreted as if the user had typed main-word.


References



Also See

 

Official SCI Documentation
Table of Contents

< Previous: FilesNext: Data Types and Variables >