Moving objectson a map.

Hey there, first post for me.

I got into making something in Inform7 when I went to see a talk at a local Game Jam which gave me the inspiration to write a Text Adventure.

Thing is, I’m not too clued up on it, even if I’ve done a little bit of programming in other languages in past.

Making a long story short, I’m writing a text adventure which is a morbid, yet comedic Sci-Fi story about a man who was fortunate, or maybe unfortunate, be be elected by his new Alien overlords not to be eaten, but rather to work to prepare food for the aliens, in other words cut up and prepare other humans for the consumption of this newly ruling alien race on earth. The Story starts off with the character starting a new day at work, and he’s got to prepare a human carcass for his employers at the factory. The player has to push a lever so that the hooks on the ceiling of the cold room move to bring the body into the room. The problem is I can’t quite figure out how to make an object (in this case the body) move from one room to the other without picking it up.

Here’s something I made, but I get errors.

[code]Before printing the banner text, say “You might think you have the worst job in the worst, but it can’t be as bad as mine…[paragraph break]”

After printing the banner text, say “[line break]You begin your day in one of the many chiller rooms at the Glutton Food Corporation head factory. Time to cut up some bodies…”

The Cold Room is a room. “In the cold and misty room, there are a set of hooks suspended on the ceiling. The hooks are on a track that makes a circuit. The track leads to two doors, they are closed. There is a lever by the door and a lit sign saying ‘Incoming Stock’”.

Incoming Stock is a room. In Incoming Stock is a body.

South of Incoming Stock is The Cold Room.

North of The Cold Room is nowhere

There is a Lever in The Cold Room.

Before taking the Lever:
say “It’s a lever that’s bolted to the floor, you can’t take it[line break]”;
Stop the action.

before pulling the lever:
say “It appears that you can’t pull the lever, maybe you have to push it[line break]”;
Stop the action.

before pushing the Lever, say “Pushing the lever causes the hooks on the ceiling to move and the doors open. One body appears through the door hung on a hook, a woman, with her hair shaved off, and ready to prepare.[line break]”.
Move Corpse from Incoming Stock to The Cold Room.[/code]

Inform7 appear to have an issue when I try to use “move” in “Move Corpse from Incoming Stock to The Cold Room.” as a verb, even though I’ve seen this used in a few examples. Either the grammar is incorrect, or I’m doing something incredibly stupid that I can not see. So what am I doing wrong here? Sorry if this sounds super nooby, but I’m struggling to find examples to things I want. Oh, and by the way, yes the path from incoming stock to the cold room is one way, I want the body to come out, but I don’t want the player to go into it.

Two things: the move phrase is not inside a rule (the comma in the before rule should be a colon and the period should be a semicolon), and you shouldn’t specify the initial location when moving the object. It gets moved regardless of where it is. (And thirdly, the object is defined as “body” but called “corpse” in the rule, but I assume that’s just an oversight in the example.)

Before pushing the Lever for the first time: say "Pushing the lever causes the hooks on the ceiling to move and the doors open. One body appears through the door hung on a hook, a woman, with her hair shaved off, and ready to prepare."; move Corpse to The Cold Room; stop the action.

And if you don’t mind a couple of observations about the other code:

  • Showing the intro text using before/after printing the banner rules is not an optimal way; if you command VERSION it also prints the banner and you see them there as well. Usually a “when play begins” rule is used to print the intro text before the banner and a “before looking for the first time” is used to print text after the banner.
  • Before rules are a pretty heavy tool for printing normal refusal messages. It’s more common to use check or instead rules. With instead rules you don’t even need the “stop the action” phrases.
  • You don’t need [line break] if you add punctuation to the end of phrases, which might be a good idea to do anyway.

Cool, I got it to work now. but here’s the next problem…

In the cold room there’s a toolbox where the player has to take a knife and saw. I made the Toolbox a container that is closed, but open-able, problem is, even though I have put objects into the box, each time I open it it’s empty.

[code]A Tool Box is a kind of container which is closed and openable. In the Tool Box is a Knife.

There is a Tool Box in The Cold Room. Understand “Box” as the tool box.[/code]

The syntax appears to work, but each time I open the box and look into it, it’s emtpy. is “In the Tool Box is a knife” the correct way of doing it?

If there’s only one toolbox you don’t need to make a new kind.

[code]In the Cold Room is a container called a toolbox. It is closed and openable. Understand “tool” or “box” as the toolbox.

There is a knife in the toolbox.[/code]

In cases like this it’s often helpful to go to the Index tab and look at the World and then the Map to see what objects have been created and where they are. If you do this with your original code you’ll find that there’s a tool box with a knife in it (not in any room); the line “In the tool box is a knife” creates a tool box with a knife in it, which Inform puts off-stage because it doesn’t know what else to do with it. Then “There is a Tool Box in The Cold Room” creates a different tool box in the Cold Room. That one’s empty, because we haven’t put anything in it. If youdon’t make Too Box a kind this won’t happen, because then every reference to “Tool Box” in your source code will refer to the same thing.

(By the way, I thought things like “the [name of kind]” were supposed to throw compiler errors in the new build?)

In fact you can skip some of this; if you write “A tool box is in the cold room. A knife is in the tool box” then Inform will deduce that the tool box is a container! It’s just as well to say this explicitly, though, to avoid surprises.

Also if the name is “tool box” with the space you don’t need to tell Inform to understand “box”; every word in the name will be understood as referring to the object. You would need to tell it to understand “toolbox.”