ZLib -- Zarqon's useful function library

Code:
> version

KoLmafia v16.7 r15085
Requests complete.
> svn update

Updating all SVN projects...
zekaonar-0-PVPBestGear is at HEAD (r7)
therazekolmafia-canadv is at HEAD (r46)
bale-new-life is at HEAD (r30)
eodscascension-0 is at HEAD (r52)
therazekolmafia-thesea is at HEAD (r39)
mafiachit is at HEAD (r196)
Validating repo...
Repo validated.
Updating mafiarecovery...
svn: E155004: Working copy '/home/smasherton/.kolmafia/svn/mafiarecovery' locked
Done.
mafia-harvest-data is at HEAD (r4)
winterbay-mafia-farm is at HEAD (r16)
rlbond86-mafia-scripts-auto_mushroom-trunk is at HEAD (r37)
bale-ocd is at HEAD (r28)
winterbay-mafia-sushi is at HEAD (r4)
wrldwzrd89-mafia-scripts-trunk-pandamonium-quest is at HEAD (r7)
Validating repo...
Repo validated.
Updating bumcheekascend-bumcheekascend...
svn: E155004: There are unfinished work items in '/home/smasherton/.kolmafia/svn/bumcheekascend-bumcheekascend'; run 'svn cleanup' first.
Done.
slimetube is at HEAD (r7)
psychoseamatic is at HEAD (r12)
bumcheekascend-bumpork is at HEAD (r544)
winterbay-mafia-autobasement is at HEAD (r34)
slyz-nemesis is at HEAD (r5)
bestbetweenbattle is at HEAD (r18)
clilinks is at HEAD (r5)
guyymafia-porkfuture is at HEAD (r160)
rlbond86-mafia-scripts-enhanced_inventory_spoilers-trunk is at HEAD (r37)
fluxxdog-coding-trunk-superdrinks is at HEAD (r8)
bumcheekascend-snapshot is at HEAD (r544)
batbrain is at HEAD (r50)
formhtml is at HEAD (r1)
winterbay-mafia-wham is at HEAD (r41)
autobhh is at HEAD (r1)
bale-counterchecker is at HEAD (r17)
smartstasis is at HEAD (r17)
zlib is at HEAD (r23)
Validating repo...
Repo validated.
Updating therazekolmafia-eatdrink...
svn: E155004: There are unfinished work items in '/home/smasherton/.kolmafia/svn/therazekolmafia-eatdrink'; run 'svn cleanup' first.
Done.
Ezandora-Guide-branches-Release is at HEAD (r219)
Checking for working copy modifications...
svn: E155032: Pristine text not found
Requests complete.

> wear

Hat: Hairpiece On Fire
Weapon: Shakespeare's Sister's Accordion
Off-hand: Half a Purse
Shirt: cane-mail shirt
Pants: stainless steel slacks
Container: Cloak of Dire Shadows

Acc. 1: droll monocle
Acc. 2: plaid pocket square
Acc. 3: plaid pocket square

Pet: Grimstone Golem (35 lbs)
Item: grimstone galoshes

And your point is? You clearly have some SVN errors but AFAIK they have nothing to do with zLib.

As for the SVN errors it superficially looks like something on your system is hosed in which case I would suggest using the Script Manager options to delete and reinstall the offending scripts. if that doesn't work i would uninstall the script, determine the SVN directory being used, delete it, and then install the script.
 
It seems that Universal Recovery, Eat Drink and bumcheek ascend have installation issues preventing them from updating to the latest version, but there is nothing wrong with the installations that relate to this problem. Sadly no good clues other than the name of the accordion you are using.

I'd recommend you follow Winterbay's advice to increase verbosityy: zlib verbosity = 11

Let us know what that does when you run a fight. (Copy/paste the result from the CLI.)

When you're done testing you'll want to reduce verbosity: zlib verbosity = 3
 
I am receiving the follosing error. I assume it is being called from WHAM, but I know nothing.

Code:
Expression syntax errors for 'modifier_eval()':
Can't understand songduration-10)/3
Expected ), found (zlib.ash, line 186)
You're on your own, partner.
Click here to continue in the relay browser.

I received the exact same error, for the first time, today.

It was preceded by an error that indicated an error in communicating with the KoL server. On the surface it looks like a either a mood tried to fire or a pre-combat script, or both, and when Mafia's connection to KoL wasn't active.

Logging out and then back in dropped me back into a combat and everything worked as it should.
 
r24 Update

Now I've gone and done it. I removed a function from ZLib!

