I7: Problem

Sorry for the inappropriate header, but this time it’s two things I don’t understand.

Two statues. Player shall be able to turn each of it left or right.

Problem 1: How to parse “left” and “right”?
My first guess was to use invisible dummy objects named ‘left’ and ‘right’, but that turned out to be crap. Then I thought I could use the ‘left’/‘right’ IDs of the statues to parse it, like, “turn left statue left” being understood as “turn left statue left statue” which I could parse. See problem 2. Now, what can I do to parse this?

Problem 2: How do I parse stuff and then handle it over to the system parser?

The left statue is here.
Instead of turning the left statue, say "Do you want to turn the left statue left or right?".

Understand the command "turn" as something new. Turning it is an action applying to two things. Understand "turn [something] [something]" as turning it.

Produces garbage. But besides to my approach to problem 1 being crap, how do I add a parsing definition for a verb but have the system parser parse stuff I don’t want to catch? Like, the system parser would understand “verb object”, and if I want to catch “verb object object”, how can I put my parse routine in front of what the parser would usually do, but in case of unsuccessful parsing let the system parser do the rest?

I don’t think I understand your second question. You cannot parse stuff and then hand it over to the system parser; you can only define grammar lines which get added to the pre-existing grammar lines, and the parser uses those grammer lines to parse commands. (I guess that technically you could use “after reading a command” rules to build a pre-parser, but why would you want to?)

The way to go for implementing turning left and right is actualli quite simple. I would do it like this (untested code):

Left-turning is an action applying to one thing. Understand "turn [something] left" and "turn [something] to the left" and "rotate [something] left" as left-turning.

And then an equivalent line for turning something right.

If you want a more robust system that allows people to turn things in more directions, you could write something like this:

[code]Turn-direction is a kind of value. The turn-directions are left, right, forwards and backwards.

Direction-turning is an action applying to one thing and one turn-direction. Understand “turn [something] [turn-direction]” as direction-turning.[/code]
There may be mistakes in this code – I didn’t try to compile it – but the basic scheme is correct.

Sorry for coming back to this.

Understand the command "turn" as something new. Left-turning is an action applying to one thing. Understand "turn [something] left" and "turn [something] to the left" and "rotate [something] left" as left-turning.
Check Left-turning when the noun is the left statue: say "TEST" instead.

results in “I didn’t understand that sentence.” when entering “turn left statue left”. I suspect that’s because the original “turn” rule applies. What must I do about this?

[size=50]If you brrod over the time gap, I was busy with my main game.[/size]

No, you successfully eliminated the original “turn” grammar with your “understand … as something new” line.

The problem here is that, by default, I7 doesn’t enforce any ordering of adjectives and nouns. So “x statue”, “x left statue”, and “x statue left” are all equivalent. For your grammar, it matches “turn” as the verb, matches “statue left” as the noun, and then fails to find the word “left” to complete the grammar line.

The solution is easy: you have to make the statue respond to “left statue” but not “statue left”.

The left-statue is here. The printed name is "left statue".
Understand "statue", "left statue" as the left-statue.

(When you add a right statue, you’ll get correct disambiguation on “turn statue left”.)

With that out of the way, I would not actually knock out the original turn grammar. This works well:


Left-turning is an action applying to one thing. 
Right-turning is an action applying to one thing. 

Understand "turn [something] left" and "turn [something] to the left" as left-turning.
Understand "turn [something] right" and "turn [something] to the right" as right-turning.

Carry out left-turning:
	say "Turned [the noun] left."
Carry out right-turning:
	say "Turned [the noun] right."

Check turning the left-statue:
	instead say "You could turn it left or right."
Check turning the right-statue:
	instead say "You could turn it left or right."

Now “turn wheel” works as usual (which you may want elsewhere in the game). “Turn left statue” tells the player to be more specific.

Note that the more-specific reply is not phrased in the form of a question. This is because the parser’s disambiguator isn’t engaged. If you print “Do you want to turn the left statue left or right?” then the player will type “left”, which won’t work.

Unfortunately, there is no built-in way for you to get the disambiguator lined up. (There’s an extension which does this, but don’t get into that until you’re more familiar with the basic I7 model.)

If you use a kind of value, it gets slightly simpler:

Rotation is a kind of value. The rotations are left and right.

Dir-turning is an action applying to one thing and one rotation. 

Understand "turn [something] [rotation]" as dir-turning.
Understand "turn [something] to [rotation]" as dir-turning.
Understand "turn [something] to the [rotation]" as dir-turning.

Carry out dir-turning:
	say "Turned [the noun] [the rotation understood]."

Check turning the left-statue:
	instead say "You could turn it left or right."
Check turning the right-statue:
	instead say "You could turn it left or right."

Now there’s only one special action, not two.

Also, it’s probably a good idea to make the statues distinct in some other way! If one of them is “chipped” and the other is “worn”, a player uncomfortable with the “turn left statue left” thing will have an alternative way to phrase it.

Maybe one statue looks really sinister, and the other one looks really, um,

[size=50]dextrous[/size]

Shalala, I’m on my way… Thanks Zarf!!!1