Understanding end story conditionals

#1

Hi,

I want the game to end when the player is in a certain room AND variable counter value is equal to 7.

I have quest_count is a number that varies, and I increase this every time the player performs one of the quests, but I can’t get the end story syntax right to make it conditional on both the count being 7 AND player being in a certain room.

Thanks.

0 Likes

#2

Maybe this:


The hallway is a room. The description is "A hallway cluttered with nothing."

The bedroom is north of the hallway. The description is "Smells like teen spirit."

The livingroom is east of the hallway. The description is "An empty living room."

quest_count is a number that varies.

Instead of going to the bedroom for the first time:
	increment quest_count;
	say "Your quest score went up to [quest_count]";
	continue the action.
	
Instead of going to the livingroom:
	if quest_count is 1:
		end the story saying "Huzzah!";
	else:
		continue the action.

Example output:

hallway
A hallway cluttered with nothing.

>e

livingroom
An empty living room.

>w

hallway
A hallway cluttered with nothing.

>n
Your quest score went up to 1
bedroom
Smells like teen spirit.

>s

hallway
A hallway cluttered with nothing.

>e


    *** Huzzah! ***



Would you like to RESTART, RESTORE a saved game, QUIT or UNDO the last command?
0 Likes

#3

Perfect. Thank you!

0 Likes