I really didn’t want to have to post here again so soon, but I’ve run into a problem. I’m finishing up my test project to try to get used to Inform 7 and I ran into a problem. Tonight I decided to test out custom actions. I decided to implement the mostly pointless action Dancing. It looks like this:
[code]Dancing is an action applying to nothing.
Understand “dance” as dancing
Carry out dancing:
say “You start dancing wildly, despite the lack of music. You’re not very good.”[/code]
That works fine, just as intended. Type dance, you dance wildly and not very well. But, I thought, what if a room has music? (Or, in the case of my production game when I start it, what if I want an action to work differently in a specific room?) I decided one of my test rooms would have music, thus dance should work differently there. This is where I have problems. It looks as such:
The Main Bedroom is a room. "You are in your bedroom. It's a rather messy place, really. There's a pile of dirty clothes attempting to gain sentience in the corner. There's also an ancient looking stereo in the corner. West leads to a hall."
Instead of dancing if the location is the main bedroom:
say "You turn on the stereo and start headbanging to the music. Unfortunately, the stereo somehow got set to the soft rock station. You find yourself headbanging to Phil Collins."
The problem is with the “Instead of Dancing” line. The (relevant) part of the error I get is: " the punctuation here ‘:’ makes me think this should be a definition of a phrase and it doesn’t begin as it should, with either ‘To’ (e.g. ‘To flood the riverplain:’), ‘Definition:’, a name for a rule (e.g. ‘This is the devilishly cunning rule:’), ‘At’ plus a time (e.g. ‘At 11:12 PM:’ or ‘At the time when the clock chimes’) or the name of a rulebook, possibly followed by some description of the action or value to apply to (e.g. ‘Instead of taking something:’ or ‘Every turn:’)."
It works (sort of) if I truncate the first line to “Instead of dancing:” … but then the Dance command doesn’t work at all anywhere else. (Presumably because the player isn’t in the main bedroom there’s nothing to do.) What I have above seems like it should work. I spent a solid hour researching, looking through documentation, etc. This looks like it should work, and it doesn’t. I have a good bit of programming experience and always thought I could program in any language as long as I had a reference. Well, I have a reference and I can’t make something incredibly simple work. It gets annoying.
Anyway, what’s wrong here? Any ideas?