Ignore Case

I'm using the Gamebook.
Is there a simple way to have case sensitivity ignored when the code checks an input?


GetInput() {
if (lcase(result)="hi") {
msg ("Hi back at ya!")
}
else {
msg ("WHAT???")
}
}
lcase converts the result to lower case...
Then compare everything to a lower case answer.
if (lcase(result)="Hi") {
would NEVER work!!!


oh thanks! That's perfect!
do you know how to make a list of possible entries that yield the same result?
(something like: if result = "one", "two", "three" then print message "that's a number"?)


Curiously the LCase command is one of only a few that ignore case, so can be written lcase.


Not sure.

Edit: Sorry, this is where I meant to type:
I was going to post a link to a thread I posted here, but it seems either someone deleted it or it got knocked back.
Oh well.
Nice to see you have made progress, anyways.

The message is on another thread.


here's many (not all though) of the Functions/Scripts of quest that you can use:

http://docs.textadventures.co.uk/quest/scripts/
http://docs.textadventures.co.uk/quest/functions/ (categorical order)
http://docs.textadventures.co.uk/quest/functions/index_allfunctions.html (alphabetical order)
http://docs.textadventures.co.uk/quest/scopes.html (while these are found in the 'function' links, it's nice to have these as a separate link)


GetInput() {
if (lcase(result)="hi" or lcase(result)="hello" or lcase(result)="howdy") {
msg ("Hi back at ya!")
}
else {
msg ("WHAT???")
}
}
I think you can figure out the "number" thing...


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums