object potato "potato"
{
article "a"
adjective "hot" 0
noun "potato"
in you
}
Now, I couldn't really decide on an intuitive name for the routine, but since I figured it was for games where objects are passed around between characters a lot, I opted for the name "HotPotato":
attribute keep_adjectives
routine HotPotato(obj,new_parent)
{
local a
a = parent(obj)
if a is living and obj is not keep_adjectives
{
if CharacterKey(a)
obj.adjective #(obj.#adjectives) = 0
}
if not new_parent
remove obj
else
{
a = CharacterKey(new_parent)
if Acquire(new_parent, obj) and obj is not keep_adjectives
{
if a
obj.adjective #(obj.#adjectives) = a
}
}
If not provided with a "new_parent" object, HotPotato just removes the object after clearing any applicable adjectives. Any game that uses this would have to provide its own CharacterKey routine, which would look like this:
routine CharacterKey(char)
{
local a
select char
case fred: a = "fred's"
case player: a = "my"
return a
}
Now, all of this work is kind of useless since among games with characters, there usually isn't so much object-swapping that most of this couldn't be done by hand. Plus, you'll notice that HotPotato only checks for one layer of containment in characters and there might be games where you'd want to check for grandchildren (or further). Still, this is as close to automating this in Hugo as it's going to get, I think.
There's also the issue of words like "your","my","his", and "her" (>ASK FRED ABOUT HIS HAT). I find the best solution is to just define these words as removals so the parser completely ignores them.
removal "his","her"
removal "my","your"
How many of these you define as removals depends on your game (games like Spur use "your" as a permanent adjective for certain things). Also, because of games like Spur where some objects keep a certain ownership despite who is carrying them (like, "your gun" compared to "O'Grady's gun"), I added that keep_adjectives attribute to give objects that should be left alone.
I want to test this code when I re-write "Tree and Star" (which I'm scheduling to begin doing in less than two weeks due to a different project falling through). If that works out, I'll send you notes/transcripts, or whatever, if you want.
ReplyDeleteAs always, thanks for doing all this.