[i7] cmd.cmd + player consenting = go north

The code below attempts to give a hint if the player is stuck.

[code]“zzzzn” by Andrew Schultz

room 1 is a room.

room 2 is a room.

every turn:
if the remainder after dividing the turn count by 5 is 0:
say “[number of words in the player’s command] Want a hint?”;
if the player consents:
say “THERE IS NO SOLUTION.”;
else:
say “Ok.”;
say “[the number of words in the player’s command] test.”;
if the number of words in the player’s command < 1:
say “Rejecting.”;
reject the player’s command;

test me with “z/z/z/z/z/z/n”

test me2 with “x me/x me/x me/x me/x me/x me/x me”[/code]

It works okay if you use the tests. But z.z.z.z.z.z.z then, at the hint poke, n makes you go north.

The practical use case here would be a player wandering around a big world and typing n.e.e etc.

This looks like it may be related to another Inform bug I asked about in this forum, but my question is, how can the programmer force Inform to see the n as yes/no and not a command if the player uses z.z.z.z? Is there a good easy way?

Thanks!

I think you’re running into the combination of a bug and a misunderstanding.

The handling of “player consents” questions is completely outside of the parser. It pauses the current action to ask the question. If you’re in the middle of the “z.z.z.z.z.z.z” sequence, it pauses that, but does not interrupt it.

(Your attempt to do “reject the player’s command” is useless; that only works in a “reading a command” activity rule.)

The fact that the player’s “n” response overwrites the original command buffer is a bug, I think. (A very old bug.)

Cool, thanks–I probably should know what rejecting the command means, but it triggered something, I looked into it a bit and I found a workaround.

For the curious, it’s

[code]“zzzzn” by Andrew Schultz

room 1 is a room.

room 2 is a room.

dont-north is a truth state that varies.

every turn:
now dont-north is false;
if the remainder after dividing the turn count by 5 is 0:
say “[number of words in the player’s command] Want a hint?”;
if the player consents:
say “THERE IS NO SOLUTION.”;
else:
say “Ok.”;
now dont-north is true;
say “[the number of words in the player’s command] test.”;

check going north when dont-north is true:
now dont-north is false instead;

test me with “z/z/z/z/z/z/n”

test me2 with “x me/x me/x me/x me/x me/x me/x me”[/code]

This presents a few other problems, like what to do if there is another yes/no, but it’s good enough.