New to Inform 7, need someone's help!

Hello!

I need someone’s help. I am extremely new to creating IF, and finally getting my feet wet with a Fantasy game (using a story I put so much effort into creating the world for, so I decided to just use that…).

Now, I am trying to make a certain action unlock a door, instead of a key unlocking the door. But, I keep getting the same error message. Can someone help?

Here is the code I have so far :

The Underworld is a room. “You stand in the depths of the Underworld. The darkness and blackness surrounds you. Moving around the room, you sense a door ahead of you. The cold metal tells you that before you is the Gates of the Underworld. But you can feel that the spirits of the Underworld have grown restless. You hear something awaken. It wants you to listen.”

The Gates of the Underworld is a door. The Gates of the Underworld is scenery. The Gates of the Underworld is lockable and locked. The action listen unlocks the Gates of the Underworld. The Gates of the Underworld is north of The Underworld and south of the Dark Ridge River.

Instead of going through the Gates of the Underworld:
if the Gates of the Underworld is closed:
if the Gates of the Underworld is locked:
say “(first trying to open the Gates of the Underworld) Wait, the dark spirits say. You must listen. [paragraph break].”
otherwise if the player listens:
say “(first opening the Gates of the Underworld) You feel pulled towards the open gates. Your connection to this awakening spirit disturbs you, yet it is intriguing at the same time. You desire to know more, but almost as if waking from a dream, you feel yourself wondering if what you have just witnessed was real or if you have been asleep the whole time…[paragraph break]”
now the Gates of the Underworld is unlocked;
now the Gates of the Underworld is open.

Now, here’s the error message I keep getting over and over again:

Problem. The phrase or rule definition ‘Instead of going through the Gates of the Underworld’ is written using the ‘colon and indentation’ syntax for its 'if’s, 'repeat’s and 'while’s, where blocks of phrases grouped together are indented one tab step inward from the ‘if …:’ or similar phrase to which they belong. But the phrase ‘if the Gates of the Underworld is locked’ , which ought to begin a block, is immediately followed by at the same or a lower indentation, so the block seems to be empty - this must mean there has been a mistake in indenting the phrases.

I also have another question…can I have certain “rules” I create, only when the player is in this certain area? Because later, the player may end up being in the Underworld again, and opening up the gates will be easier in that portion (much later in the game). I only want the player to have to unlock the door by listening during this scenario. So far, I have separated this section into being “Chapter 1 - Part 1 - The Beginning”.

Thanks for everyone’s help!

You might want to separate the listening into a separate action, otherwise it won’t work, like so:

[code]Instead of going through the Gates of the Underworld:
if the Gates of the Underworld is closed:
if the Gates of the Underworld is locked:
say “(first trying to open the Gates of the Underworld) Wait, the dark spirits say. You must listen. [paragraph break].”;

Instead of listening in the Underworld:
say “(first opening the Gates of the Underworld) You feel pulled towards the open gates. Your connection to this awakening spirit disturbs you, yet it is intriguing at the same time. You desire to know more, but almost as if waking from a dream, you feel yourself wondering if what you have just witnessed was real or if you have been asleep the whole time…[paragraph break]”;
now the Gates of the Underworld is unlocked;
now the Gates of the Underworld is open;[/code]
You need the semicolons after your text strings end to indicated the end of that particular line.
Also I think your tabs may have been cleaned out by the message board (at least I hope you tabbed)

Yes, once the door is unlocked, it will remain unlocked for the duration of the game. After this point, you can open the door at will.
Also, separating your code into chapters and parts only makes it easier to read, it doesn’t affect how the game runs at all.

You’re getting that error message because of a wrong indentation in your code. If you use the [code] button at the top of the forum input area when pasting your code into the message, we’ll be able to find the error. (You may also want to download my Handbook, from www.musicwords.net/if/i7hb.htm, as it talks about indentation.)

Separating your text into chapters is mainly for your convenience while writing. If you want to have certain things be possible only during certain parts of the game, you need to define Scenes. That works like a charm.

–JA

Edit: Sorry, a lot of this is redundant with all the quicker posters, but you can see some variations on how to do things here if you want.

There is definitely something wrong with your formatting, but there are also some problems with your code. I think it would be easier to start over with something like this:

[code]The Underworld is a room. “You stand in the depths of the Underworld. The darkness and blackness surrounds you. Moving around the room, you sense a door ahead of you. The cold metal tells you that before you is the Gates of the Underworld. But you can feel that the spirits of the Underworld have grown restless. You hear something awaken. It wants you to listen.”

The Gates of the Underworld is a door. The Gates of the Underworld is scenery. The Gates of the Underworld is lockable and locked. The action listen unlocks the Gates of the Underworld. The Gates of the Underworld is north of The Underworld and south of the Dark Ridge River.

