Hi guys, I’ve just started to code in Inform 7 with no prior coding experience. As an easy exercise I wanted to create a scene where the player encounters a Deep Chasm, which he/she can only cross after putting an Enchanted Robe on it.
I wrote it like that:
Instead of going south from the Altar:
say “The Deep Chasm prevents you from going South.”
After putting the Enchanted Robe across the Deep Chasm,
now move player into Chamber;
say “You succeeded in crossing the Deep Chasm and entered the Chamber.”
I constantly get an error message for the line
After putting the Enchanted Robe across the Deep Chasm,
I’m simply stuck there and don’t know how to fix it (reading the chapters in the documentation wasn’t much help either)
Welcome to the forum! Inform is a lot of fun. I got into it without any prior coding experience, too.
If you include three backticks before and after your code, it will preserve the formatting, i.e.
```
(your code here)
```
There are some minor syntax/formatting issues that would prevent this from compiling. You’ll want a colon : rather than a comma , after the after line that’s throwing an error.
now move the player into chamber ought to read move the player to chamber.
Inform code can be easy to read, but the syntax/formatting is usually very specific, so these little differences can trip authors up (including me).
The bigger thing to think about is that across isn’t something built into Inform, so that will take a bit of work. In this example, I made it a “supporter”, which is a kind of thing that players can put things on, and I made an alternate command for putting it on that includes the word across.
It’s possible to do something more elaborate with across, like implement some kind of spatial relationship, but that seems like overkill. Here’s what I typed up.
I’d want to think about things like whether the cloak is visible on the other side, too, but this might be something to start with.
altar is a room.
chamber is south of altar.
enchanted robe is held by the player.
deep chasm is a scenery supporter in altar.
understand "put [something] across [something]" as putting it on;
Instead of going south from the Altar:
say “The Deep Chasm prevents you from going South.”
carry out putting the robe on the deep chasm:
move the player to Chamber;
say “You succeeded in crossing the Deep Chasm and entered the Chamber.”;
That’s probably because I didn’t say enchanted robe in my example, which is wrong (though I don’t get an error with it). Try changing robe to enchanted robe.
The error suggests that one of the nouns isn’t recognized (there’s a different error when the action isn’t recognized), so I’d verify both the enchanted robe and deep chasm match the names correctly.
"Wizard's Quest" by Mike Minter
Entrance is a room. "You stand at the grand entrance of the ancient tower."
The Teleportation Stone is an object. The Teleportation Stone is inside the Entrance.
Library is a room. "Dusty books line the walls. A faint glow comes from a pedestal."
Library is north of Entrance.
The Crystal Orb is an object. The Crystal Orb is inside the Library.
A Pedestal is scenery. A Pedestal is inside the Library. A Pedestal is a supporter. The description of a Pedestal is "A crystal orb must be placed on the pedestal to reveal the path east."
Include Secret Doors by Gavin Lambert.
The Hidden Door is a secret door.
The Hidden Door is east of the Library and west of the Altar.
Instead of putting Crystal Orb on the Pedestal for the first time:
now the Hidden Door is revealed;
now the Hidden Door is open;
say "You place the Crystal Orb on the pedestal. A hidden door opens to the east!"
Altar is a room. "An altar with runes that pulse softly. A deep chasm blocks the northern path. "
The Enchanted Rope is an object. The Enchanted Rope is inside the Altar.
Deep chasm is a scenery supporter in Altar.
understand "put [something] across [something]" as putting it on.
The description of Deep Chasm is "You need an enchanted rope to cross the chasm below."
Instead of going south from the Altar:
say “The Deep Chasm prevents you from going South.”
carry out putting the Enchanded Robe on the Deep Chasm:
move the player to Chamber;
say “You succeeded in crossing the Deep Chasm and entered the Chamber.”
Chamber is a room. "The chamber is empty except for a pedestal with a flame and a pool of ice."
Chamber is south of Altar.
A Flame is scenery. A Flame is inside the Chamber. A Pool of Ice is an object inside the Chamber. The description of a Pool of Ice is "Use fire to melt the ice, revealing the hidden key."
Vault is a room. "A vault door bars your way. The Gem of Eternity sits on a stone altar inside."
The Vault Door is a door. The Vault Door is west of Chamber and east of Vault. The Vault Door is locked.
The Stone Altar is scenery. The Stone Altar is inside the Vault.
The Gem of Eternity is an object. The Gem of Eternity is on the the stone altar. The description of the Gem of Eternity is "You need the teleportation stone (and a key) to open this vault from here."
I’ll take a look. Don’t forget you can use the backticks to preserve formatting. That makes it easier for people to copy/paste your code (backtick is usually below the escape key)
I had to put it somewhere for the example to work, and I didn’t know the details of your game. It was meant to show an example that compiles and functions.
Your robe just needs to exist in your game world before it can be referred to.
Capitalization only matters insofar as it changes how Inform describes things to the player. Inform will broadly follow the capitalization you used when you first defined something, so an Enchanted Robe will have capital letters and an enchanted robe won’t.
In Inform, a “thing” is something located in the world that you can examine and interact with. An “object” is a broader category that includes rooms, directions, and concepts too—stuff that doesn’t really have a location and can’t be examined. If you want the player to be able to take the robe, it should be a thing.
Inform can organize various items (values, objects) according to what are called “kinds”.
A thing is a kind of object.
If you look at the project index, you can find a good explanation of the difference.
Open the index (right-hand tab), click on the yellow “CH” square beside “Kinds Index”, and then scroll down. You can see the hierarchy with “object” described at the top. The bottom line is that “things” are a specific kind of “object” that consists of interactable items. The robe is a thing.
Matches: value, sayable value
Objects are values intended to simulate physical things: places, people, things, and so on. They come in many kinds.
I used the term ‘object’ for something the player can pick up and put into his/her inventory.
The Teleportation Stone is an object. The Teleportation Stone is inside the Entrance.
And it worked fine so far.
thing (plural things)
Represents anything interactive in the model world that is not a room. People, pieces of scenery, furniture, doors and mislaid umbrellas might all be examples, and so might more surprising things like the sound of birdsong or a shaft of sunlight.
A thing is in this definition a part of scenery and scenery is not portable. So, according to my understanding, if I want the player to pick it up and put it into his/her inventory … calling it ‘an object’ makes much more sense.
I believe it! But if you later use a construction like
repeat with O running through objects:
The results might return the coin, yes, but it will be grouped with directions, rooms, and a lot of other objects that may or may not be desired. It can be hard to appreciate all of these distinctions when starting out, but I wouldn’t use is an object unless I had a specific reason for using an object. The documentation uses things, and most examples do, too. That’s my advice!
The definition states that things include parts of scenery, not that all things are scenery.
Your game might work fine without things (except for the player, of course, because the player is a person and persons are a kind of thing), but there might be something strange down the road or else some kind of organizational hassle because of this strategy.
The trick is, only things have locations in the world. So if you make an object, but specify its location, Inform actually makes it a thing instead—otherwise the location would be meaningless.
I must admit everything is very confusing for me (an object can also be a place and a place isn’t portable either)
Being dyslexic doesn’t help either (that the reason for my spelling mistakes).
But I’ll struggle on! - I really want to learn how to write IF. I tried using Clickteam Fusion 2.5 for a short time. But everything takes 10x longer. So, I decided it’s probably worth the effort to learn how to code in Inform 7.