Getting Input

I’m over here, hacking at the innards of inform.

When using ‘if the player consents’, I want 1 and 2 to also be valid. I have this line:

if (i == YES1__WD or YES2__WD or YES3__WD or "1") rtrue;

Which does not pick up 1 at all. How would I make it work?

Here’s the full section:

[ YesOrNo i j; PrintText((+ yes or no message +)); for (::) { #Ifdef TARGET_ZCODE; if (location == nothing || parent(player) == nothing) read buffer parse; else read buffer parse DrawStatusLine; j = parse->1; #Ifnot; ! TARGET_GLULX; KeyboardPrimitive(buffer, parse); j = parse-->0; #Endif; ! TARGET_ if (j) { ! at least one word entered i = parse-->1; if (i == YES1__WD or YES2__WD or YES3__WD or "1") rtrue; if (i == NO1__WD or NO2__WD or NO3__WD or "2") rfalse; } PrintText((+ yes or no message +)); } ]; -) instead of "Yes/No Questions" in "Parser.i6t".

In that line, i is a dictionary word, not a string. Single-quotes, not double-quotes. (Look at the definitions of YES1__WD etc.)

You also need to remember that a single-character dict word needs to look like ‘1//’ – the // distinguishes it from a character constant.

So:

     if (i == YES1__WD or YES2__WD or YES3__WD or '1//') rtrue;

Worked fantastically, thank you.