Said() Strings and the Use of Articles: Difference between revisions

From Sierra Wiki
Jump to navigationJump to search
(Created page with "Category:SCI Pages <div align="center" style="font-size: 22pt">Said() Strings and the Use of Articles</div><br /><div align="center">''Author: Jeremiah Nellis''<br /></div...")
 
m (1 revision imported)
 
(No difference)

Latest revision as of 00:14, 3 June 2024

Said() Strings and the Use of Articles


Author: Jeremiah Nellis


It is wise to take into account articles when creating said strings. Consider all the different ways that a user could might communicate the command give the pig the mirror to the parser.

Code:

<syntaxhighlight lang="sci" class="cs">

   // Matches: 'give pig mirror' & 'give the pig mirror' 
   // Ignores: 'give pig the mirror'
   (if(Said('give/pig<mirror'))
      Print("Output A")
   )
   // Matches: 'give pig the mirror' & 'give the pig the mirror'
   // Ignores: 'give pig mirror' & 'give the pig mirror'
   (if(Said('give/pig/mirror')
      Print("Output B")
   )
   // Combining the 2 gives you a wider input range
   // Matches all inputs specified above...
   (if(Said('give/pig<mirror') or Said('give/pig/mirror'))
      Print("Output C")
   )

</syntaxhighlight>

As you can see, the first 2 code blocks behave quite differently when the 'the' article is specified, however the 3rd covers all the test cases.


References



Also See