Ensure no parser responses during sleeping scene

I’ve got a sleeping scene, which I’ll set out below (with some irrelevant bits removed). When the player types any command it responds with snoring. But if the parser doesn’t like the command then it’ll say something like “That’s not a verb I recognise” or “You can’t see any such thing”. How do I turn that off, so that the response to any text at all is always “zzzzzzzzzzzzzzzzz”?

Dozing is scene. Dozing begins when play begins. Dozing ends when the turn count is 4.

Instead of doing anything while Dozing is happening:
	say "zzzzzzzzzzzzzzzzz[line break]".

When Dozing ends:
	say "..."

Thanks.

I haven’t tested this but from the documentation, looks like you should be able to do this by writing a rule about “issuing the response text of a response” (see the last section of the doc).

1 Like

That’s great, thanks. Here’s what seems to work:

Before issuing the response text of a response (called R) during Dozing: 
	now R is "zzzzzzzzzzzzzzzzz".

That way you should be able to replace all the parser error messages with “zzzz…”, but it would mess up the timings (since a parser error is still happening behind the scenes, the turn counter won’t advance). If the exact timing is important (i.e. you always want dozing to last exactly four turns), you could try something like this (also untested):

After reading a command while Dozing is happening:
    say "Zzzzzzzzz...";
    increase the turn count by 1;
    follow the scene changing rules;
    reject the player's command.
1 Like

That method seems to work perfectly. Just as you sent it, I was clarifying that the first method almost worked, as “examine” on its own printed “(the suggested item)” before the zzz, and Dozing is potentially endless.

I don’t know what “follow the scene changing rules” does but if it works it works!

Thanks to both of you :+1:

“The scene changing rules” are an internal rulebook that is responsible for ensuring that scenes begin and end when they’re supposed to (like your dozing scene ending when the turn count is 4). Normally, Inform takes care of running those every turn, but since we cut off the entire turn sequence by writing “reject the player’s command”, we need to do it ourselves here.

Thanks. There was one final (to my knowledge) problem, which was the “I beg your pardon?” response, which I got rid of using this new-found knowledge!

Rule for printing a parser error [when the latest parser error is the I beg your pardon error]: 
	if Dozing is happening:
		do zzz;
		increase the turn count by 1;
		follow the scene changing rules;
	otherwise:
		continue the action.

What happens if the player uses a metacommand, like “save” or “quit”, while the sleeping is going on?

It might not be a major problem if the number of turns control is removed is small, but…

(edit: punctuation)

That’s a very good point. The Dozing scene is right at the start and only for three turns, but it would be frustrating, say, not to be able to restore a game straight away. I don’t know a shorthand for the out of world actions so have changed it to the following:

After reading a command while Dozing is happening:
	unless the player's command matches "quit/q/save/restore/restart/verify/script/transcript/version/score/superbrief/short/verbose/long/brief/normal/notify/nouns/pronouns/help/hint" or the player's command matches the regular expression "script on|transcript on|script off|transcript off|notify on|notify off":
		do zzz;
		increase the turn count by 1;
		follow the scene changing rules;
		reject the player's command.

If nothing else is happening and the scene only happens right at the start of the game, you’re probably just complicating matters by implementing it as a scene at all. Just increment the turn count in ‘After reading a command’ and print “zzzzzzz” and reject the player’s command until it reaches a certain value…

After  reading a command:
	unless turn count is at least 4:
		increment turn count;
		say "zzzzzz.";
		reject the player's command.
1 Like

Sorry for creating such a scene :slight_smile: and thanks for the help.

Here’s what I’ve ended up with… so far anyway…

[Avoid "I beg your pardon?" and maybe others]
Rule for printing a parser error: 
	if turn count <= 3: 
		doze;
	otherwise:
		continue the action.

[Ignore commands]
After reading a command:
	if turn count <= 3 and it's an ordinary command: 
		doze;
		reject the player's command.

To decide whether it's an ordinary command:
	if the player's command matches "quit/q/save/restore/restart/verify/script/transcript/version/score/superbrief/short/verbose/long/brief/normal/notify/nouns/pronouns/help/hint" or the player's command matches the regular expression "script on|transcript on|script off|transcript off|notify on|notify off", decide no;
	decide yes.

To doze:
	if turn count <= 2:
		say "zzzzzzzzzzzzzzzzz[line break]";
	if turn count is 3:
		say "You wake up (etc...)";
	increase the turn count by 1;
1 Like