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:
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.
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!".
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.)
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.