I’m learning Inform (Version 1.82.3), so it’s possible I’m the one bugging, but I’m not allowed to exit anything in my game.
I discovered this when implementing a shower (with a stall container and a spigot device as parts), and added an instead to make “enter shower” try entering the stall. Works great.
But the exact same rule added for exiting makes the run command seize up.
So I cut that special rule from my source and added an enterable cardboard box as a test…
You can see a cardboard box (empty) here.
>enter box
You get into the cardboard box.
>exit box
I only understood you as far as wanting to exit.
>get out of box
I only understood you as far as wanting to get outside
Again, this block is happening with no special rules in place. Help?
It’s not you, it’s Inform. From the Standard Rules:
Exiting is an action applying to nothing.
Understand "exit" as exiting.
(… and a few more synonyms for exiting.)
So, as you can see, Inform defines exiting as an action with no noun. If you type >EXIT, that would have gotten you out of the box, but not >EXIT BOX.
I believe there’s an extension, “Modified Exit” by Emily Short, that does provide a way for the parser to understand >EXIT BOX, but I’m not sure if it’s been updated for the latest Inform.
I believe the extension small kindnesses by aaron reed will do the modified exit as well as several other ‘small kindnesses’ and works with the latest inform7.
Learning Inform started out feeling like brain surgery with mittens on in a dark room. But now there’s a bit of light, and I finally found the finger holes. Now it’s a question of figuring out what’s what in the brain itself.
"Exiting Something"
Laboratory is a room.
A cardboard box is an enterable container in Laboratory.
Leaving it is an action applying to one thing. Understand "exit [something]" as leaving it.
Check leaving it:
try exiting instead.
Exiting Something
An Interactive Fiction
Release 1 / Serial number 241125 / Inform 7 v10.1.2 / D
Simple, but you might want to put in some checks in case the player types “EXIT SWORD” or “EXIT NORTH”. (Which would not make sense as the exiting action.) Or exiting an object that they happen not to be in at the moment.
Check leaving it:
if the noun is not a container:
say "[The noun] isn't capable of making a dramatic exit." instead;
if the noun does not contain the player:
say "You aren't inside [the noun]." instead;
otherwise:
try exiting instead.
Understand "exit [a direction]" as a mistake ("Please try 'go [noun]' or just '[noun]' as a direction isn't necessarily an exit here.")
Laboratory
You can see a cardboard box (empty) and a sword here.
exit box
You aren’t inside the cardboard box.
exit sword
The sword isn’t capable of making a dramatic exit.
enter box
You get into the cardboard box.
exit box
You get out of the cardboard box.
Laboratory
You can see a cardboard box (empty) and a sword here.
Thank you, this is helpful food for thought! I’m still getting used to the ways I need to word things for Inform to even recognize it as code.
Here’s a related n00b question: Why couldn’t I say something like:
Leaving it is an action applying to one enterable container.
I plan to have more than one “enterable” container in my game, and it feels like this would resolve @zarf’s point about “exit sword.”
Of course, since nobody’s suggested I use the above construction, and (for now) I haven’t seen anything like it in the documentation, I assume it’s only possible to apply additional actions to the most zoomed-out of categories.
Leaving it is an action applying to one thing. Understand "exit [enterable container]" as leaving it.
But then you have a worse problem. Unless you’ve specified a grammar line for things as well, you’ll end up with behavior like:
Lab
You can see a cardboard box (empty), a can and a stool here.
>go stool
You get onto the stool.
>exit stool
You can’t see any such thing.
>exit can
You can’t see any such thing.
The only time you’d want to use grammar lines with specific tokens like [container] is when you already have a default behavior and you want to add a special action in only a specific case. For example, if you’ve created a kind of thing called “clothing,” you might want “switch [clothing]” to be directed to some new action, while leaving the fallback to the switching on action.
Problem. You wrote ‘Nooping is an action applying to one supporter’ : but an action can only apply to things or to kinds of value, for instance: ‘photographing is an action applying to one visible thing’.
See the manual: 12.7 > 12.7. New actions
I believe a supporter in Inform is a “kind of thing” with special abilities, not a generic thing nor a kind of value.
You can specify some requirements in the action.
Nooping is an action applying to one touchable thing, requiring light.
If the location is dark, or the noun is in a closed container out of reach, the action does not apply.
New actions apply to a thing and you sort the details out in the Check rules for the action.
Check nooping:
if the noun is the sword:
say "Don't do that, you might cut yourself!" instead;
if the noun is not an enterable supporter:
say "I'm not sure that's physically possible." instead;
You can divide check rules; Inform will select the most specific rule that fires to apply.
Check nooping:
if the noun is the sword:
say "Don't do that, you might cut yourself!" instead.
Check nooping:
if the noun is not an enterable supporter:
say "I'm not sure that's physically possible." instead.
Or
Check nooping when the noun is the sword:
say "Don't do that, you might cut yourself!" instead.
Check nooping when the noun is not an enterable supporter:
say "I'm not sure that's physically possible." instead.
Be aware that both above rules would apply to the sword. If you don’t stop the rule with “instead” or “stop the action” Inform will continue running through rules until the action succeeds for fails - which may be bad or good depending what you’re doing.
First check nooping the heavy boulder:
say "Okay, let's try this...";
Which technically qualifies as a Before rule, but Inform is flexible. (The Before rulebook runs before the Check rulebook, and is meant to set parameters or prevent an action before it is even considered.)
Before nooping the heavy boulder:
say "Okay, let's try this...";
if the the player has arthritis:
say "Ow, bad knees, there's no way..." instead.