Ignore Case

brenden.winger
08 Jun 2017, 18:34

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


DarkLizerd
08 Jun 2017, 19:58

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!!!


brenden.winger
08 Jun 2017, 20:08

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"?)


The Pixie
08 Jun 2017, 20:18

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


jmnevil54
08 Jun 2017, 21:57

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.


hegemonkhan
09 Jun 2017, 01:50

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)


DarkLizerd
09 Jun 2017, 05:13

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