ZLib -- Zarqon's useful function library

For your case, is there a reason to make the filenames user-configurable?

I use the same cleanup file (OCDdata_shared.txt) for all my multis.

I still think it's possible to work around the problem. I could pass an empty string as the default value to setvar(), then use the player's name if getvar() returns an empty string. Unfortunately, my hands are full, so I can't test the idea right now.

P.S. If you do remove vars, could you provide an alternative way to programmatically modify a variable? I could call cli_execute("zlib somevar = newvalue") but it's rather clunky and slow.

I have recently acquired an effect (intrinsic): Dad, though, so my coding time is quite limited at the moment.

Congratulations, and thank you for contributing to the sum of humankind!
 
I did as you asked and found "vars[" in quite a few scripts that I've accumulated over the years. Some of them are minor but EatDrink is not.
View attachment 10240

Okay, over the last several days I've taken this list on as a project. Some of these scripts (namely Rinn's and soolar's) were hosted on github, so I submitted pull requests (which have already been merged).
  • FamiliarDrops
  • AcquireBuff
  • flavour

Some of these scripts (Theraze's) were already using vars correctly:
  • TheSea
  • EatDrink (note the commit notes for r55)

Some of these scripts I can't fix because I couldn't find them on the forums:
  • lib_markup
  • auto_restore
  • spellKill
  • LevelUpRewrite (found LevelUp, but it's so obsolete that it requires... a rewrite)
  • corelib

Some of these scripts appear obsolete:
  • profit_fx
  • DAM
  • autoBasement (Is this still in use? My copy from when I went basementing years ago is very different from the current one in the forums but I could bump this down to the below category if useful.

For the rest, I have created edited versions which use getvar(). My next question is what to do about them. Should I necro all the related threads with attachments? Should I ask a person with forum admin powers to replace the attachments in first posts rather than necro these old threads? Open to suggestions.
 

Attachments

I used autoBasement last year, so there's one data point.

The topic of maintaining old scripts would probably belong to this thread. Abandoned projects could be moved to Github under the LASS org to allow multiple people to contribute. Admittedly, contacting people who no longer play is often difficult, and licensing becomes a problem.
 
Request: Can we deprecate (and eventually remove) equals(str1, str2)? It's supposed to case-sensitively compare two strings, but is now redundant because the == operator became case-sensitive in KoLmafia r16180. This was 6 years ago, and I doubt anyone is using equals() now.

I'm submitting a patch that (1) removes all usages of equals() in ZLib itself, and (2) prints a once-per-session warning if equals() is called.
 

Attachments

I'm seeing the once per session warning, when going into combat. Do I need to set up a debug log before entering combat, or would this be something caused by Smart Stasis and/or WHAM?
Edit: Went ahead and made a debug log, but it's too big to upload. Did another session and only fought once, finally got a debug log small enough to upload.
 

Attachments

Last edited:
I'm seeing the once per session warning, when going into combat. Do I need to set up a debug log before entering combat, or would this be something caused by Smart Stasis and/or WHAM?
Edit: Went ahead and made a debug log, but it's too big to upload. Did another session and only fought once, finally got a debug log small enough to upload.

I'm afraid I don't understand what you consider the "once per session warning" and as a consequence I'm not sure what to look for in the log to try and explain it.
 
"ZLib: equals() has been deprecated; please use the == operator" is the warning I mean. It only shows up once per session, on the first automated fight. Which, for the log file, I did the following:
1: logged in.
2: started logging.
3: did 1 automated fight.
4: stopped logging after said fight.
 
WHAM calls BatBrain which does have an equals() call.

Code:
   if (count(m.random_modifiers) == 0 && !equals(to_string(m), get_property("lastEncounter")) &&
 
Hi - I've been getting an error in KolMafia today: Bad class value: "ed the undying" (zlib.ash, line 503). Does anyone know how I can fix it? Thank you!
 
Hi - I've been getting an error in KolMafia today: Bad class value: "ed the undying" (zlib.ash, line 503). Does anyone know how I can fix it? Thank you!

If you are getting the message I've seen, it's not an error that stops things and it should tell you you can edit the script and change something to make the message go away. If that is not your experience than I wonder if you are running a recent enough version of KoLmafia?

It might be appropriate to update zlib's "since" directive.
 
If you are getting the message I've seen, it's not an error that stops things and it should tell you you can edit the script and change something to make the message go away. If that is not your experience than I wonder if you are running a recent enough version of KoLmafia?

It might be appropriate to update zlib's "since" directive.
Thanks for the response! Sorry, I'm new to using KolMafia - how should I update zlib's since directive?
I have the most recent version of KoLmafia I believe, version 26.143.
 
Thanks for the response! Sorry, I'm new to using KolMafia - how should I update zlib's since directive?
I have the most recent version of KoLmafia I believe, version 26.143.

The script author needs to change the since directive. Sorry for the confusion.

Your version should be new enough. Perhaps copying the exact error message and telling us what you were trying to do will narrow things down.

"new to mafia" is OK but forgive us if our first explanation relies on knowledge you don't have yet.
 
@fronoulax

Greetings from the past. To help elsyecat I rant text editor+ to get the line count:

}
// returns the amount of ka dropped by a given monster
float kadrop(monster m) {
if (my_class() != $class[ed the undying]) return 0;
float res;
switch (m.phylum) {
case $phylum[dude]: case $phylum[hippy]: case $phylum[hobo]: case $phylum[pirate]: res = 1;
case $phylum[beast]: case $phylum[bug]: case $phylum[elf]: case $phylum[fish]: case $phylum[goblin]: case $phylum[humanoid]:
case $phylum[mer-kin]: case $phylum[orc]: case $phylum[penguin]: case $phylum[elemental]: res += 1;
if (res > 0 && my_servant() == $servant[priest] && $servant[priest].level >= 14) res += 1; break;
case $phylum[undead]: if (have_equipped($item[the crown of ed the undying])) return 0.2; // total guess
}
return res;
}


In my case Harvest was calling the zlib script and when it sees "ed the undying" it errors out. I replaced Ed with a pastamancer and harvest ran just fine. I suspect the class ed the undying has been changed to something new.
 
@fronoulax

Greetings from the past. To help elsyecat I rant text editor+ to get the line count:

}
// returns the amount of ka dropped by a given monster
float kadrop(monster m) {
if (my_class() != $class[ed the undying]) return 0;
float res;
switch (m.phylum) {
case $phylum[dude]: case $phylum[hippy]: case $phylum[hobo]: case $phylum[pirate]: res = 1;
case $phylum[beast]: case $phylum[bug]: case $phylum[elf]: case $phylum[fish]: case $phylum[goblin]: case $phylum[humanoid]:
case $phylum[mer-kin]: case $phylum[orc]: case $phylum[penguin]: case $phylum[elemental]: res += 1;
if (res > 0 && my_servant() == $servant[priest] && $servant[priest].level >= 14) res += 1; break;
case $phylum[undead]: if (have_equipped($item[the crown of ed the undying])) return 0.2; // total guess
}
return res;
}


In my case Harvest was calling the zlib script and when it sees "ed the undying" it errors out. I replaced Ed with a pastamancer and harvest ran just fine. I suspect the class ed the undying has been changed to something new.


Thanks. What is detracting or confusing me is that KoLmafia did rename the path but my experience was that using the old path just generated a message and not actually a script failure or abort. So is this experience due to some kind of version mismatch or is there a KoLmafia bug? Adding to the confusion is that it is not happening for me.

The name should be "Ed the Undying" and that change happened in Nov. 2021.

Pondering.
 
Back
Top