SCI Programming.com
Welcome, Guest. Please login or register.
May 20, 2012, 08:45 PM
Home Gallery Arcade Chat Shop Search Help Login Register
Home Fan Made Games Sierra Games Tools Tutorials Member Sites
Developer Desktop

Home  >  SCI Community  >  SCI Programming  >  SCI Community How To's & Tutorials  >  Topic: Said strings & the Use of Articles « previous next »
Pages: [1] Print
Author Topic: Said strings & the Use of Articles  (Read 342 times)
gumby
Sr. Programmer
****

Karma: 1
Offline Offline

Posts: 467



$3770.00 Buckazoids
View Inventory
Give Money



View Profile
« on: Dec 27, 2010, 09:41 PM »

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:
    // 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")
    )

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.
Logged

50206_rope_firstplace.png
Pages: [1] Print 
Home  >  SCI Community  >  SCI Programming  >  SCI Community How To's & Tutorials  >  Topic: Said strings & the Use of Articles « previous next »
Jump to:  
Page created in 0.085 seconds with 20 queries.
The SCI Programming Community
Copyright © 2007 - 2012, All Rights Reserved.
Forums Powered by SMF 1.1.16 | SMF © 2011, Simple Machines