Instead of going through the locked Gates of the Underworld:
say “(first trying to open the Gates of the Underworld) Wait, the dark spirits say. You must listen. [paragraph break].”

Instead of listening when the location is Underworld and the Gates is locked:
say “(first opening the Gates of the Underworld) You feel pulled towards the open gates. Your connection to this awakening spirit disturbs you, yet it is intriguing at the same time. You desire to know more, but almost as if waking from a dream, you feel yourself wondering if what you have just witnessed was real or if you have been asleep the whole time…[paragraph break]”;
now the Gates is unlocked;
now the Gates is open.
[/code]

Unfortunately since part of your problem involves indentation, that might not work when you paste it in. You might have to turn the indentations back into actual tabs. But in my version, you never need more than one tab on a line.

A couple points to consider:

When using colon-and-indentation formatting, make sure every line before the last line ends in a semicolon. The last line may end in a period.

The sentence “the action listen unlocks the Gates of the Underworld” doesn’t do anything that I know of. I wouldn’t attempt to guess how Inform is interpreting it. It’s probably better just to use an Instead rule like the one here, and remove that sentence.

I think you have more paragraph breaks than you need. Inform usually adds a paragraph break any time a string ends with a period.

I realized that I forgot to mention…there is someone else in the room with the player. It is the “awakening spirit” and the player must “listen to the awakening spirit” and that is when the door will be unlocked…is that possible?

By listening to the awakening spirit, the awakening spirit has a message for the player…so opening the door and leaving the room will have a certain message and listening to the awakening spirit will have a message. And listening to the awakening spirit unlocks the door. Is that possible?

Here’s the code for the entire room:

[code]Chapter 1 - Part 1 - The Beginning

The Underworld is a room. “You stand in the depths of the Underworld. The darkness and blackness surrounds you. Moving around the room, you sense a door ahead of you. The cold metal tells you that before you is the Gates of the Underworld. But you can feel that the spirits of the Underworld have grown restless. You hear something awaken. It wants you to listen.”

The Gates of the Underworld is a door. The Gates of the Underworld is scenery. The Gates of the Underworld is lockable and locked. The action listen to the awakening spirit unlocks the Gates of the Underworld. The Gates of the Underworld is north of The Underworld and south of the Dark Ridge River.

Instead of going through the Gates of the Underworld:
say “(first trying to open the Gates of the Underworld) Wait, the dark spirits say. You must listen. [paragraph break].”;

Instead of listening when the location is Underworld and the Gates is locked:
say “(first opening the Gates of the Underworld) You feel pulled towards the open gates. Your connection to this awakening spirit disturbs you, yet it is intriguing at the same time. You desire to know more, but almost as if waking from a dream, you feel yourself wondering if what you have just witnessed was real or if you have been asleep the whole time…[paragraph break].”;
now the Gates of the Underworld is unlocked;
now the Gates of the Underworld is open.

many dark spirits are here. Instead of examining dark spirits, say “The dark spirits are the souls of the dead and the souls that have succommed to the powers they have used for darkness. They have grown restless with your presence.” Instead of touching the dark spirits, say “The spirits move away from you. They know you do not belong here. You are not completely of darkness like they are. They can sense your power and they are disturbed by something awakening in this Underworld. These spirits want you to listen to the evil that you have awakened.” Instead of touching the dark spirits twice, say “The move away from you further. They want you to listen.”

After examining the player, say “You are a spirit of dark and of light. This disturbs the dark spirits of the Underworld. They are distrubed by your bond with this awakening spirit. They sense something has awakened with the Underworld.”

The awakening spirit is here. After examining the awakening spirit, say “You feel an unexpected bond with this other spirit. Something feels familiar. As if you have waited long for this spirit. Although you still see darkness, you feel this awakening spirit reaching closer for you. It wants you to listen.”

Instead of listening to the awakening spirit, say “If I could explain to you the importance of what and who I am, I wouldn’t know where to begin. I believe what I do is as important as the sun and the moon. I am of evil. I watch and I follow the light to help this power make the greatest decision of all of humanity, even of my existence. Of course, even when the choice is made, there is always a way for the light to decide again once more. That is why I exist. There are some children’s tales that say the one that follows the light is the greatest of all evil, but that is not true. I am not entirely of evil, you see. I am part of the One being that can not only destroy me…but make me alive!”

Instead of touching the awakening spirit, say “It wants you to move closer. This awakening spirit wants you to become a part of it, but it knows you will not stay within the Underworld long. It has awakened, as you will. As you must.” Instead of touching the awakening spirit twice, say “Awaken, Talia, dear TrueOne. It it is time. The sun rises, as you must.” [/code][/code]

Mainly, I want the player to listen to the awakening spirit before they leave the room. I think I may just be doing this the most complicated way possible…

