OK, my WIP is proceeding nicely; thanks for the earlier help.
However, I’m having to do what I consider “hackery” to impose the NSEW vs FAPS paradigms. I had thought that by saying
[code]Cabin is a room.
Common Area is port of Cabin.
Cargo Hold is aft of Common Area.
Ship is a region. Cabin, Common Area, Cargo Hold are in Ship.
To decide if a location is shipboard:
If the location is regionally in ship, decide yes;
decide no.
[/code]
I could then say
[code]Before going a shipboard direction when the location is not shipboard, say “Shipboard directions can only be used on board ship.”
Before going an earthbound direction when the location is shipboard, say “Compass directions make no sense on board ship, but you can use [list of shipboard directions] instead.” instead. [/code]
(shipboard and earthbound directions are defined as in Example 40, except that I used “shipboard” where the example uses “nautical”).
However, that didn’t seem to work. To make the directions restrictions work as expected, I ended up adding
It is shipboard.
to the definition of every room that was in the ship region.
Obviously, I’ve misunderstood something. What, and what should I have done instead?
To decide if a location is shipboard:
If the location is regionally in ship, decide yes;
decide no.
are redundant. The first one makes “shipboard/earthbound” into a property that you can (and must) set manually in the code, the second makes it something that gets automatically calculated depending on what region the room is. So I think if you delete the first line from your code (and add another to-decide phrase that a location is earthbound if it is not shipboard), it should work.
UPDATE: As Felix points out, you can also use a definition rather than a to-decide.
Definitions create new adjectives, which may be used in descriptions (e.g. “[The list of visible people]”). To decide… does not IIRC.
To decide… can take multiple arguments (“To decide whether (A - a thing) and (B - a thing) jive together:…”), although if there’s only two arguments, it might be better to use a relation (“Jiving relates a thing (called A) to a thing (called B) when…”). OTOH I think relations like that are one line only, so you may end up defining the relation in terms of a to decide… phrase.
Also, you can say things like “To decide which room is the interesting room…”, which Definition:… is IIRC unable to do.
EDIT: One last thing, if you say something like “To decide whether (X - a thing) is interesting:…”, you will only be able to use that adjective like this: “If the thingy is interesting:” (although you can replace “thingy” with a variable). In particular, you cannot say something like “Instead of examining an interesting thing:…”. Therefore, if you only need one argument (x), it’s almost always better to use a definition.
TL;DR: Don’t create a phrase (some kind -> truth state) phrased like “To decide whether X is interesting:”; use a definition instead. It may make sense to create a phrase (some kind, another kind -> truth state) (“To decide whether X and Y are interesting together:”), but it’s probably better to use a relation for that, and if you do make a phrase, you’ll probably end up making a relation as well anyway. If you have a phrase (kind, kind, kind -> truth state) (“To decide whether X and Y are involved with Z:”), however, there’s nothing obvious to use instead.
A-HA! That’s 'splainy, and tells me that a Definition would work well for my purposes - which, upon experimentation, it does. Thanks to all who’ve replied!
(Does anyone mind if I say that Inform 7 is DAMN GOOD!?)
To decide if a location is shipboard:
If the location is regionally in ship, decide yes;
decide no.
In general, “a location” will be interpreted to mean “the location”. If you want to talk about a specific room, you need to say “a room.”
But when you define a “to decide” phrase, there are no variable substitutions except those placed in parentheses, so the words “a location” or “a room” would have to match exactly in order to invoke the phrase. If you say:
if the Poop Deck is shipboard:
I would not expect that to compile unless you change the phrase definition to:
Entirely possible; I don’t rule out the possibility that I was ‘seduced’ into error by the apparent natural-language-ness of Inform 7. I will definitely be looking into that again; I have no doubt that I will need a similar structure at some point in this WIP. For now, though, the Definition: alternative is working for what I attempting when I started this thread.
I’ve made myself a note to refer back to this thread and to check “To decide…” in the documentation, instead of trying to rely on memory.
I thought of something I wanted to add. For a while I was using rulebooks to decide a lot of things about objects, which is a bit slow. I was afraid to involve Inform’s phrase-overloading features because they can’t be manually controlled like rule order can. But they are quite powerful and reliable, and in any case are usually easy to test. Here’s an example of overloading:
Not overloaded, difficult to extend:
Definition: a thing is noisy:
If it is Silent Bob, no;
If it is a person, yes;
If it is a device, yes;
no.