r35 Updates!
Since this update will save you time, I figured that justified taking your time by posting another update for you to download.
The big timesaver is that all forms of ZLib's has_goal() have been sped up considerably. Previously, has_goal(item) iterated over all items to see if the item being considered was an ingredient of any goals. Calling has_goal(monster) was slower still, because it calls has_goal(item) for each item the monster might drop. Finally, has_goal(location) dragged along, since it calls has_goal(monster) for each monster you might encounter. I have a macro called "goalinfo" which calls has_goal() on all items, monsters, and locations to tell me which items are/contain goals, which monsters drop goals at what rate, and which locations yield goals -- and until recently it took about a minute to run, due to all that "iterating over all items over and over" business. It was ugly and inefficient, but there was no better way.
Now, there is a better way. Hola has made goals accessible to ASH in new and exciting ways. For starters, has_goal(item) can check ASH's new goal_exists("item") right off the bat to see if there even are any item goals, and return 0 if not, without even getting into its calculations. Secondly, rather than iterate over all items to identify goals, we can now iterate over ASH's new get_goals(), which is so much smaller than the current number of items that the performance increase is massive, despite the fact that we have to run a matcher on each goal and then convert it to an item.
These new functions add up to has_goal() being significantly less expensive, and just as accurate. It's particularly noticeable using my (unedited) macro, which now finishes in about a second. SmartStasis contains 7 has_goal() calls in various places, so that will speed up a bit too. Exciting!
The second noteworthy change is a combination feature and bugfix, in reference to a discussion that occurred here back in December.
All functions which may benefit from using speculative values now include an optional usespec parameter. If omitted, it is assumed to be false and speculative values are not used at all. If true, speculative values are used. When using speculative modifiers, if you do not first speculate something, all modifiers will be 0 (_spec is empty). ZLib will help you avoid bizarre results by speculating nothing ("whatif quiet") if it detects that _spec is empty.
The following functions are now spec-optional, about the following modifiers:
int my_defstat( [boolean usespec] ) -- speculates about Buffed Muscle/Moxie
float has_goal(monster m, [boolean usespec] ) -- speculates about Item Drop and Pickpocket Chance
float has_goal(location l, [boolean usespec] ) -- speculates about Combat Rate
Any additional functions which may be added later will use this same format.
Any questions? Yes, you in the back.
Q: Does this update make my script more awesome?
A: If your script calls any form of has_goal(), it will be faster, which is awesome. If your script speculated and then used has_goal() assuming non-speculative results, your script will be fixed, which is awesome. So basically yes.
Q: Does this change break my script?
A: If your script previously speculated, and then relied on the speculative results given by has_goal(), you will need to change those calls to include the optional usespec parameter (true) -- otherwise non-speculative values will be used. So probably no, but possibly yes.