multiple commands per line

Sorry if this has been covered before, I couldn’t find a satisfactory answer searching the forums. Is there any way to disable multiple commands per line? Specifically, I want to prevent:

Instead I want to force the player to type each command on a separate line. Is the period (.) the only token that will separate commands? I noticed the comma and semi-colon do not work in inform 7. If so, would it be sufficient to simply crop everything the player typed after the first period found in a “After reading a command:” statement?

Period and “then” can separate commands. Probably the cleanest way would be to disable it at the parser level, by redefining THEN1_WD and the other constants; I believe there’s an extension that does this already?

I did this once:

[code]First after reading a command when the player’s command includes “then”:
say “Sorry, but it looks like you’ve chained more than one command together with the word ‘THEN.’ This game doesn’t support that feature.”;
reject the player’s command.

First after reading a command when the player’s command matches the regular expression “.”:
say “Sorry, but it looks like you’ve chained more than one command together with periods. This game doesn’t support that feature.”;
reject the player’s command.[/code]

(Andrew Schultz gave me the second half of that code.)

Commas do work, at least for me. Is this interpreter dependent? It’s a nuisance, because commas are part of the command syntax for addressing NPCs.

You’re right!

This seems like it’d take a little more than just changing THEN1_WD etc., because the comma is coded into the parser as comma_word, and you can’t mess with that without messing with the standard syntax for the comma. Looking at a passage like this, from Parser.i6t:

[code] else {

            ! If the player has entered enough already but there's still
            ! text to wade through: store the pattern away so as to be able to produce
            ! a decent error message if this turns out to be the best we ever manage,
            ! and in the mean time give up on this line

            ! However, if the superfluous text begins with a comma or "then" then
            ! take that to be the start of another instruction

            if (wn <= num_words) {
                l = NextWord();
                if (l == THEN1__WD or THEN2__WD or THEN3__WD or comma_word) {
                    held_back_mode = true; hb_wn = wn-1;
                } else {
                    for (m=0 : m<32 : m++) pattern2-->m = pattern-->m;
                    pcount2 = pcount;
                    etype = UPTO_PE;
                    break;
                }
            }

[/code]

it seems to me that that might be one of the things that one might need to change. But I’m not sure how you’d do it. (There are a couple other places where there’s a check on THEN1__WD or THEN2__WD or THEN3__WD or comma_word which probably indicates that this is going on.)

If there isn’t an extension out there that does this, you could try this:

[code]First command read is a truth state that varies.

After reading a command: Now First command read is false.

First Every Turn: Now First command read is true.

First Every Turn when First command read is true: rule fails.

First Before when First command read is true:
say “You can’t execute more than one command per turn, so I am ignoring the rest.”;
stop the action.[/code]

though this might mess with some turn sequence stuff, since I think the turn sequence rules and that sort of thing will still run for the suppressed commands. So you’d have to be careful with it.

Hey, I found a bug while messing around with commas (this is entirely irrelevant).

"Jumping the Jump" by JRB

The Gymnasium is a room. Mr Jump is a man in the Gymnasium.
A persuasion rule for asking Mr Jump to try doing something: persuasion succeeds.

Please do report that on the bug tracker!

Thanks for the suggestions. Interesting about the comma - certainly makes this more challenging.

What if the snippet of code from matt w above was changed to

[code] else {

            ! If the player has entered enough already but there's still
            ! text to wade through: store the pattern away so as to be able to produce
            ! a decent error message if this turns out to be the best we ever manage,
            ! and in the mean time give up on this line

            ! However, if the superfluous text begins with a comma or "then" then
            ! take that to be the start of another instruction

            if (wn <= num_words) {
                l = NextWord();
                    for (m=0 : m<32 : m++) pattern2-->m = pattern-->m;
                    pcount2 = pcount;
                    etype = UPTO_PE;
                    break;
            }[/code]

basically making the existing “if (l == THEN1__WD or THEN2__WD or THEN3__WD or comma_word)” statement always read false. Where would I make this change in an Inform 7 project? This is a tad over my head. I tried making it an “auto.inf” file in my “.inform” package but the change didn’t stick.

You’d want to use an “Inform 6 Replacement”, basically instructing Inform to overwrite a section of the standard library with this new code. This is a really specialized part of I7 that is almost never necessary, and once the code’s been written once you can usually forget about it.

Yes, that winds up looking something like this (for a totally different thing):

Include (- [ PSN__ o i; if (o == 0) { LIST_WRITER_INTERNAL_RM('Y'); rtrue; } switch (metaclass(o)) { Routine: print "<routine ", o, ">"; rtrue; String: print "<string ~", (string) o, "~>"; rtrue; nothing: print "<illegal object number ", o, ">"; rtrue; } RegardingSingleObject(o); if (name_cached == true) !if we cached the name, we print it and reset the name_cached flag { PrintCachedName(); name_cached = false; } else !otherwise we carry out the standard printing the name activity CarryOutActivity(PRINTING_THE_NAME_ACT, o); ]; -) instead of "Object Names I" in "Printing.i6t".

In this case most of the code is copied from the original extension, only the part with exclamation-marked comments is changed.

I should point out that the part I pointed out is only one place where you’d have to change it; there are other parts that would have to be changed. And I’m not sure exactly how it would work; this is a part of the parser that I don’t have much confidence messing with. (Well, I don’t have much confidence messing with any of the parser.) This may be a tricky area.

I’ve never had any success setting up an account there. I’ll try again, I guess.

I think it’s really a bug with “go” rather than conversation.