ZLib -- Zarqon's useful function library

Jar of Jam

Member
Code:
Expression evaluation error: Can't take square root of a negative value (zlib.ash, line 162)

Is this zlib acting out or is it autoBasement's fault ?
 

Theraze

Active member
It means that something was giving zlib a negative number to calculate as a square root and it shouldn't have. Veracity recently fixed mafia to actually care about impossible numbers. Whichever script is causing them needs to be fixed... probably autoBasement, based on what you said.
 

Winterbay

Active member
Code:
Expression evaluation error: Can't take square root of a negative value (zlib.ash, line 162)

Is this zlib acting out or is it autoBasement's fault ?

Huh? Could you post in the autoBasement thread what you were doing around the time it gave that result?
 

zarqon

Well-known member
Long time no posts in the ZLib thread! I am actually fairly happy about that -- must mean everything's been working as it should!

However, now it's time for a

Year-end Data Purge!

I'm posting this here because I believe more script authors/users are watching this thread than the Map Manager thread: I'd like to delete some of the maps on the Map Manager which are not (or should not) be in use anymore. So, please consider the following list of data files which I have marked for death. Where possible I have included the reason the data file is unnecessary:

  • bounty.txt -- this data is all available from $item.bounty, $item.bountycount, and $location.bounty
  • familiar_hatchling.txt -- now accessible as $familiar.hatchling
  • familiars_gifname_hatchlings.txt -- now accessible as $familiar.hatchling.image
  • hobopolis_outfits.txt -- accessible from outfit_pieces() and $item.image
  • pricelist.txt
  • price_list.txt -- I believe this and the previous to be remnants from the time before mafia was capable of price-sharing.
  • sry_phyla.txt -- this is just foreach p in $phyla[]
  • tattos_gifname_outfits.txt -- this is a misspelled version of tattoos_gifname_outfits, which also exists
  • warmedals_gifname.txt -- $item.image

From my limited point of view, I don't believe there is a reason for any of these data files to continue to exist on the Map Manager. If you know otherwise, please post about it here so that I can avoid causing problems by deleting a file which is still in use. If you authored/use a script which relies on one of these data files, post about it here. In the event that the script is using one of the data files rendered unnecessary by proxy records or other mafia functionality, let's see what we can do to update the script so as to not require a needless external file.

I won't delete any file which has been spoken for, up to and including all of them, but all of the listed files which have not been spoken for here will be deleted at the end of the year.

*thunderclap* *pipe organ playing fully diminished chord*

*a lone wolf howls*
 
Last edited:

Theraze

Active member
  • bounty.txt -- this data is all available from $item.bounty, $item.bountycount, and $location.bounty

Guess that means it's finally time to delete my copy of FTF from April 7, 2011. Farewell, legacy combat file. You served me well in the past.
 

StDoodle

Minion
Zarqon;

1) Is "std_NegativeStatusEffects.txt" useful to anyone? I could swear there was easier access to that one somehow, but haven't honestly looked into such things for a good while. Neat to see "pluralMonsters.txt" is still in use (and updated by others). Though, a $monster[] proxy for quantity would be kinda nifty. :)

2) Actually, I recently had some issues with kmail() & send_gift(); the way they're formatted, the visit_url()'s fail if called from the relay browser. I'd like to do some testing in the near-ish future, and see if there's a version that will work from both regular & relay scrits. If so, I'll post it here in the hopes that it can get merged.
 

Bale

Minion
Bug report!

send_gift() is failing for an unascended character because you try to use an "exactly-three-shaped box" despite the fact that does not become available until a character's third ascension. I'm going to have to use my own send_gift() function for OCD until zlib is fixes. Please update that.

There are a bajillion variations to fix that tiny problem and none of them are difficult so I won't bother to post any code. You'll find the problem between lines 685 and 689. Limit pnum to 2 if my_ascensions() is less than 3. Don't forget to correct shipping cost as well.
 

shabob

New member
While I like and use the check_version() function in zlib, is there any possibility that this could be extended to use a non-kolmafia.us site/locus?

Recent events here and elsewhere have made me ever-more nervous about depending on the whim and caprice of unknown third parties for the retention of my data, and it would be very useful to have this functionality extended to other forums/websites.
 

Bale

Minion
While I like and use the check_version() function in zlib, is there any possibility that this could be extended to use a non-kolmafia.us site/locus?

Meh. Rewrite your own version of check_version() and use whatever location you like. It's not a difficult change.
 

fronobulax

Developer
Staff member
Recent events here and elsewhere have made me ever-more nervous about depending on the whim and caprice of unknown third parties for the retention of my data, and it would be very useful to have this functionality extended to other forums/websites.

