[if text is xxxxx] - inform7

Hi everybody! I’m writing an IF with inform7 and I need to add the action playing. I tried to write this

playing is an action applying to one topic.
	understand "play [text]", "play with [text]" as playing.
	report playing:
		say "[if text is xxxxx]first sentence[else]second sentence[end if]";

but he gives me this error

what is the problem???
thank you very much! bye!

I may be wrong, but I think it’s

If the topic understood is "xxxx":

You might be better served, however, making your “play” action apply to ‘one touchable thing’ because it makes more sense to PLAY [A THING]". I can’t think of a situation where a physical object (theoretically) wouldn’t be involved in playing. (I mean…well…music…but that’s easily objectified physically in the world model.)

[code]Playing-on is an action applying to one touchable thing. Understand “play [something]” and “play on [something]” and “play with [something]” as playing-on.

An instrument is a kind of thing.

Music is a kind of thing. one music is part of every instrument. The description of music is usually “This instrument will probably make pleasant sounds after a good number of years in a costly graduate music program.”

a boardgame is a kind of thing.

A flute is an instrument in music room. A xylophone is an instrument in music room.

a boardgame called “Monopoly” is in the game room.

Check playing-on:
if the noun is not an instrument or the noun is not a boardgame:
say “That doesn’t seem like very much fun to play with.” instead.

Check playing-on:
if the noun is music:
if the noun is part of a thing (called the emitter):
try playing-on the emitter instead.

After playing-on the flute:
say “You toodley-too on the flute!”

After playing-on the xylophone:
say “You tinkity-tink! on the xylophone.”

After playing-on a boardgame:
say “You rolled doubles!”[/code]

I was talking about playing “games”, maybe card games, like

[code]>play poker

play bridge
play blackjack[/code]

One way to do that would be to make games a value and have the action apply to them:

[code]A card game is a kind of value. The card games are poker, bridge, and blackjack.

Playing is an action applying to one card game. Understand “play [card game]” as playing.[/code]

…and then you would refer to the game the player entered as “the card game understood.” (I haven’t tested this so I might have messed up.)

BTW, Hanon is right about “the topic understood” being the way to refer to the text in an action applying to one topic. Another issue with your initial formulation is that you can’t use quotation marks in [if…] conditionals; you’d have to write out the if and say statements on separate lines.

Ah ok ok so it should be

playing is an action applying to one topic.
   understand "play [text]", "play with [text]" as playing.
   report playing:
      if the topic understood is "xxxxx":
           say "first sentence";
      else:
           say "second setence".

thank you both very much!

That looks good, except that your “report playing” rule needs to start at the left margin (that is, you’ve got a tab stop before the first line and you shouldn’t). Then every other line should be moved to the left one tab, to keep the relative indentation within the rule.

Ah yes I always wrong it :laughing: thank you!