Having trouble creating scenes

My goal is to make a really simple game where the player goes back and forth between 3 rooms, with different dialogue each time they enter the room. The code I have so far (which isn’t working) is:

house is south of school. “[if the house is unvisited]a two story brick house on a main road. the backyard is littered with trees and a small playground. cars speed past house often, ignoring the speed limit sign. it’s time for school. type ‘n’.[end if][if the house is visited]you are in house. school is to the north.[end if]”

school is west of classroom. “[if the school is unvisited]you’re at school. the walls are white cinderblock and the fluorescent lights tint your skin translucent. the hallways are too small for the number of people that go here. as you make your way through school, you’re shoved around by backpacks and shoulders. type ‘e’ to enter your classroom.[end if][if the school is visited]you are in school. classroom is to the east and the house is to the south.[end if]”

classroom is a room. “[if the Classroom is unvisited]you met a new friend here a few months ago. you have 1st period psych with her and the friend that introduced the two of you. you enter the classroom and they look you up and down, ostensibly annoyed by your presence. you’re sure it’s nothing, but can’t help but feel like they’re angry, like you’ve done something wrong. because of this, you decide to walk home, skipping the rest of your classes. to get back to the school entrance, type ‘w’.”

going back to house is a recurring scene.
going back to house begins when the player is in the house for the second time.
going back to house ends when going back to school begins.
when going back to house begins:
say “you were at school for one class. just go back. type ‘n’.”

going back to school is a recurring scene.
going back to school begins when the player is in the school for the second time. say “back at the enterance. to walk home, type ‘n’.”.
going back to school begins when the player is in the school for the third time. say “back at school. don’t want to be here. don’t know what else to do. you float through the day, make it to 2:30. time to go home. type ‘n’.”;
going back to school ends when going back to house begins.

Hi Mitskileeks. I had a similar question about scenes not too long ago. It looks like you just made a simple mistake. You forgot to end one of your if functions. I may be wrong with this (as I am just trying to see if anything from the question I asked can also apply to yours) but also for each room description you might be a little too specific. You can still be keep it as specific as you currently have it if you want, it’s not necessary. (If it turns I’m wrong, please let me know-I am still learning as well.) I apologize in advance if that last sentance turns out to be misinformation.

house is south of school. “[if unvisited]a two story brick house on a main road. the backyard is littered with trees and a small playground. cars speed past house often, ignoring the speed limit sign. it’s time for school. type ‘n’.[end if][if visited]you are in house. school is to the north.[end if]”

school is west of classroom. “[if unvisited]you’re at school. the walls are white cinderblock and the fluorescent lights tint your skin translucent. the hallways are too small for the number of people that go here. as you make your way through school, you’re shoved around by backpacks and shoulders. type ‘e’ to enter your classroom.[end if][if visited]you are in school. classroom is to the east and the house is to the south.[end if]”

classroom is a room. “[if unvisited]you met a new friend here a few months ago. you have 1st period psych with her and the friend that introduced the two of you. you enter the classroom and they look you up and down, ostensibly annoyed by your presence. you’re sure it’s nothing, but can’t help but feel like they’re angry, like you’ve done something wrong. because of this, you decide to walk home, skipping the rest of your classes. to get back to the school entrance, type ‘w’.” [You forgot to end if here] [end if]

going back to house is a recurring scene.
going back to house begins when the player is in the house for the second time.
going back to house ends when going back to school begins.
when going back to house begins:
say “you were at school for one class. just go back. type ‘n’.”

going back to school is a recurring scene.
going back to school begins when the player is in the school for the second time. say “back at the enterance. to walk home, type ‘n’.”.
going back to school begins when the player is in the school for the third time. say “back at school. don’t want to be here. don’t know what else to do. you float through the day, make it to 2:30. time to go home. type ‘n’.”;
going back to school ends when going back to house begins.

It might also help if you forgo all the saying scenes and just have a list of descriptions that the scene has. You can set a cycle in the room description similar to if you wanted random text(and no, it won’t do it randomly. There is a way to list/order it)

3 Likes

Here’s the setup using variable text instead of scenes.

"Three rooms" by "Testa"

[You have to specify that the first room is actually a room.]
House is a room. "[one of]A two storey brick house on a main road. The back yard is littered with trees and a small playground. Cars speed past, ignoring the speed sign[or]You are in the house[stopping]. It's time for school. Type n."

[Using "one of" you can have a whole chain of things which are said to the player, each separated by [or]. Once you've gone along the chain, the last one will always be displayed. Notice how "it's time for school" is outside the  "stopping" instruction, so it's always displayed.]


[Now that inform knows that house is a room, it can deduce that other objects related to it are also rooms.]
School is north of house.  "[if school is unvisited]You’re at school. The walls are white cinderblock and the fluorescent lights tint your skin translucent. The hallways are too small for the number of people that go here. As you make your way through school, you’re shoved around by backpacks and shoulders. [else]You are in school. [end if]The classroom is to the east and the house is to the south.”


[here, the "if .... is unvisited" does exactly the same as the "one of" construction did, except that one is counting the number of visits, while this one is a true/false  option (sometimes called a "flag".]

[I find it's easier to place new rooms in relation to the rooms you've already made.]
classroom is east of school. "[first time]You met a new friend here a few months ago. you have 1st period psych with her and the friend that introduced the two of you. [only]It's a pretty ordinary classroom, painted a vile egg-yolk yellow that's probably meant to be cheerful. The door out to the school is to the west."

[Remember that players have to navigate their way around your world, so it's important to always mention the exits in the room description, (unless they're secret passages or suchlike, obviously!)]

Julie is a woman in the classroom.

The description of Julie is "Your new friend. Hair in bunches, freckles and a big smile."

The initial appearance of julie is "Your friend Julie is sitting on one of the desks, swinging her legs. [paragraph break]She looks up as you come in. [one of]'Hi!' she says. 'Nice to see you again!'[or]'Back again eh?' she says.[or]'Wow, you sure do get around!' she says.[cycling]".


[notice that extra period at the end, after "end if". Inform is quite smart about working out where the end of a statement is, it'll recognize periods, exclamation marks, queries etc, but it gets confused if theres [something in square brackets] at the end of the statement. That's when you need to add an extra period after the last quote marks to help it out.]

[Each time you go into the classroom now, julie will say something to you, looping around to the beginning after she says the last one. It's really a bit too mechanical for a person -- try replacing "cycling" with "at random". At random chooses one of the unspoken responses at random, so it won't repeat  a response until all of them have been said. If you don't care about the same thing being said twice in a row, then use "purely at random" ]

Understand "girl" or "friend" as julie.
  

I attached the lines relating to your friend to a separate object (julie.) You could have all that as part of the room description of course, but having a separate julie object lets you attach a description to her, (try “x julie” or “x friend”) and also if you want her to appear in the park or somewhere it’s easy to move her.

When you’re posting code, the layout matters, so it’s best to either click on the gear wheel and choose “insert scrollable content” or put three backticks (they look like `) on a separate line before your code, and another three ``` on a line after it. On my keyboard the backtick key is the one above the TAB key.

5 Likes

this worked, thank you so much! now that this is worked out, i’m confused about adding more instances of the character going between the rooms. the game i’m making is more like a script (it’s for a school project) and i just need the character to walk between certain rooms and have dialogue appear each time.

Just add more statements separated by [or] to julie’s initial appearance text. Each time the player goes out of the classroom and then back in again, you’ll see a new one. If you look at the code itself, I’ve put explanations in comments. Look for [text in square brackets like this] which is not inside quote marks.

3 Likes

thank you! it works :slight_smile:

2 Likes