intfiction.org

The Interactive Fiction Community Forum
It is currently Sat May 25, 2013 8:52 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Wed Feb 09, 2011 10:26 pm 
Offline

Joined: Thu Dec 10, 2009 10:22 pm
Posts: 4
Hey folks, got a bit of a problem here.

The idea is simple enough, there is a light swinging back and forth and depending on the position of the light the description of the thing "underneath it" changes.

Half way through one side of the arc of the swinging light is an item, so it stands to reason that the item is lit twice by the swinging lamp (see diagram). Each turn the lamp moves one "step" further in its arc, changing a variable tied to the player simply called PuzzleNumber. A complete arc (point A and back to A) takes 6 turns, then PuzzleNumber is reset to 1.

Diagram:
Arc of lamp illustrated using the PuzzleNumber corresponding to each section of the arc (Item placed at point 1&3)

(2) ------ (1 & 3) ------ (4 & 6) ------ (5)


Here is what I have written:

Code:
A large wine cask with a torn off label is scenery in the Cargo Hold. "[if the PuzzleNumber of the player is not 1 or 3]You can only see the faint outline of the wine cask in the dark[else]The large wine cask has been secured with ropes, preventing it from moving. The label of the cask has been torn off and you cannot see what is written on the piece still stuck to the cask from your current position[end if]."


Inform 7 tells me " I was expecting that 'PuzzleNumber of the player is not 1 or if the PuzzleNumber of the player is not 3' would be a condition. It didn't make sense as one long phrase, but because it was divided up by 'and'/'or', I tried breaking it down into smaller conditions, but that didn't work either. 'PuzzleNumber of the player is not 1' was okay; 'if the PuzzleNumber of the player is not 3' did not make sense; so I ran out of ideas."

Do I have to write a separate if statement for each of the possible numbers of the variable? I just want to make some compact code, when I get a long list of if statements it just gets chaotic (especially as I cannot comment inside quotation marks to note what each if corresponds to). It works perfectly when I simply give one value for the PuzzleNumber in the if statement.

Thank you in advance for any help.


Top
 Profile Send private message  
 
PostPosted: Wed Feb 09, 2011 10:43 pm 
Offline

Joined: Tue Mar 09, 2010 2:34 pm
Posts: 2129
Location: Burlington, VT
I haven't checked this, but try "If the puzzlenumber of the player is not 1 and the puzzlenumber of the player is not 3." This is a bit tricky, since a lot of the syntaxes that would be natural in English don't work, but I think "If [whole sentence] and [whole sentence]" usually works.


Top
 Profile Send private message  
 
PostPosted: Thu Feb 10, 2011 11:53 am 
Offline

Joined: Thu Dec 10, 2009 10:22 pm
Posts: 4
matt w wrote:
I haven't checked this, but try "If the puzzlenumber of the player is not 1 and the puzzlenumber of the player is not 3." This is a bit tricky, since a lot of the syntaxes that would be natural in English don't work, but I think "If [whole sentence] and [whole sentence]" usually works.


And tricked by the Pod-Person programing language of inform yet again, that works like a charm. Thank you so much. Was tearing my hair out having to maintain several different if statements with the same text. :D


Top
 Profile Send private message  
 
PostPosted: Thu Feb 10, 2011 12:08 pm 
Offline

Joined: Tue Mar 09, 2010 2:34 pm
Posts: 2129
Location: Burlington, VT
Glad I could help!

What confuses/intrigues me is the error message you got -- it looks like the I7 compiler is trying to turn "if the PuzzleNumber of the player is not 1 or 3" into "if PuzzleNumber of the player is not 1 or if the PuzzleNumber of the player is not 3." Can any more knowledgeable folk explain what's happening there?


Top
 Profile Send private message  
 
PostPosted: Thu Feb 10, 2011 2:19 pm 
Offline

Joined: Tue Jan 22, 2008 5:55 am
Posts: 841
Location: The Netherlands
Hm, I get a very different (and much more expected) error. Code:
Code:
Cargo Hold is a room.

A person has a number called the PuzzleNumber. The PuzzleNumber of a person is usually 1.

Every turn:
   increase the PuzzleNumber of the player by 1;
   if PuzzleNumber of the player is 7:
      now PuzzleNumber of the player is 1.

A large wine cask is scenery in the Cargo Hold. "[if the PuzzleNumber of the player is not 1 or 3]You can only see the faint outline of the wine cask in the dark[else]The large wine cask has been secured with ropes, preventing it from moving. The label of the cask has been torn off and you cannot see what is written on the piece still stuck to the cask from your current position[end if]."

Error:
Quote:
In the sentence '"[if the PuzzleNumber of the player [...] rom your current position[end if]."'  , I was expecting that 'PuzzleNumber of the player is not 1 or 3' would be a condition. It didn't make sense as one long phrase, but because it was divided up by 'and'/'or', I tried breaking it down into smaller conditions, but that didn't work either. 'PuzzleNumber of the player is not 1' was okay; '3' only made sense as a value, which can't be used as a condition; so I ran out of ideas.

I really don't understand how Redux could have gotten that particular error message?


Top
 Profile Send private message  
 
PostPosted: Thu Feb 10, 2011 2:40 pm 
Offline

Joined: Tue Mar 09, 2010 2:34 pm
Posts: 2129
Location: Burlington, VT
Well, one possibility is that s/he tried "if PuzzleNumber of the player is not 1 or if the PuzzleNumber of the player is not 3," which would also be natural in English, and accidentally pasted in the error message for that.


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

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 0 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:  
cron
Powered by phpBB® Forum Software © phpBB Group