Moving from Room to Room

Hey guys, I’m new at interactive fiction writing and I’m using Imform 7 for the first time. I’m enjoying it and I’m hoping to write a simple IF game. So I need some help in my story. I want to allow the player to go go to a different room. Here is what I wrote:

After eating the mushroom:
say “As you pop the little musshroom into your mouth, your stomach twists in nervousness. You knew very well what would happen to you if you had made the wrong decission. But as you tentatively chewed it, you were surprised to find that it was sweet and not at all bad. Eagerly, you gathered more and stuffed them in your shorts poket to keep for later After your hunger has been satisfied, you decided to explore the clearing further. You see something to the east…”

The cave is a room. It is east from the rorest. “As you head east, you see that it’s the enterance to a cave of unsure death. Water dripp don and echoed throughout the rock cavern you are in. As your eyes adjust to the darkness, you see that the cave wall is covered by a fine layer of moss and algae.”

I want the player to go east from where the mushroom is so that they will get to the cave. What I wrote didn’t work. Would any mind helping me out? Thanks! :stuck_out_tongue:

PS: I forgot to say that my first room is the “Island” and I want the player to get to the second room “The cave”. Thanks again :stuck_out_tongue:

I guess you meant to write “Forest”? Or “Island”, if that is the name of your first room.

This would create a room called “rorest” and place the cave east of it. Check your “Index” tab and the “World” tab within that after compiling, and you’ll see a map showing the rooms you’ve made. As Victor indicated, you probably want to say “The cave is a room. It is east from the Island.”

Also: be careful with including travel in room descriptions. The game will keep on saying “As you head east …” every time the player types LOOK in that room.

A couple of points:

First, if you’ve defined your first room as the “Island,” then you need to place the cave east of the island, not the forest.

Second, in your “after eating the mushroom rule,” if you want to use the colon style I think you need to indent (via a tab character) the line which begins “say …” Alternatively, you can do the whole rule as a single sentence, using a comma instead of the colon. Also, I believe that, by default, an “after” rule does not stop the action, so in addition to your custom message you would also get the standard “eaten” message. If you don’t want that you need to use a “stop the action” phrase after your custom message.

Third, under this approach, the player can go from the island to the cave even before eating the mushroom; eating it simply tells him about the room to the east, but the connection exists anyway. If you want to block access until he’s eaten the 'shroom, you need to use a different approach.

Robert Rothman

Well i tried doing the room thing, but it still didn’t work. What am I doing wring? This is what I wrote:

After eating the mushroom:
say “As you pop the little musshroom into your mouth, your stomach twists in nervousness. You knew very well what would happen to you if you had made the wrong decission. But as you tentatively chewed it, you were surprised to find that it was sweet and not at all bad. Eagerly, you gathered more and stuffed them in your shorts poket to keep for later After your hunger has been satisfied, you decided to explore the clearing further. To the east you see a cave opening…”

The cave is a room. It is east from the island… “After a while, you see that it’s the enterance to a cave of unsure death. Water dripp don and echoed throughout the rock cavern you are in. As your eyes adjust to the darkness, you see that the cave wall is covered by a fine layer of moss and algae.”

And this is what Imform showed when I pressed Go:

eat
(the mushroom)
As you pop the little musshroom into your mouth, your stomach twists in nervousness. You knew very well what would happen to you if you had made the wrong decission. But as you tentatively chewed it, you were surprised to find that it was sweet and not at all bad. Eagerly, you gathered more and stuffed them in your shorts poket to keep for later After your hunger has been satisfied, you decided to explore the clearing further. To the east you see a cave opening…

e
You can’t go that way.

Why didn’t it give me an error message, but not allow me to go to the cave?

I’m really sorry, I’m never good with this stuff, but our school needs us to use this. Sorry for sounding like an idiot.

Whatever room you define first in your code will be the room the player starts in (unless you override that by saying “The player is in” whichever room). Assuming what you’ve posted is the entirety of your code, the parts that define rooms are: The cave is a room. It is east from the island. The first sentence tells Inform to make a room called the cave, and is, of course, the most straightforward way to make a room. When Inform reads the second sentence, it assumes that you mean “the island” to also be a room, so it makes “the island” as well. Which is all fine and good, except that now the starting room is the cave.

Either you need to define the island first, like so: The island is a room before any other room-defining code, or (if you’re likely to change around the order of your code, or you’re not totally sure what other code defines rooms), simply declare that The player is in the island. Declarative statements like that, outside of rules and without using “now,” are how you can make things true at the beginning of play.

