Ending the game after reading a command?

The Lost in Rust is a room. The Iron Bark Trees are east of the Lost in Rust.

The rust storm passable is initially false.

The rust storm prepared is initially false.

The cross rust storm committed is initially false.

After reading a command:
	If the player's command includes "follow" and the player's command includes "whistling" and the player is in the Lost in Rust:
		If the rust storm passable is false and the rust storm prepared is false and cross rust storm committed is false:
			now cross rust storm committed is true;
			instead say "You're about to follow a noise inside your head into a storm made of rust. If you're sure about this try that again.";
		Otherwise if the rust storm passable is false and the rust storm prepared is false and cross rust storm committed is true:
			instead end the story saying "Following the whistling alone did little to stop the rust flakes from tearing away your flesh from your bones. You die in a very special kind of agony, one that has a whistling sound to it.";
		Otherwise if the rust storm passable is false and the rust storm prepared is true:
			now the rust storm passable is true;
			try the player going east;

I am trying to have it so that if the player attempts to use a command twice while certain conditions are not met, the story ends.

However, on the second attempt nothing happens and until I try a valid command, such as go east, the end the game does not trigger. If this is due to it being an After rule, how would I change it to work? Do I need to define following and do this whole thing as an action rule?

‘After reading a command’ is not a normal ‘after’ rule. It’s an atypical processing stage coming after the player has typed something but before the parser has processed the command. It’s not the place to run the core machinery of your game, which is how you’ve used it here.

I think reason nothing is happening is because, though you run some code (e.g. ‘instead say yada’) during the After reading a command stage… EDIT - the ‘instead’ means the command isn’t continuing through to the parser, and then I don’t think the every turn rules are running. The game can’t end because the turn didn’t end. That’s why the end is suddenly freed when you then type in a normal command afterwards; time got moving again.

You won’t run into any of these (weird!) problems if you create a Following action and code for it, and then maybe a noun ‘whistling’ which the following action can then act on. Then you’ll be able to write:

Instead of following whistling: (beneath which is all the code you’ve currently got from ‘if the rust storm passable is false…’ onwards)

-Wade

6 Likes

I agree! It is possible to horse around with the text of the player’s command, make your own verb, then trigger it under the hood, but by then you’ve already done more work than you would have were you to make a custom action.

But what you’d really miss out on is the lack of debug support you get from standard action processing. In a large game you’ll want those tools at the ready!

2 Likes

I’m not sure why you’ve chosen to go with an “after reading a command” rule here, since it’s much better to do this via an action instead. Try this.

"Test"

The rust storm passable is initially false. The rust storm prepared is initially false. The cross rust storm committed is initially false.

Following is an action applying to nothing. Understand "follow whistling" as following.

Check following when the rust storm passable is false and the rust storm prepared is false and cross rust storm committed is false (this is the give warning rule):
now cross rust storm committed is true;
say "You're about to follow a noise inside your head into a storm made of rust. If you're sure about this try that again." instead.

Check following when the rust storm passable is false and the rust storm prepared is false and cross rust storm committed is true (this is the end the story rule): end the story saying "Following the whistling alone did little to stop the rust flakes from tearing away your flesh from your bones. You die in a very special kind of agony, one that has a whistling sound to it." instead.

Check following when the rust storm passable is false and the rust storm prepared is true (this is the go east rule):
now the rust storm passable is true;
try the player going east instead.

Check going east from the lost in rust (this is the set storm passable rule): now the rust storm passable is true.

Report following (this is the catch all rule): say "Nothing happens.".

The Lost in Rust is a room. The Iron Bark Trees are east of the Lost in Rust.

Test lose with "follow whistling / follow whistling". Test win with "follow whistling / e / follow whistling".

This should allow the trying to do the same thing twice to end the game and going east to let the game continue as normal.

Hope this helps!

1 Like

Also, quick point.

This part will be true if and only if both “follow“ and “whistling“ are included in the player’s command. While this may be what you were after (“follow whistling”), it’ll also allow commands like “don’t/stop follow whistling“, “whistling follow“ or even “I’m a whistling away follow da lead a lead a lead a“! :laughing: