intfiction.org

The Interactive Fiction Community Forum
It is currently Sun May 19, 2013 9:14 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Thu Mar 29, 2012 9:51 pm 
Offline

Joined: Thu Mar 29, 2012 9:34 pm
Posts: 2
I am developing an IF game for a major school project. In the development of the game I have run into several issues. I am creating this topic so I can seek help on them.

Problem the First:

I am trying to get a device to give two different text outputs when it contains two different items and another if it's empty.
This is my current code for the device (with a few substitutions of names and results):
Code:
Every turn when the location of the player is the location of the Cassette Player:
   if the Cassette Player contains the White Cassette Tape:
      say "White Tape output.";
   else:
      if the Cassette Player contains the Green Cassette Tape:
         say "Green Tape output.";
      otherwise:
         say "Empty output." .

The Cassette player has a capacity of 1 so having both tapes in is not a problem.

Is there something simple I'm overlooking?


Top
 Profile Send private message  
 
PostPosted: Thu Mar 29, 2012 9:58 pm 
Offline

Joined: Fri Mar 09, 2012 3:42 pm
Posts: 62
Depends on what you mean by "text output". If you mean the description you get when you examine the cassette player, you'd just do something like this:

Code:
The description of the cassette player is "[if the cassette player contains the white cassette tape]foo[otherwise if the cassette player contains the green cassette tape]bar[otherwise]bluh[end if]."


If you're talking more like an ambient sound that you want to play whenever the player can hear the cassette tape, the code you've got should work, but the syntax would be more like this:

Code:
Every turn while the cassette player is visible:
   if the Cassette Player contains the White Cassette Tape:
      say "White Tape output.";
   otherwise if the Cassette Player contains the Green Cassette Tape:
      say "Green Tape output.";
   otherwise:
      say "Empty output."


However, to be really thorough, I'd do something like this:

Code:
A recording medium is a kind of thing. A recording medium has a text called a recorded message.

The white cassette tape is a recording medium. It is in the starting room. The recorded message of the white cassette tape is "This is the white tape's recorded message."
 
The green cassette tape is a recording medium. It is in the starting room.

The Starting Room is a room.
 
The cassette player is an openable container in the starting room. The carrying capacity of the cassette player is 1.
 
Check inserting into the cassette player:
   if the noun is not a recording medium:
      say "That doesn't fit.";
      stop the action.
   
Every turn while the cassette player is visible:
   if the cassette player contains a recording medium (called the tape):
      if the recorded message of the tape is not "":
         say the recorded message of the tape;
      otherwise:
         say "You hear only a hiss of static."


Last edited by David J Prokopetz on Thu Mar 29, 2012 10:11 pm, edited 2 times in total.

Top
 Profile Send private message  
 
PostPosted: Thu Mar 29, 2012 10:08 pm 
Offline

Joined: Thu Mar 29, 2012 9:34 pm
Posts: 2
Thank you.


Top
 Profile Send private message  
 
PostPosted: Wed Apr 04, 2012 8:33 am 
Offline

Joined: Fri Jul 16, 2010 2:09 pm
Posts: 1950
A point of style: a text that is equal to "" can be described as empty, e.g.

Code:
if the recorded message of the item described is not empty:


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

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 2 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