How To

Ok so I am running into some trouble figuring out how to build a puzzle I want. Was hoping someone can give me an idea on how to code it or another puzzle very close to the one i’m about to mention.

The puzzle is basically to unlock a door. You walk into a room and there is a robot missing a gear sitting there. You have to go find the gear and insert it into the robot. Once this is done I want the robot to unlock the door it is in front of.

Now I have the door, robot and gear all placed but im not sure how to link them all together.

Any ideas would be helpful.

What have you tried so far that hasn’t worked?

You could do something like this (note that the syntax will necessarily be incorrect, please revise)After inserting something (called the macguffin) into the robot: if the macguffin is the missing gear: say "The robot grinds into life, reaching over with its noodly appendage and unlocking the sinister black door for you."; now the sinister black door is unlocked; otherwise: say "[The macguffin] doesn't seem to fit correctly.";

If you haven’t made the robot into a container, you probably want to make that an “Instead” rule (so it runs before the “check” rule that would print up “That can’t contain things”). You’d also want to remove the gear from play.

Ok I think I have the idea but having trouble implementing it. I am trying to use a instead line. This is what I have setup.

Instead of inserting gear into the robot: if the Maintenance Robot Gear is the missing gear: say "The robot sparks back into gear and starts moving again. As the robot slowly rolls up to the door a small panel lifts near the bottom. The Maintence robot inserts a small robotic rod into the panel and makes a very sutle beeping noise"; now the Common Area door is unlocked; otherwise: say "You don't seem to have the gear that fits";

And thank you both for helping me out.

If you’ve defined a gear as a kind, then you should change the second line to “if the noun is the maintenance robot gear”. (See section 7.10 of the documentation for “the noun,” which is one of the most important bits of Inform 7 to know.) If you haven’t defined a gear is a kind, make the first line “instead of inserting something into the robot” (and change “missing gear” to “the noun” as well).

(“The missing gear” from the code was supposed to be the name of the object – since your object is named “maintenance robot gear”, you don’t need to use “the missing gear” anywhere.)

Also, you should add “Remove the maintenance robot gear from play” after this rule, or the player will still have the gear in her inventory after doing this, which would be bad.

Another point – make sure to end your sentences with periods inside the quotations, or the spacing will get missed up (not to mention that you’ll be missing periods). Also, “subtle” has a b in it.

I’m getting lost now. I just made up a new file with just this puzzle to show you what I have.

[code]Station Docking Communication Center is a room.

Station Docking Lobby is east of Station Docking Communication Center.

Maintenance Robot Gear is thing inside Station Docking Lobby.

Maintenance Robot is a thing in the Station Docking Lobby. Maintenance Robot is scenery.

Instead of inserting something into the robot:
if the Maintenance Robot Gear is [The noun]:
say “The robot sparks back into gear and starts moving again. As the robot slowly rolls up to the door a small panel lifts near the bottom. The Maintenance robot inserts a small robotic rod into the panel and makes a very subtle beeping noise.”;
now the Common Area door is unlocked;
otherwise:
say “You don’t seem to have the gear that fits.”;

Common Area is west of Station Docking Area.

Common Area Door is east of Station Docking Lobby and west of Common Area. Common Area Door is a door. Common Area door is locked. Common Area Door is scenery.[/code]

As I post this I will look into kinds.

Your two things (Maintenance Robot and Maintenance Robot Gear) cause a namespace clash. By naming them in a different order and by providing some “Does the player mean” statements this is resolved.
Here is my revision:[code]Station Docking Communication Center is a room.

Station Docking Lobby is east of Station Docking Communication Center.

Maintenance Robot is a thing in the Station Docking Lobby.

Maintenance Robot Gear is thing in the Station Docking Lobby.

Does the player mean inserting something into the Maintenance Robot Gear: it is very unlikely.
Does the player mean inserting something into the Maintenance Robot: it is very likely.
Does the player mean inserting the Maintenance Robot Gear into something: it is very likely.
Does the player mean inserting the Maintenance Robot into something: it is very unlikely.

Instead of inserting something (called the noun) into the Maintenance Robot:
if the noun is the Maintenance Robot Gear:
say “The robot sparks back into gear and starts moving again. As the robot slowly rolls up to the door a small panel lifts near the bottom. The Maintenance robot inserts a small robotic rod into the panel and makes a very subtle beeping noise.”;
now the Common Area door is unlocked;
now the Maintenance Robot Gear is off-stage;
otherwise:
say “You don’t seem to have the gear that fits.”;

Common Area is west of Station Docking Area.

Common Area Door is a door. It is east of Station Docking Lobby and west of Common Area. Common Area door is locked and scenery.[/code]

Hooray it works. Thank you both for your help. If you would like I can credit you in the game credits just let me know. =]