Requiring/Using Objects on other objects

Hello,

I’'m brand new to Inform 7, and I’ve been working my way through the documentation while creating my first IF story, but now I’m a little stuck.

Here’s what I’m trying to do:

I have an object that is buried in the mud of a swamp, and I want to prevent the player from taking that object unless they use another specific object to pry that object out of the mud, but I can’t seem to find the rule to make something like that work.

Any help would be greatly appreciated.

Thanks!

Something like this:

Check taking the chest when the player does not carry the long stick and the chest is not handled: say "You'll need something to pry the chest loose with." instead.

“Handled” refers to a thing that the player has carried; so this should ensure that the player doesn’t need the stick after the first time she gets the chest; she can drop it and pick it up again without getting this message.

Now, this will allow the player to type “TAKE CHEST” when she has the chest (it’s also nice to include a special message for taking the chest the first time, maybe with an After rule, since it’s a special action). But here it’s also good to have your game understand the command “TAKE CHEST WITH STICK” and other synonyms, since lots of players will try that once they realize that they need to use the stick to get the chest. To do that you would need to define a “taking it with” action applying to two things; see section 12.7 on New Actions.

Thanks for the quick response!

I already had something similar which worked, but here’s the problem I’m trying to solve:

The example you showed me allows the player to take the object that is “stuck” in the mud as long as they are simply carrying the other object that is required (i.e. it is in their inventory). What I am actually trying to do is force them to “Use” the item to pry the object out of the mud.

Specifically, in this case I have a skull-shaped hat buried in the mud of a swamp. I want the player to have to use a broom handle (which they likely found in the starting location of this story) to pry the hat our of the mud.

Using your example, here is what I have:

Check taking the skull-shaped hat when the player does not carry the broom and the skull-shaped hat is not handled: say "The hat is securely stuck in the mud, as if trampled by dozens of anxious feet. You might be able to pry it up with something." instead.	

That works fine if the player forgot to pickup the broom, but if they already have it in their inventory, the system allows them to simply take the hat. The behavior I’m trying to figure out how to force would be to make the player:

Pry up hat with broom

or

Use broom on hat

…or something to that effect. I hope that makes sense :confused:

Create a new action for prying.

Prying it with is an action applying to two things. Understand "pry [something] with [something preferably held]" as prying it with.

Write a rule that stops prying in most cases…

Check prying something with: say "That won't do much good." instead.

…then override it.

Instead of prying the hat with the broom handle...

Definitely getting closer (thanks for your patience). Here’s what I have so far:

[code]Check taking the skull-shaped hat: say “The hat is securely stuck in the mud, as if trampled by dozens of feet anxious to get kills during a bonus round. You might be able to pry it up with something.” instead.

Prying it with is an action applying to two things. Understand “pry [something] with [something preferably held]” as prying it with.

Check prying something with: say “That won’t do you much good. ‘What are you thinking, Scrunge?’ You say to yourself.” instead.

Instead of prying the hat with the broom handle:
say “The hat flies from the mud with a sickening slurp and lands in your hands.”
take the hat.[/code]

Here is the error I’m getting (from the last line):

Wow- please disregard, I just figured it out:

Instead of prying the hat with the broom: say "The hat flies from the mud with a sickening slurp and lands in your hands."; now player has the skull-shaped hat.