Say farewell to tower_items(). Though a lovely function in its time, its time has passed.

Re: the modifier_eval() error discussion, though it may not be clear from the error message, which specifies ZLib, all of that is BatBrain/WHAM related. The error is happening because a non-erroneous ZLib function is erroneously being given bad data by an erroneous other script. The Shakespeare's Sister's Accordion is, in fact, an accordion; you did, in fact, have it equipped; and thus I am at a loss as to how batfactors might be being parsed before set_monster() is called by act(). Regardless, please continue discussion of that error in the BatBrain or WHAM threads. Thank you.
 
r24 Update

Now I've gone and done it. I removed a function from ZLib!

Say farewell to tower_items(). Though a lovely function in its time, its time has passed.

Glad to see you back and active.

That said, would you elaborate on why you elected to eliminate the function rather than have it return a beehive and electric boning knife? In cases where tower_items() was being used to farm for the items I can see it still having some value. In cases where it was used to reserve an item so it wasn't used, maybe not.

Thanks.
 
Hey there frono! The ZLib function was helpful because the list of tower items was a) fairly long, 2) of varying surety depending on your telescope, and III) varied based on your path.

None of those are true anymore. We don't need to consult the telescope, and the list is short and doesn't vary. The function can now be replaced by a hardcoded set of $items[], meaning there's no need for a function.
 
Hey there frono! The ZLib function was helpful because the list of tower items was a) fairly long, 2) of varying surety depending on your telescope, and III) varied based on your path.

None of those are true anymore. We don't need to consult the telescope, and the list is short and doesn't vary. The function can now be replaced by a hardcoded set of $items[], meaning there's no need for a function.

Got it. Thanks.
 
If found one source of the modifier_eval() problem:

Code:
Expression syntax errors for 'modifier_eval()':
Can't understand custom, endscombat (zlib.ash, line 186)

Item # 7542 "space invader".

If I closet the item or tell WHAM not to use it the problem goes away. Does anyone have any thoughts on why?
 
Yep, turns out I missed a tab when adding it to the data file. Fixed batfactors uploaded.
 
Last edited:
I was toying around with load_kmail(), and I noticed that it doesn't preserve line breaks. Turns out this is an issue with KoL's PHP view of the datafile.
Code:
"message":"a b\r\nc d\r\ne f"
vs.
Code:
'message' => 'a b c d e f'

I get the feeling that if I submit this bug report to KoL, it'll be filed away and not actually addressed for a long long time, if ever.

edit:
Code:
   matcher k = create_matcher('"id":"(\\d+)","type":"(.+?)","fromid":"(-?\\d+)","azunixtime":"(\\d+)","message":"(.+?)","fromname":"(.+?)","localtime":"(.+?)"'
      ,visit_url("api.php?pwd&what=kmail&count=100&for="+url_encode(calledby)));
should do the trick.
 
Last edited:
Code:
Expression syntax errors for 'modifier_eval()':
Can't understand greasy) (zlib.ash, line 186)
You're on your own, partner.

It seems that zlib doesn't understand the skill "Grease Up".
 
Getting something similiar
Code:
Expression syntax errors for 'modifier_eval()':
Can't understand songduration-10)/3
Expected ), found (zlib.ash, line 186)
 
r25 Update

Thanks to heeheehee providing a new matcher for the JSON data from api.php, we can now preserve line breaks in the kmail messages.

Also, since is_goal(stat) returning true by default for your primestat has unwanted consequences in BBB and possibly other scripts, I've commented that line out. Calling scripts can simply add an additional check for primestat if retaining such functionality is desired.
 
r26 Update

ZLib had 7 instances of numeric_modifier() that got broken by recent changes to modifiers. Fix those.

While I was at it, I added support for the new $servant type to both setvar() and normalized().

And a small speed tweak: we now load use_for_items statically, without version checking since so far as I know, no one has edited that file in ages.
 
ZLib seems to be broken, whenever I try to run WHAM it outputs this error

Code:
[250] The Defiled Alcove
Encounter: modern zmobie
Round 0: DeathPhoenyx loses initiative!
You lose 14 hit points
WHAM: Running SmartStasis
WHAM: Starting evaluation and performing of attack
Expression syntax errors for 'modifier_eval()':
Expected end, found pasta (zlib.ash, line 188)
You're on your own, partner.
 
I think I need to put something prominently in the first post explaining that these are not ZLib errors. The error message sends people here, they need to be redirected somehow.
 
Back
Top