If you are thinking of KoLmafia.us as storage for your data rather than as a means of sharing it with the world then you are probably not going about things in the expected fashion. As for "unknown third parties" consider the trust that you are already placing in unknown third parties when you use KoLmafia. Finally, if this is a public project, ask why anyone would want to use your modified distribution scheme? If it is a private project, if you can't figure out the fairly simple changes needed then give us a better reason to help than your vague distrust based upon recent events.
 

Altair12

New member
Hm, I downloaded the latest zlib and nemesis.ash version, but whenever I try to run the nemesis.ash script, I get the message 'Bad item value: "book of pirate insults" (zlib.ash, line 554)'. I know absolutely nothing about scripts, so I have no idea what to do. Some help please? (I have a big book of pirate insults, 34 in fact)
 

Theraze

Active member
Downloaded the latest daily version of mafia? Try update clear in the gCLI, restart mafia, see if that fixes it?
 

lostcalpolydude

Developer
Staff member
It seems like mafia got into the rare state for you where fuzzy matching stops working (something I haven't seen in a long time). Restarting mafia would fix that. On the other hand, the script could use the item's full name, The Big Book of Pirate Insults.
 

Raven434

Member
Just recently started seeing this, like in the past week or so.

Version of Mafia is r11958

Stack overflow during ASH script: (zlib.ash, line 25)

Only seems to occur when I have Juju Mask equipped.

Request 1 of 6 (Sorceress: Sorceress' Hedge Maze) in progress...

[1325] Sorceress' Hedge Maze
Encounter: topiary golem
Strategy: D:\Games\KoL\Current Builds\JoeDerp\ccs\AoJ.ccs [default]
Round 0: JoeDerp loses initiative!
Stack overflow during ASH script: (zlib.ash, line 25)
Round 1: JoeDerp casts WRATH OF THE TRICKSTER GOD!
KoLmafia thinks it is round 2 but KoL thinks it is round 1
Round 2: JoeDerp casts WRATH OF THE LIGHTNING GOD!
KoLmafia thinks it is round 3 but KoL thinks it is round 1
Round 3: JoeDerp casts WRATH OF THE VOLCANO GOD!
KoLmafia thinks it is round 4 but KoL thinks it is round 1
Round 4: JoeDerp casts FRY!
KoLmafia thinks it is round 5 but KoL thinks it is round 2
Round 5: topiary golem takes 272 damage.
Round 5: JoeDerp wins the fight!
You acquire an item: hedge maze puzzle
You gain 27 Muscleboundness
You gain 44 Wizardliness
You gain a Mysticality point!
You gain 16 Smarm

-----

The ccs being called is:

[ default ]
consult d:\games\kol\smartstasis.ash
skill wrath of the trickster god
skill wrath of the lightning god
skill wrath of the volcano god
skill fry
 

Bale

Minion
I'd like to propose a new function for the next update of zlib:

PHP:
boolean check_version(string project) {
   string prop = "_" + replace_string(project, " ", "") + "Updated";
   boolean updated = false;
   if(svn_exists(project) && get_property("_svnUpdated") == "false" && get_property(prop) != "true") {
      if(!svn_at_head(project)) {
         vprint("This script has become outdated. Automatically updating from SVN...", "olive", 3);
         cli_execute("svn update " + project);
         vprint("On the script's next invocation it will be up to date.", "green", 3);
         updated = true;
      }
      set_property(prop, "true");
   }
   return updated;
}

It's just that simple. The script can decide if it wants to abort and demand that the user restart it based on the return value.
 
Last edited:

darknate

New member
Just started getting this message today. After attempting to autoadventure in the Smut Orc Logging Camp, using SmartStasis, mafia just stops responding after the fight ends, and this is in my logs.
Expression syntax errors for 'modifier_eval()':
Can't understand wpnpower (zlib.ash, line 162)

I already tried updating to the latest daily build (r12200 at time of writing) and double checked everything else was up to date (zlib, smartstasis, batbrain, etc.), still getting the same message.
 

Theraze

Active member
That's a BatBrain thing, namely found here:
Code:
        case 7061: fvars["wpnpower"] = get_power(equipped_item($slot[weapon])); break;      // spring raindrop attack
Further questioning if you do indeed have the latest version should probably happen on that thread.
 

zarqon

Well-known member
Darknate and Raven, your issues have been fixed with today's BatBrain update.

Bale, I like this and will use it as a starting point. I believe I'll integrate SVN updates with the existing forum method. Specifying a thread number or SVN project name will be optional, so long as one is provided. If both are provided, the forum link will be treated as documentation.

Giving svn a bit more time to stabilize though.
 
Top