ZLib -- Zarqon's useful function library

And lo, he did fix his script, and the update proliferated unto the realms of the non-mafia-updaters, and there was wailing and gnashing of teeth.
 
I got the following error from zlib 23 using mafia 14.4:

Bad location value: "throne room" (zlib.ash, line 419)


And from zlib 23 using mafia build 9052:

Bad location value: "king's chamber" (zlib.ash, line 419)
 
Need to use daily build and new zlib... either you have throne room or king's chamber in line 419, not both. Swap your zlibs to use the one with throne room in mafia 9052 and that should help.
 
LOL. Wow. Your problem is probably that you've got two version of zlib in various subdirectories of your /script directory. Go delete them. Then download the latest jar build of mafia and the latest zlib.
 
I was having a weird problem with this too because of the throne room switch, so I wiped my old KOLMafia directory completely and reinstalled pretty much everything using the fixed builds, but I still keep getting:

Bad location value: "throne room" (zlib.ash, line 419)

Whenever I call anything that uses zlib.
 
So, i've been trying to run the nemesis.ash script, and mafia gives me this: Cannot apply operator ^ to ( n * 10.0 ) (float) and place (int) (zlib.ash, line 90)
Any ideas?

Thanks
Capros
 
Here are a couple of functions that avoid scripts from aborting when a cli_execute() or a visit_url() go wrong. I don't know if you would consider adding them to a future zlib release.
PHP:
boolean safe_cli_execute(string cmd) {
   boolean res;
   try{ cli_execute(cmd);res = true; }
   finally{ return res; } return res;
}

string safe_visit_url(string url, boolean post, boolean encoded) { 
   string res; 
   try { res = visit_url(url,post,encoded); } 
   finally { return res; } return res; 
}
string safe_visit_url(string url, boolean post) { return safe_visit_url(url,post,false); }
string safe_visit_url(string url) { return safe_visit_url(url,true,false); }
(I hope I got the default values for "post" and "encoded" right).

EDIT: I modified safe_cli_execute(). It wasn't returning the correct value since the "finally" part was executed even if there was a return in the "try" part (of course... that's the whole point of the structure!).
 
Last edited:
Just a note that since the change, zlib tries to change the MCD for the tavern cellar, and should probably remember that it's a sensitive location as well, again.
 
I use the CLI and I find myself occasionally cursed with scripts that are out of version but do not print anything to the CLI, which I primarily use. Any way to make it so that zlib's check_version will print not only to the html page, but also the CLI? Or am I missing something entirely?
 
I generally only experience the CLI printing of new version available... are you sure that the scripts in question are actually using zlib for their version checking, and haven't hacked something else together?
 
zlib's check_version() should always print to the cli the first time a script runs each day; whether it also prints to the relay browser as well is up to script authors, as the function returns a string that can be ignored or used as desired by the author. About the only way I can think of to stop this would be having your "verbosity" setting at 0; I'm not sure if that's possible or not, but it's a very bad idea. Try typing "zlib vars" in the cli, and see what it says for verbosity (if it is 0, knock it up to 1 at least).
 
Last edited:
You have no idea how much grief the (lack of) verbosity has caused me. It was at 0, for some reason.

BTW, with 0 verbosity, "zlib vars" prints nothing.
 
Back
Top