intfiction.org

The Interactive Fiction Community Forum
It is currently Fri Feb 22, 2019 12:25 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Tue Jan 15, 2019 10:35 am 
Offline

Joined: Fri Oct 06, 2017 8:19 am
Posts: 35
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.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Tue Jan 15, 2019 12:51 pm 
Offline
User avatar

Joined: Sun May 21, 2017 4:59 pm
Posts: 331
Location: Michigan
Maybe this:

Code:

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:

Code:
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?

_________________
~~~
My ebooks on Amazon
My ebooks on Smashwords


Top
 Profile Send private message  
Reply with quote  
PostPosted: Tue Jan 15, 2019 1:01 pm 
Offline

Joined: Fri Oct 06, 2017 8:19 am
Posts: 35
Perfect. Thank you!


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 14 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group