I want to use commands “climb [something]” and “climb up [something]” to go up in the presence of something climbable. This is ok except when I type “climb up”. I would like to be asked “What do you want to climb?” but instead I am told something like “You must mention something more substantial.” It seems that “climb up” is being interpreted as “climb [direction]”. Is there a way to have it interpreted as “climb up [missing thing]” instead?
understand the command "climb" as something new.
understand "climb [thing]" as climbing.
understand "climb up/over [thing]" as climbing.
For reasons unclear to me, the grammar in the Standard Rules persistently uses the [something]
token instead of the [thing]
token. [something]
means any object in scope; [thing]
means any object of kind thing (or subkind thereof) in scope. So “climb up” matches "climb [somehing]"
but not "climb [thing]"
.
I should mention that I’m using 6M62 in case it matters.
Thanks for the example Zed. I tried it out on Borogrove and it seems like it may well be what I need.
Yes, that was exactly what I needed. Here is what I was working on in case anyone has further suggestions.
Chapter 0 - Prospective Changes
Section 0a - Zork Library / Zork Actions / Climbing
Understand the commands "climb" and "scale" as something new.
The block climbing rule is not listed in the check climbing rulebook.
Understand "climb [thing]" and "climb up [thing]" as climbing.
A thing can be climbable. A thing is usually not climbable.
Check climbing something not climbable (this is the block bizarre climbing rule): say "Bizarre!" instead;
Carry out climbing: try going up.
Understand "climb" and "climb up" as climbing when something climbable is in the location.
Rule for supplying a missing noun while climbing:
repeat with item running through climbable things in the location:
now the noun is the item;
the rule succeeds;
the rule fails;
Climbing down is an action applying to one thing.
Understand "climb down [thing]" as climbing down.
Check climbing down something not climbable (this is the block bizarre climbing down rule): say "Bizarre!" instead.
Carry out climbing down: try going down.
Understand "climb down" as climbing down when something climbable is in the location.
Rule for supplying a missing noun while climbing down:
repeat with item running through climbable things in the location:
now the noun is the item;
the rule succeeds;
the rule fails;
This is redundant 'cause “climb” and “climb up” are already always climbing.
this can be just:
now the noun is a random climbable thing in the location;
This will end up nothing
if there isn’t one; if something needs a noun and noun is still nothing after the rules for supplying a missing noun, the action fails.
Thanks Zed.
This is redundant 'cause “climb” and “climb up” are already always climbing.
… not if I want the rule to supply a missing noun to be triggered in the presence of climbable things.
now the noun is a random climbable thing in the location;
… great, that’s a lot more compact
This is the behaviour I was looking for.
Zork
The pre-Infocom classic, rewritten by Alex Proudfoot
Release 0 / Serial number 230708 / Inform 7 build 6M62 (I6/v6.33 lib 6/12N) SD
West of House
This is an open field west of a white house, with a boarded front door.
There is a small mailbox here.
A rubber mat saying 'Welcome to Zork!' lies by the door.
>climb
What do you want to climb?
>house
Bizarre!
>climb down
What do you want to climb down?
>house
Bizarre!
>n
North of House
You are facing the north side of a white house. There is no door here, and all the windows are barred.
>n
Forest
This is a dimly lit forest, with large trees all around. One particularly large tree with some low branches stands here.
>climb
Up a Tree
You are about 10 feet above the ground nestled among some large branches. The nearest branch above you is above your reach.
On the branch is a small bird's nest.
In the bird's nest is a large egg encrusted with precious jewels, apparently scavenged somewhere by a childless songbird. The egg is covered with fine gold inlay, and ornamented in lapis lazuli and mother-of-pearl. Unlike most eggs, this one is hinged and has a delicate looking clasp holding it closed. The egg appears extremely fragile.
>climb down
Forest
This is a dimly lit forest, with large trees all around. One particularly large tree with some low branches stands here.
>
The reason, I imagine, is to give more useful error messages than the unhelpful “I didn’t understand that sentence” (or “that noun did not make sense in that context”). If the grammar matches a direction (or room, or…) even when the action can’t apply to it, then the parser can give a more specific message instead of just saying no grammar line matched.
ok, yeah, I’m sure that’s right. But I think it would be a more clear net win if rooms and regions weren’t touchable things (which, admittedly, only comes up when an author goes out of their way to put them in scope).
Understand "climb" and "climb up" as climbing when something climbable is in the location.
I see what you’re getting at. But one consequence of this is that the parser only asks the disambig question (“What do you want to climb?”) when there’s nothing around to climb!
It might be better to just say “There’s nothing around here to climb.”
(One way to do this is for “climb” / “climb up” be a different action, vague-climbing
, which either select a climbable object or says “Nothing here to climb.” With that setup you don’t use a “supplying a missing noun” rule at all.)
Thanks Andrew. That would be a more sensible response and that’s how I would write it.
What I’m trying to achieve in my project right now is an I7 representation of the 1981 version of MIT Zork minus bugs but otherwise producing the same (or similar) outputs. This may be a tall order because the parsers differ and I’m not sure how much control I have over I7 parser messages in general but time will tell.
For a more precise rendering of the original, I would want to change “What do you want to climb?” to “Climb what?” and “What do you want to climb down?” to “Down what?”…
If there some way of doing this, it would be very useful to me.
Does anyone know of a way?
This is “parser clarification internal rule response (E)”. You can customize it (chapter 14.11) although customizing it for a specific verb takes a bit of work. Which I will leave as an exercise. :)
So, I’ve come up with this so far.
To say the disambiguation message:
let T be "[parser command so far]" in sentence case;
if the number of words in T is 2, let T be word number 2 in T;
say "[T] what";
The parser clarification internal rule response (E) is "[the disambiguation message]?".
This produces the following behaviour which is pretty much what I was looking for.
Zork
The pre-Infocom classic, rewritten by Alex Proudfoot
Release 0 / Serial number 230709 / Inform 7 build 6M62 (I6/v6.33 lib 6/12N) SD
West of House
This is an open field west of a white house, with a boarded front door.
There is a small mailbox here.
A rubber mat saying 'Welcome to Zork!' lies by the door.
>climb
Climb what?
>house
Bizarre!
>climb up
up what?
>house
Bizarre!
>climb down
down what?
>house
Bizarre!
>n
North of House
You are facing the north side of a white house. There is no door here, and all the windows are barred.
>n
Forest
This is a dimly lit forest, with large trees all around. One particularly large tree with some low branches stands here.
>climb
Up a Tree
You are about 10 feet above the ground nestled among some large branches. The nearest branch above you is above your reach.
On the branch is a small bird's nest.
In the bird's nest is a large egg encrusted with precious jewels, apparently scavenged somewhere by a childless songbird. The egg is covered with fine gold inlay, and ornamented in lapis lazuli and mother-of-pearl. Unlike most eggs, this one is hinged and has a delicate looking clasp holding it closed. The egg appears extremely fragile.
>climb down
Forest
This is a dimly lit forest, with large trees all around. One particularly large tree with some low branches stands here.
>
Many thanks to all for your help.
You can genericize the response a little bit instead of hardcoding word numbers:
To decide which text is the last word in (T - text):
let W be the number of punctuated words in T;
decide on word number W in T.
To say the disambiguation message:
let T be the last word in "[parser command so far]";
say "[T in sentence case] what";
The parser clarification internal rule response (E) is "[the disambiguation message]?".
Then you get interaction like:
>TAKE
Take what?
>PICK UP
Up what?