Hi all! I had a question regarding how to code something. Let’s say the player and a couple of NPC characters are running around a map, being chased by The Bad Guy. I want to make it so that when The Bad Guy catches up to one of the good guys (either the player or the good NPCs) that character gets teleported to The Main Room. In this Main Room there are several pieces of furniture (idk, say several different-colored chairs or something). The good guy is handcuffed to one of these chairs randomly, making it so that they can’t get off the chair, move around, etc. until they escape. Basically, I want to make a property of the person or a relation between the person and the chair, or something like that, which keeps the NPC or player stuck on the chair until a certain condition/set of conditions are met. I want the character to be able to sit on the chair without it immediately causing them to be captured, so if they decided to go in the Main Room and sit on one of the chairs then nothing out-of-the-ordinary would happen. How would I do that?
The simplest way I can think of would be to make the handcuffs a wearable thing and apply special rules to any actor wearing the handcuffs:
The Lab is a room. "Bubbling retorts, that sort of thing."
The Hallway is a room. "A few pieces of furniture."
A furniture is a kind of supporter. A furniture is always enterable. A green chair is furniture in the hallway. A red chair is furniture in the hallway. A blue chair is furniture in the hallway.
The handcuffs are a thing.
[Any actions to be denied while handcuffed should be declared as "locomotion".]
Going is locomotion. Entering is locomotion. Exiting is locomotion. Getting off is locomotion.
Locking something with is locomotion. Unlocking something with is locomotion. Switching on something is locomotion. Switching off is locomotion. Opening is locomotion. Closing is locomotion. Wearing is locomotion. Taking off is locomotion.
Instead of an actor locomotion when the actor is wearing the handcuffs:
say "[Regarding the actor][Their] hands are bound[if the actor is enclosed by something] to [the holder of the actor][end if]."
The bad guy is a person.
When play begins:
the bad guy arrives in two turns from now.
At the time when the bad guy arrives:
now the player is wearing the handcuffs;
let the target be a random furniture in the hallway;
say "You're coming with me. Off to [the target]!";
now the player is on the target.
One way would be to give every person an either-or property of handcuffed or freed, then block actions by a handcuffed person…
A person can be handcuffed or freed.
Instead of an actor doing something other than looking, (etc. etc.) when the actor is handcuffed:
say "[The actor] can't do that while handcuffed to a chair!". [see Example 96, Zodiac, in Inform Documentation]