Before putting on doesn't work?

Hello all. I recently started learning inform7. I had been interested in inform in general for some time but found the previous incarnations of the language to be a little too daunting. Inform7 seemed to be much more intuitive.

I’ve run into what is either a bug or I’m just being stupid. I want to be able to gate wearing something. Here’s a bare-bones standalone script that demonstrates the issue:

dangerous clothing is a kind of thing and wearable. the mysterious cloak is dangerous clothing.

before putting on dangerous clothing:
    say "Your instincts as an explorer tell you this is a very bad idea.";
    stop the action;

Ancient Tomb is a room. The player and the mysterious cloak are here.

The expected result is that I’m blocked from wearing the cloak. Instead, it always let’s me put it on. When I run the RULES command beforehand, it doesn’t even list my before rule at all, like it simply got ignored.

I also tried it this way:

instead of putting on dangerous clothing, say "Your instincts as an explorer tell you this is a very bad idea."

This gets ignored as well. But blocking removing clothing works. If I add this:

instead of taking off dangerous clothing, say "You can't, it's cursed."

It works perfectly. So if I did hit a bug, is there any workaround to this?

This is just a bit of fiddly terminology: the action for putting on clothing is not “putting on” but “wearing”. So you need to say “instead of wearing dangerous clothing”.

(The reason you don’t get an error is because “putting on” is also an action in Inform; it’s the action for “put kettle on stove”.)

3 Likes

Yeah, I figured it was something dumb like that. I think I assumed it was “putting on” I wanted because if seemed to compliment “taking off”. As much as I’m enjoying this, I do find it a little frustrating that I have not been able to find a complete list of all the predefined stuff like this. If it’s not in an example in the documentation, I often have to guess.

Thanks for the clarification. I’ll probably be coming back with other questions.

The easiest ways to see all the predefined actions is in the Index – if you’re using the IDE, you can click on that once you compile a project and see all the actions in the game, including the built-in ones; you can click on each to get more details. You can also check out the Standard Rules, which you can also find in the Index under extensions (there’s a good web-based version here, too).

If looking at the whole enchilada is more than you need, an easy way to check how Inform is translation player input into an action is the ACTIONS testing command; you can just type that, and then it’ll display exactly what action is being tried after parsing input.

4 Likes

Thanks for the advice. Yeah, I’m using the IDE because I like having the documentation right there and I love how it creates a little map of the rooms to give me a better sense of the layout.

1 Like

Yeah, the Index is your best friend for problems like this—which is why it frustrates me that new users aren’t directed to it very well! I really think of it as the third piece of the documentation, alongside Writing with Inform and the Recipe Book.

2 Likes