# Inform 7 - Desc using if containing two possible values

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:

``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.

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.

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?

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].”[/code]
Error:

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

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.