Instead of the Gates of the Underworld being lockable and locked…then, can I make the player have to hesitate before they leave if they haven’t listened to this other spirit?

The action listen to the awakening spirit unlocks the Gates of the Underworld.

I figured out what this sentence does. It creates a key called “action listen to the awakening spirit”:

Probably not what you want… but as I said before, you can remove this line and everything will still work.

As for listening to the Awakening Spirit, all you need is to add the unlocking effect to the Instead rule for that. It sounds like you actually want the player to open the gate manually, but you want the spirit to unlock it first. And you want a special message to print the first time you successfully go through the gates. Is that right? Here’s one way to do that, using a “first time” rule:

[code]Chapter 1 - Part 1 - The Beginning

The Underworld is a room. “You stand in the depths of the Underworld. The darkness and blackness surrounds you. Moving around the room, you sense a door ahead of you. The cold metal tells you that before you is the Gates of the Underworld. But you can feel that the spirits of the Underworld have grown restless. You hear something awaken. It wants you to listen.”

The Gates of the Underworld is a door. The Gates of the Underworld is scenery. The Gates of the Underworld is lockable and locked. The Gates of the Underworld is north of The Underworld and south of the Dark Ridge River.

Instead of going through the locked Gates of the Underworld:
say “(first trying to open the Gates of the Underworld) Wait, the dark spirits say. You must listen. [paragraph break].”;

After going through the Gates of the Underworld for the first time:
say “You feel pulled towards the Gates of the Underworld. Your connection to this awakening spirit disturbs you, yet it is intriguing at the same time. You desire to know more, but almost as if waking from a dream, you feel yourself wondering if what you have just witnessed was real or if you have been asleep the whole time…[paragraph break].”;

many dark spirits are here. Instead of examining dark spirits, say “The dark spirits are the souls of the dead and the souls that have succommed to the powers they have used for darkness. They have grown restless with your presence.” Instead of touching the dark spirits, say “The spirits move away from you. They know you do not belong here. You are not completely of darkness like they are. They can sense your power and they are disturbed by something awakening in this Underworld. These spirits want you to listen to the evil that you have awakened.” Instead of touching the dark spirits twice, say “The move away from you further. They want you to listen.”

After examining the player, say “You are a spirit of dark and of light. This disturbs the dark spirits of the Underworld. They are distrubed by your bond with this awakening spirit. They sense something has awakened with the Underworld.”

The awakening spirit is here. After examining the awakening spirit, say “You feel an unexpected bond with this other spirit. Something feels familiar. As if you have waited long for this spirit. Although you still see darkness, you feel this awakening spirit reaching closer for you. It wants you to listen.”

Instead of listening to the awakening spirit:
say “If I could explain to you the importance of what and who I am, I wouldn’t know where to begin. I believe what I do is as important as the sun and the moon. I am of evil. I watch and I follow the light to help this power make the greatest decision of all of humanity, even of my existence. Of course, even when the choice is made, there is always a way for the light to decide again once more. That is why I exist. There are some children’s tales that say the one that follows the light is the greatest of all evil, but that is not true. I am not entirely of evil, you see. I am part of the One being that can not only destroy me…but make me alive!”;
now the Gates of the Underworld is unlocked.

Instead of touching the awakening spirit, say “It wants you to move closer. This awakening spirit wants you to become a part of it, but it knows you will not stay within the Underworld long. It has awakened, as you will. As you must.” Instead of touching the awakening spirit twice, say “Awaken, Talia, dear TrueOne. It it is time. The sun rises, as you must.” [/code]

Thank you!!!

Now I can finally get out of this freakin’ room!!! HA HA! WOO. That took me three days to get through that. YES.

Okay, now I have one final questin and this time it is much simpler.

I have a description for when the player is in the “Underworld…” And that is that first statement…

But, when I did a test run…when I say ‘examine the underworld’ it says in the game that there is no such thing…why is that? Can’t you examine a room as a player and have it give a response. Or since I have labeled the Underworld as a “room” there is nothing to examine.

That is because rooms aren’t objects.
You could create a scenery object or a backdrop like so: The underworldBackdrop is a backdrop in the Underworld. The description of the underworldBackdrop is "The underworld is rather more frightening than you previously imagined." Understand "underworld/under/world" as the underworldBackdrop. By using a backdrop instead of scenery, you can reuse it in more rooms without running into instance errors. Other than that, backdrops and scenery behave basically identically.

Jim, you might want to put the link to the handbook in your forum signature, like I do the programmer’s manual below. You never know who might discover it while reading posts about other stuff in which you’ve posted.

Yay, thank you everyone!!

I’m very very very sure i will be back. Creating IF is fun…I feel like I am doing a very long math problem (not a bad thing though, I like math…) yet doing something creative at the same time (which i also love)…