Multiple Results Due to One Action- how to do?

Hey All- total newbie here. I’ve searched the Inform documentation, this site, and Jim Aikin’s handbook, but I couldn’t find anything on my question- most likely because I’m not thinking of the correct terminology to search for. So if anyone can point me to where in the documentation I can find this (or just give me an answer), I’d be most grateful.

I have a situation where examining a mirror breaks it. X mirror → it breaks.
Of course then I’d like to remove the mirror from play. But I also want to expose a photograph hidden behind the mirror, so I want to move the photograph to the current location (Shadowy place). I have a photo already listed (“There is a photo” and description), so all I have to do it move it into the room to make it visible.

This works for the photo:
After examining mirror, move the photograph to Shadowy place.

And this works for the mirror:
After examining mirror, remove mirror from play.

But I can only have one or the other (whichever I list first), and I can’t seem to find a way to say “and” between them. I’ve tried too many things to list, and only the first command I list will happen, or I generate an error.

I know there’s a way to say “After examining mirror, do this AND that” but I just can’t find it. Help & thanks!

I believe you need a colon instead of the comma, and then you separate the commands by semicolons, and only put a period when you’re all done?

After examining mirror: move the photograph to Shadowy place; remove mirror from play.

THANK YOU! Can you direct me to some documentation that lays out the rules for punctuation? There’s a punctuation page in the documentation, but it wasn’t helpful for this and it doesn’t seem to just lay out the rules.

The Making Rules bit of Writing with Inform I think lays out what you’re looking for, and that combined with the Punctuation section you mentioned gives you most of what you need to know in general – though of course there’s specific syntax required for particular purposes as you get more complex. But finding the topic in Writing with Inform, or an example in the Recipe Book, is usually not too hard – or just coming here, of course!

I will say that you probably want to get into the habit of nesting your rules, like so:

After examining mirror: 
   move the photograph to Shadowy place; 
   remove mirror from play.

Once you start using conditions and other more complex syntax, it’ll be harder to see what’s going on where you’re debugging, and you can run into compiler errors, if you try to cram everything onto one line.

One thing I found super helpful when I was learning Inform last year was looking at the source code of some released games, since then you can see how a game actually works and notice if there are things about how they do something that doesn’t make sense. IFDB allows you to search for games tagged as having I7 source available, so that makes it easy.

Hope this was helpful!

1 Like

I ran into the same issue when creating if/else conditionals with multiple actions. The solution was the correct use of colons, semicolons, and periods stated above.

Thanks so much, everybody!
I’m picking my way through the entire documentation, but sometimes it’s hard to know exactly where I’ll find the rule I’m looking for, and the documentation is LONG. And my notes from it are disorganized, of course.
And most frustrating is trying to find the right search term to find something in the documentation. Sometimes it comes right up; sometimes I just can’t get the keywords right to find the correct page.
It’s awesome how helpful and responsive this community is!

1 Like

@AmandaB I found the General Index very helpful when searching for some programming concept or topic.

1 Like

Yeah, I think the general index is really helpful, though it’s often overlooked – in the in-application documentation, it’s accessed via a small button in the upper-right of the Documentation tab, and if you’re using the online version, you need to go to the index of examples before a link to it comes up.

FWIW, my experience learning Inform was that it was worth reading through the first seven chapters, and then just dipping into the rest as I got interested in a particular topic or tried to troubleshoot a roadblock. Everybody learns differently, of course! But for me, that struck a good balance between giving me a solid grounding in the language and feeling like I was just reading a textbook.