Questions on adding a new action

Okay, so after trawling through the forums, docs and other cheat-sheets I’m having to give in and ask, so apologies in advance.

Basically, I’m trying to add a ‘bend’ function/command to my game.
I have a spring the player can obtain, and I want the player to be able to bend that spring into a makeshift lockpick.

Here’s the current source that I’ve got for making a bending action:

[code]A thing can be bendable or unbendable. A container is usually unbendable. An animal is usually unbendable.

Bending is an action applying to one carried thing.
Understand “bend [something]” as bending.

Carry out bending:

Report bending:
say “You bend the [noun].”[/code]

Here are my questions:

How do I add a check to make sure unbendable stuff isn’t bent? Do I need to add the properties bendable and unbendable? If so - how?
How do I transform one object into another by bending rather than the “[noun]” just becoming a “bent [noun]”?

I’d really appreciate some guidance and a decent example of how to add a command like this. All other examples I’ve seen have either been way more complicated (ropes etc) or a load easier (kissing or whatever).

There are multiple ways to tackle your problem, though here’s how I would do it. If the only thing that can be bent is the spring, the bendable property isn’t necessary. Just have the verb always fail. Then in the specific case of the spring, write an instead rule that replaces the spring with the lockpick.


The spring is a thing. The player carries the spring.
The lockpick is a thing.

Bending is an action applying to one carried thing. Understand "bend [something]" as bending.

Report bending:
  say "That can't be bent."

Instead of bending the spring:
  remove the spring from play;
  now the player carries the lockpick;
  say "You bent the spring into a lockpick!".

If other things are bendable, you can prevent bending unbendable stuff like this:

Check bending when the noun is unbendable: say "[The noun] won't bend." instead.

The “instead” stops the action so the carry out rules don’t run.

Thanks very much, I had never thought about just applying an instead statement.

Okay. How would I go about adding the unbendable property?

You already did: “A thing can be bendable or unbendable.” So you can just declare “A thing is usually unbendable” or “The monkey wrench is unbendable” or “The lead pipe is bendable” like that to set it as an initial property.

(You can also use “now…” to set the bendable/unbendable property in play; “Every turn when the metal ingot is in the forge: now the metal ingot is bendable. Every turn when the metal ingot is not in the forge: now the metal ingot is unbendable.” But you may not need to do that.)

Okay, that makes a lot of sense. I feel like I always overthink with Inform, I thought there would be far more method to adding a property rather than just simply declaring it once. Cheers.

I don’t know how this affects things, but with something quite limited in the game like “bendable” you might want to say “A thing can be bendable.” That means only bendable things you declare will get that property. I don’t know if it wastes memory, but it might be a little unweildy to give every single object in your game an “either bendable or unbendable” property.

Hm? This is the same as “A thing can be bendable or unbendable,” except that it doesn’t define the antonym “unbendable”.

In both cases, the property is defined on all things. (But not rooms, directions, scenes, etc.)