Take Off / Remove as part of an action?

Heya all,

I’m trying to write a section where the player character is bonked unconscious and mugged for their armour.

I’m still that the stage where I don’t really know how a lot of things work, but I’m patching stuff together however I can. One thing that has stumped me is removing something the player has equipped or is wearing. I’m using the things built into Inform 7 when it comes to clothes, but can’t seem to find whatever keyword or phrase is needed to actually remove things.

I threw together this test piece as an example.

Undressing is an action applying to nothing. Understand "Undress" as Undressing.
Carry out undressing:
     If player is wearing armour:
           Take off armour;
           say "Test successful, armour removed."

But the game doesn’t seem to understand this. What should I do to get this effect?

I’ve also tried “Try taking off armour.”

Looking at it, it seems that “try taking off armour” is too vague. Is there a way to tag the armour the character is wearing? I have armour as a type of clothing.

As was certain to happen, it looks like I’ve fixed the issue the moment I posted about it.

Undressing is an action applying to nothing. Understand "Undress" as Undressing.
Carry out undressing:
     If player is wearing armour (called Worn Armour):
           Take off Worn Armour;
           say "Test successful, armour removed."

I think you may be misunderstanding the point of creating a new action.

A new action is intended to allow a new type of interaction in the modeled world. In this case, your new undressing action is really just acting as a wrapper for the existing taking off action.

Actions are things done by the PC (or other entities) in the model world, usually in response to commands typed by the huma player. A new action is not needed to solve the problem that you mention at the beginning of your post, which is to have something happen to the PC in a manner not under the human player’s control. For that sort of thing, you can just use now to change the state of the model world as you see fit.

now all armour worn by the player is off-stage;
3 Likes

Otis is correct about actions are player commands and you don’t necessarily need them to change world-state using godlike authorial powers. If you did want to create a command for undressing that the player could type:

Undressing is an action applying to nothing. Understand "undress" as Undressing.

Check undressing:
     if the player is wearing nothing:
          say "You're already naked!" instead;

Carry out undressing:
     If player is wearing armour:
           try the player taking off armour;

Or more generally:

Carry out undressing:
     repeat with garment running through things worn by the player:
          try the player taking off garment.

For a rule to direct to another action, you have to use “try the player [doing the action name]” or “try the actor…” if it’s not the player. The action rules will fire as if the player typed the command.

You can also bypass the player trying action and any rules involved with authorial godlike powers:

Carry out undressing:
     repeat with garment running through things worn by the player:
          now garment is in the location of the player.

This is your choice - if there’s a reason the player might not be able to take off something (like a shackle locked around their wrist) you’d want to use “try the player taking off”.

And potentially:

Report undressing:
     say "Ooo-kay. Now you're naked."

You can also create an authorial godmode shortcut:

To strip the player:
     repeat with garment running through things worn by the player:
          now garment is off-stage.

This is useful if you do multiple costume changes and don’t know what the player will be wearing at any given time. This can be used in rules:

When Swan Lake Scene begins:
     strip the player;
     now the player wears leotard with puffy tutu.
2 Likes

Great! Thanks for the help!

I’m still new enough that I don’t exactly know the best or proper way to do things, or how Inform’s pre-built things can be used, but this information looks like it’ll really save me time and reduce the complexity.

Inform 7 is one of those programs where there are 18 different ways to implement any given scenario and you’ll build up your own set of best practices.

For example I never use tables and never think to unless specifically required by an extension. There are probably things that would be simpler with a table, but I’ll code my way around using them!

One tip is to get really familiar with the index in the IDE - it’s packed with information about existing commands and recognized syntax and it will update to include the ones you create in the story.

Before you create a new action, one handy thing to do is type ACTIONS in the IDE and then try doing what you want to do. Sometimes you’ll notice Inform already has a synonym and you can build upon an action. When ACTIONS is enabled, Inform will notate the action name it’s actually using and whether it failed or succeeded.

A common one is KNOCK - like to knock on a door. Inform 7 has that as a synonym for ATTACK (presumably like KNOCK SOMEONE’S BLOCK OFF). Attack is usually blocked by default with the message “Violence isn’t the answer.” With that knowledge, you wouldn’t necessarily need to create a new action:

Instead of attacking the front door:
     say "You knock politely. There is no answer."
3 Likes