Verb Extension

I’m despairing of the verb extension definition. I need to parse three kinds of commands:

  1. drop X => normal
  2. throw Y off the table => VerbMyThrow1Sub
  3. throw Z at someone => VerbMyThrow2Sub
    No matter how I fiddle with extend (only) ‘throw’ (first/replace), one of the three commands always yields an unwanted result because one of the other two is parsed first. What do I need to do?

What does “drop” have to do with anything? Sounds like you’re not modifying the grammar for it.

Right now my current try is

Extend ‘throw’ first * noun ‘at’ noun → Verb_Throw;
Extend ‘throw’ * noun ‘off’ noun → Verb_Umhauen;

and the result for “drop object” is “What do you want to drop the object at?”.

Which library version are you using? At least in the current version, ‘drop’ and ‘throw’ are not synonyms, so changing the grammar of one should not affect the other. And ‘drop’ has no grammar containing ‘at’.

Compiled game says “Inform v6.31 Library 6/11 SD”. Is that the library version?

Yes. The current version is 6.12.4. (That’s like 6/12, increment 4).

1 Like

Drop and throw hasn’t been synonym for a long time. I think there’s a forgotten redefinition there somewhere that causes the confusion between the two.

In 6/11, where “drop” and “throw” are synonyms, you do this:

Extend only 'throw' first * noun 'at' noun -> Verb_Throw;
Extend 'throw' * noun 'off' noun -> Verb_Umhauen;

The first code line has “only”, which splits “throw” off into a separate grammar table (but keeps the existing grammar lines for it). Then it defines “throw X at Y”, tagged “first”, so that line takes precedence over the existing “throw X at Y → ThrowAt”.

The second code line doesn’t need “only”, because “throw” is already de-synonymed. It just adds a new “throw X off Y” grammar line.

3 Likes

Note that this solution interprets “throw rock” as “throw rock (at something)” and tries to guess a second noun. If you want to retain the original handling of “throw rock” as a synonym for “drop rock”, you’d have to add another line.

(sounds very promising, will try tonight!)

Thanks Zarf! Works 100 %! Case closed.

Thanks for pointing out my library is outdated, Fredrik! Game’s almost finished, so I’ll go with my shabby one, and then never return to Inform 6 again.

Don’t say that. Inform 6 is great. Steep learning curve, but still great.

Further to what the others have already said:

  1. Nothing needs to be done.
  2. ‘throw Y off table’ is bad English and I doubt that anyone would even think to try it. To throw something, it must first be in your possession and if it’s on the table, then it’s not in your possession. Therefore, this definition can be deleted.
  3. In the 6/11 library, throw object at something is already defined in the library’s grammar, specifically * held 'at'/'against'/'on'/'onto' noun -> ThrowAt; Therefore, you can delete this one, too. Just use ThrowAt in your before and after routines.

Nah. I do prefer I6 over I7 (part from I7’s great IDE…), but viewed from my LPC/C++ background the concept of storing everything in a “dictionary” and represent it through numbers is obscure and antediluvian. I’m pretty sure that when I’m done with this game (2031, if I keep up my speed) I’ll find most of what I want in TADS.

(and “throw X off table” is just a synonym for “knock X off table”)

1 Like