Optional words with text input.

The following code works just fine in Squiffy:

What do you want to say to grandma?

<input type="text" id="blahblah">," you [[say]].

    squiffy.set("blahblah", jQuery("#blahblah").val());

"{blahblah}," you say to grandma.

{if blahblah=Help:"I'm coming!"}{if blahblah=Lets eat:"Oh, goody!"} she [[replies]](first).

I would like the player to be able to type a variety of things to get the same response. For example--> (P|p)lease)(,)(H|h)elp (me) (!|?|.) so that it wouldn't matter whether the player used caps or not, punctuation, or not, "Please," or not, "me" or not.

You'll say, of course, that I should just make a parser game. I want to make games in Chinese and there exist no parser game engines for Chinese yet. :-(

var str = "Hello World!";
var res = str.toLowerCase();

You can use the above to convert a Javascript string to lowercase before. You might have to make some modifications to your code though, as you're currently pushing the input directly into a Squiffy attribute which I don't believe you can manipulate in the same way.

I'm having this problem too.

@thetruespin, how can I use the code you give on this example

@set buzzans1a=bad
What is harder to catch the faster you run?
<input type="text" id="buzzinput1" pattern="A-Za-z" maxlength="10"> <br>


        {squiffy.set("buzzans1", jQuery("#buzzinput1").val());}
You type {buzzans1}  the textarea on the first section... <br>
{if buzzans1=breath:You got it right!}


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