This was a pretty inelegant solution so I intended to try to come up with a better solution eventually. Well, that day ended up being yesterday, and here's what happened.
Originally, I tried to declare my own extra_scenery_words array and replace the room class's property array with a property routine that checked it. This was problematic.
The main thing was, Parse's extra_scenery checking code already checks every word in the word array against the extra_scenery property, so to find a match myself, I'd have to check every word array word against every extra_scenery_words word, so there's some wasted looping right there.
In the end, I thought the simplest solution was just to edit Parse and have it check the player object for extra_scenery words, too, so you can put your always-on extra_scenery there (this is also appropriate as I often use extra_scenery for player body parts that aren't implemented and such). The Roodylib Parse routine now has this:
for (a=2; a<=words and word[a]~="" and word[a]~="then"; a++)(I'm not going to upload a new release of Roodylib just for this, but it'll be in the next version, of course)
{
if Inlist(player, extra_scenery, word[a])
{
Message(&Parse, 1)
word[1] = "" ! force ParseError(0)
words = 0
customerror_flag = true
return true
}
elseif Inlist(location, extra_scenery, word[a])
{
Message(&Parse, 1)
word[1] = "" ! force ParseError(0)
words = 0
customerror_flag = true
return true
}
}
I figure this'll take care of the majority of extra_scenery needs. If you find that you really need to tie extra_scenery behavior to an object, I also came up with this work around:
- Have your init routine set one of your player.extra_scenery property elements to a call to a routine:
player.extra_scenery #3 = call &CheckStuff - Write a routine for the above that returns a dictionary word under the right circumstances:
routine CheckStuff
{
if FindObject(mess, location)
return "stuff"
}
No comments:
Post a Comment