Text entry support in choice-based systems

I’ve been looking at a couple choice-based systems – most particularly Varytale and ChoiceScript – and I’m wondering if anyone has any experience with their support of text-entry.

I know ChoiceScript has text boxes where the user can type in something like a name:

choicescriptdev.wikia.com/wiki/Input_text

…but can you base any logic on what they’ve actually typed? Does Varytale or any other system have similar support for input other than ‘choose one of the following’?

I’m not looking for anything particularly complex – simple string comparison might be sufficient.

Thanks.

-d-

You can certainly do string comparisons in ChoiceScript. You can also extract characters from a string by using an index number in brackets, like this:

*temp foo *input_text foo The first letter of your response is: ${foo#1}

Note that ChoiceScript string indices are 1-based. Finally, you can use “length(foo)” to get the length of a string.

That’s great! Thanks so much!

Are if-statements based on string comparisons case-sensitive?

I just found this question asked here: forum.choiceofgames.com/t/input … ommand/505 and that seems to be the case:

__*if isim = “Gom”
__*if isim = “GOm”
…etc…

Is there a way to test for particular values that’s case-insensitive?

Thanks again.

-d-

It’s a bit of a hack, but you can capitalize both sides.

*temp foo "foo"
*temp bar "Foo"

*if foo = bar
    case insensitive
    *goto next
*else
    case sensitive

*if "$!!{foo}" = "$!!{bar}"
    now case insensitive

I’ve been considering making “=” case insensitive by default, and making a “==” operator that’s case sensitive.

Perfect – thanks again for all your help!

I’m presuming that you can use a user-entered variable as an evaluated label for a goto – such as:

*goto !!{foo}

and if foo was “me” or “ME” or “mE” then this code would jump to

*label ME

-d-

*goto is already automatically case insensitive, so you don’t need (can’t use) “!!” like that.