By the way, since you don’t have any code blocking off the cave before the player eats the mushroom, the player can just wander east whenever they like. This recent thread: https://intfiction.org/t/closing-a-room-until-the-right-time/3218/1 might point you in the right direction for fixing that.

If you put “code” tags around your code, it will display better in your post, with tabs and whatnot. Also, it’s helpful to post a complete example that demonstrates your problem so other people can try it out.

This is everything I’ve done so far:

The island is a room. “You have no idea what happened, all you know is that you are suddenly on a tropical island and you need to find your way home. The only problem is that you remember nothing beyond your name.The island is in an irregular shape, Behind you, you hear the washing of the waves on to the beach and birds sang in the trees all around you. The beach you stand on is the eastern side and to the west is the forest.”

Forest is west. “The path you start down is narrow and long grass brush against your leg making it hard to walk. All you see round you are trees and sometimes, a splash of bright color as a bird sped past. As you contine on, you come to a deer trail that will bring you deeper into the forest. The deer trail is northwest of where you are.”

The deer trail is northwest. "The trail soon brings you to a clearing ringed by trees. The sun is blocked out by the thick canopy and you look around curiously. "

A mushroom is here. It is edible. “The mushroom growing on a fallen trunk is of a brownish white color and you think it might be safe to eat. You vaguely remember that most mushrooms that aren’t of a bright color are usually safe to be consumed.”

After taking the mushroom:
say “You took the mushroom from where it grew with a swift yank then decided to give eating it a go.”

After eating the mushroom:
say “As you pop the little musshroom into your mouth, your stomach twists in nervousness. You knew very well what would happen to you if you had made the wrong decission. But as you tentatively chewed it, you were surprised to find that it was sweet and not at all bad. Eagerly, you gathered more and stuffed them in your shorts poket to keep for later After your hunger has been satisfied, you decided to explore the clearing further. To the east you see a cave opening…”

The cave is a room. It is east from the island. “After a while, you see that it’s the enterance to a cave of unsure death. Water dripp don and echoed throughout the rock cavern you are in. As your eyes adjust to the darkness, you see that the cave wall is covered by a fine layer of moss and algae.”

When the game is run:

island
You have no idea what happened, all you know is that you are suddenly on a tropical island and you need to find your way home. The only problem is that you remember nothing beyond your name.The island is in an irregular shape, Behind you, you hear the washing of the waves on to the beach and birds sang in the trees all around you. The beach you stand on is the eastern side and to the west is the forest.

w

Forest
The path you start down is narrow and long grass brush against your leg making it hard to walk. All you see round you are trees and sometimes, a splash of bright color as a bird sped past. As you contine on, you come to a deer trail that will bring you deeper into the forest. The deer trail is northwest of where you are.

nw

deer trail
The trail soon brings you to a clearing ringed by trees. The sun is blocked out by the thick canopy and you look around curiously.

The mushroom growing on a fallen trunk is of a brownish white color and you think it might be safe to eat. You vaguely remember that most mushrooms that aren’t of a bright color are usually safe to be consumed.

eadtd
That’s not a verb I recognise.

eat
(the mushroom)
(first taking the mushroom)
You took the mushroom from where it grew with a swift yank then decided to give eating it a go.

As you pop the little musshroom into your mouth, your stomach twists in nervousness. You knew very well what would happen to you if you had made the wrong decission. But as you tentatively chewed it, you were surprised to find that it was sweet and not at all bad. Eagerly, you gathered more and stuffed them in your shorts poket to keep for later After your hunger has been satisfied, you decided to explore the clearing further.

e
You can’t go that way.

Would you mind actually writing what I need to put in Imform if it’s not too much trouble? Thanks so much.

To use the code tags, highlight the code that you pasted into your post and then click the “code” button up above the edit window.

As Ghalev suggested, the “world” map in the index can be very helpful to figure out what’s actually going on. Click the “Index” tab along the right of the panel, then click the “world” tab that appears at the top of the panel. You’ll see a map of the world as Inform understands it.

As you’ll see, the cave is to the east of the island, exactly as you stated in your source. And yet when you play the game, you seem to expect that it is east of the deer trail. If that’s what you want, you need to say so.

I didn’t actually realize you could just say “The Forest is west.” Terribly bad practice, of course, since you’ll then have to scroll up to find the previous room you created in order to see what the forest is west from. And because you could only ever code a long daisy-chain of rooms that way.

I want to thank everyone who has taken the time in helping me. Thanks VictorGijsbers, Ghalev, Robert Rothman, tove, capmikee and katz for sticking with me. It’s working now. :slight_smile: I really hope I hadn’t bothered all of you too much and if I have a problem again, I hope you won’t mind helping me again. Thanks again!