ZLib -- Zarqon's useful function library

philmasterplus

Active member
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!
 

zarqon

Active member
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

  • getvars scripts.zip
    107.9 KB · Views: 2

philmasterplus

Active member
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.
 

philmasterplus

Active member
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

  • deprecate-equals.patch
    2.7 KB · Views: 2

VladYvhuce

Member
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

  • DEBUG_20210905.txt
    197.1 KB · Views: 3
Last edited:

fronobulax

Developer
Staff member
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.
 

VladYvhuce

Member
"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.
 

Crowther

Active member
WHAM calls BatBrain which does have an equals() call.

Code:
   if (count(m.random_modifiers) == 0 && !equals(to_string(m), get_property("lastEncounter")) &&
 
Top