battling with i7 - holding problem

Hi all,

I have the following code to try and build a handle that the player can hold by typing “hold handle” (well, this is an extract of the important bits)

[code]The Cave is a room. “[cave-description]”

To say cave-description:
if the sturdy handle is held
say “You are holding the sturdy handle”;
end if.

The description of the sturdy handle is “An immoveable metallic handle. Designed for holding.” The sturdy handle can be held. The sturdy handle is not held.

Holding something is an action applying to one thing. Understand “hold [something]” or “grab [something]” as holding something. Holding something is acting fast.

Check holding something:
if the noun is the sturdy handle:
now the sturdy handle is held;
say “You grab hold of the sturdy handle.”;
say “That’s not something you can hold in such a way.”
It compiles ok, but when I type ‘look’ after holding the handle, it won’t say “You are holding the sturdy handle”

What am I doing wrong? Do I need to give a Definition for ‘held’?

The problem is that “held” already has a meaning. The Standard Library has this line:

Definition: a thing is held if the player is holding it.

…which overrides the thing’s custom held property.

If you change “held” to something else, like “wielded”, it should work properly.

Also note that “hold” is already defined as a synonym for taking, so I believe you would have to write:

Understand the command "hold" as something new.

in order to allow your grammar line for holding to override the grammar line that defines that synonym.

(Though I might consider just defining “grab [something]” as taking and then using an “Instead of taking the handle” rule to redirect taking the handle in the way you want; it might be annoying to type “grab lamp” and be told “That’s not something you can hold in such a way.” I do find “hold” as a synonym for taking mysterious; there’s one game I can think of where that’s useful, though even to name the game would be a spoiler.)

I believe the motivation is that the world model assumes everything that’s directly in the player’s inventory is held in their hands. That’s why many old games have carrying capacity of two (room one item in each hand) + a backpack or similar to use as a holdall. Taking something from a container in the inventory results in the player “holding” the thing in their hands.

thanks all! much appreciated.

Oh, I get why the source code adjective is “held”; I just find it a bit odd that the command HOLD LAMP is understood as GET LAMP. “Hold” is usually used for continuing to hold on to something rather than for picking it up in the first place; if I say “hold the lamp” I’m usually handing it to you and asking you to keep it for a period of time, rather than asking you to pick the lamp up yourself.

Or is the explanation that if the lamp is in my backpack, I type HOLD LAMP to start holding onto it? Man I do not miss inventory limits.

No, I was talking about the command too. Consider this scenario:

(dots to preserve whitespace)

The lamp is already in the player’s inventory, but now they want to hold it in their hand. The intention of the player is not to pick it up but to change its place in the inventory.

Of course the modern interpretation of the inventory is more abstract and doesn’t generally make the held/stashed distinction, so the command makes less sense.

(Another reason might be that many standard library refusals say “But you aren’t holding that”, so it’s reasonable to let the player correct the situation by using the same verb.)

I recommend this. It’s better to be generous about synonyms, and accepting all of get/take/pick-up/hold/grab seems like the best plan.

The same goes in reverse, which is why hold is a standard synonym for take. You might not normally tell me to “hold the lamp” when the lamp is on the floor next to me, but if you do, it’s pretty clear what it means.