ZLib -- Zarqon's useful function library

Made me a new alias today... goget.
Code:
alias goget => ashq import <zlib.ash> location[monster] locs; foreach l in $locations[] foreach num,m in get_monsters(l) foreach i in item_drops(m) if (i == to_item("%%")) locs[m]     = l; foreach m in locs obtain(1, "%%", locs[m]);

It's a munged version of wheretofind, that should basically parse through the item list and if there's any mob that drops the item, use obtain in that area. Successfully got me my spiky hair gel for the entryway. I'll play with it a bit more, but figured that's a good one to share. :)

Edit: And for an example:
> goget dead mimic

You need 1 more dead mimic to continue.
Conditions list cleared.
Condition added: dead mimic
dead mimic

Request 1 of 40 (Dungeon: Dungeons of Doom) in progress...
 
Last edited:
OK, maybe I'm missing this. How do you change a setting type? I have booleans, ints and familiars that are all showing up as strings. WOSSMAN won't let me change them.
 
After you select the correct choice from the drop-down, hit the enter key to make Wossman remember your choice. It's not exactly intuitive.
 
Click where it says the type. It'll give you a pretty dropdown list where you can choose what type you'd like that setting to be.

Ah yes, and as Bale says, you have to press Enter to save it.
 
That's what I was afraid of. It's not working. Also, the documentation I enter for a setting isn't getting saved. Is this a permissions issue? Or do I need to go back and redefine every homemade setting I've ever made? I'm only testing this on homemade setting so far. Last thing I want to do is muck up all of my scripts at once ^^
 
Depends on how the updating of the server copy of vars_documentation is happening.

Also, what browser is this that's failing? Always helps to know. :)
 
Is there any way, other than editing zlib, that we might be able to skip the version checking of zlib itself? It seems to be causing some issues for me when zlib is imported into a consult script, though I'm sure my script itself has massive bugs too. But it could also be an issue for relay scripts. While it's nice to be able to alter the behavior of version checking of a relay script itself, it seems as though the end goal might not quite be reached if zlib's own version checking still causes a wait()...
 
There shouldn't be any problem with version checking in a consult script. FTF and SS check their own version using zlib, so I doubt that is the problem.
 
Well, by "problem" I didn't mean to imply that I think it's causing errors. Just that it's kinda weird having a delay on such a script... would be nice to skip that. Of course, if wait() still printed a countdown to the cli, it would at least be easier to see where things are getting stuck. :(
 
Well, I've posted my fix for that with silent being a new command, as Veracity requested... now all we need is for it to either be approved or have a tweaked request. :) Your messages should hopefully be back soon.
 
In the process of trying to figure out why EatDrink wants to create 5000+ variables, I created a script that just set one variable. I then ran it from the Kolmafia script menu without logging in. Lo and behold - the resulting vars file had verbosity of zero. This may, or may not explain why some folks had verbosity of zero - something in the initialization in zLib is not behaving as expected?
 
Newest version of zLib - 21.

You could try
PHP:
import <zlib.ash>
setvar("FroTest_avoid_"+replace_string(to_string($item[wet stew])," ","_"),
       true);

with the older version if you'd like.
 
Code:
>call scripts\macguffin.ash

Bad item value: "desert bus pass" (zlib.ash, line 394)

constantly get this when i try to use first things first
 
Update to the latest daily build.

EDIT: Looking at a debug log, it looks like the verbosity 0 problem can be caused by simply calling setvar when verbosity has not yet been set, because setvar calls vprint, which checks verbosity.
EDIT2: Verbosity is always in the vars map by the time setvar("verbosity",3) is called, due to setvar() calling vprint. Moving that line to the top of the setvar()'s should fix that problem.
 
Last edited:
The beta in this post includes a few more things.

  • 3hee's fixes -- use window.expand and remove margin-bottom from #topbar.
  • Submit dropdowns on blur (in other words, if you change a dropdown, you don't have to press enter; doing something outside the dropdown will cause it to be updated to the currently selected value). I didn't want to do this because it tends to be more server-heavy, but some people didn't seem to realize that changes needed to be submitted after being made, and adding a submit button looks inelegant.

If these are all good, the only thing keeping this from release is the fact that the dropdowns for certain mafia types don't work, despite having the same code as other types which do work. I suspect it's due to a) special characters in the names, or 2) hitting some kind of memory limit for dynamically building dropdowns. Any help debugging this would be much appreciated.

Filtering familiars: looks like this is a go.

@Fluxxx: Understanding the way documentation is saved takes a bit of familiarity with some of the features I have created for scripters, most importantly the Map Manager (link in my sig). The documentation for settings is in a separate map from your vars file, saved locally in vars_documentation.txt. However, this is not exactly a private map, since it is loaded via load_current_map() -- a function which checks the Map Manager once daily, and if your version is outdated, it gets completely overwritten by the updated map. So if no one is updating the remote map, your local changes are safe (which is all that the WOSSMAN does -- it does not upload changes to the server). But when someone updates the remote map, your local changes will be overwritten. To avoid your changes getting overwritten, you need to upload your edited map to the Map Manager. This shares your setting names and documentation with the world, but users will only see documentation for the settings they actually have.

There's also a chance that you could be having a permissions issue, if mafia is unable to write to vars_documentation.txt. But in that case, it would seem likely that none of the documentation would have loaded.

@Alhifar: You found the mysterious "verbosity 0" bug!! I award you 10,000 points! Even after you explained it, it took me a little while to figure it out. This should probably be updated quite soon.

@Theraze: This one uses has_goal() to figure out the best location to get the specified item:

PHP:
alias goget => conditions clear; conditions add 1 %%; ashq import <zlib.ash> float bestrate; location bestloc; foreach l in $locations[] if (has_goal(l) > bestrate) { bestrate = has_goal(l); bestloc = l; } if (bestrate > 0) obtain(1, "%%", bestloc); else print("No monsters drop this item.");

@Alhifar AND Theraze: just link them here!

@Doodle: I could only see a wait() for relay scripts causing a problem if the page is being printed as it's being made. If check_version happens in the middle of this, particularly if other server hits need to happen in there as well, there may be a chance that it could lead to a browser timeout or somesuch. I recommend instead building the page in a buffer and writing the entire buffer at the very end.

As for consult scripts, check_version() really should not be causing any problems.
 

Attachments

:shrug: Just seems odd to me that you'd add support in check_version() to allow skipping the wait() and printing a <div> in a relay script, but there's no way to get an imported use of zlib's own version checking to do the same. I understand it doesn't actually break anything, but it would cause a some delay in page rendering, wouldn't it? Which, while not an actual problem, could certainly look like one to the user.

If you do decide to change this, it might be nice to change the <div id=update> to <div class=update> so that both the script's own upgrade info & zlib's upgrade info could co-exist. Just a thought.

FWIW, I'm currently importing zlib into a fight.php override (so not even a relay info script, but an actual override) which is what makes me nervous about having such a delay introduced. I simply couldn't figure out a way to present the user with button choices and a pause for input from a consult script... had to go with the override.
 
FF 3.6.12
Well, now I can change the type, much nicer to be able to choose from my list of familiars rather than having to type it in by hand. However, now I can't get the documentation to expand at all, with or without the fix listed before. When it first loads up, it appears as if everything is expanded for a split second and then it collapses soon after that, refusing to expand. mouseover, click, dblclick, and checking expand doesn't work.
Half of me is wondering if it's my netbook :/
 
Back
Top