ZLib -- Zarqon's useful function library

Muroni

New member
I'm sorry mates. I didn't have any notice from Mafia to update it when I logged in. I used mafia yesterday with no issue, in a script that called on zbli, with no error message. Today when I attempted to do the same thing, there was a notice to update zlib, which I did, and it wasn't until after updating zlib that I got the error message, and the message specifically says zlib. This led me to make the obviously faulty assumption that the error was either zlib or at least that it was the first place I should look.

You guys keep on the main KoL forums expounding the virtues of KoL Mafia to people who are not programmers. Some of us get brave enough to try-but since we're not programmers, these faulty assumptions will happen when we don't necessarily understand all the relationships in the program. An easy mistake to make for a non-programmer who has for 2 years made do with GM scripts, and finally saw enough "Forget the GM script, use mafia" posts to get over my fear of new things and try to learn something new.

We're willing to look for information before we ask, but a new user who is not a programmer, doesn't always know where to look. My bad.

I guess I learned to always read the Mafia thread itself first, before attempting to read specific script threads, or always assume first that my mafia version is the problem despite the conditions I experience the error under or what the error message itself is. :D
 

heeheehee

Developer
Staff member
Erm, I linked to a thread for a tiny program (by Rinn) that allows even non-programmers to automatically and easily download the latest daily build.

But yeah, updating Mafia fixes most problems with undefined functions.
 

jamfan14

New member
Function 'item_drops_array( monster )' undefined (zlib.ash, line 232)

just updated from version 18 to 19 and that error message popped up.

help?
 

zarqon

Well-known member
Hahahaha, another page break! This is excellent.

Bale, do what I do: let other people answer those and forget about it. You contribute plenty around here, may as well let some others have a chance to answer the easy questions. :) As Muroni said, it's not like when you first run mafia a message pops up saying how to deal with errors, and the error messages only describe the problem, not how to fix it.

That said, an announcement in the "Read This First" area of this forum would be quite helpful. I suggest the following:

So, You're Getting an Error

Wait! Before you run to the script thread to report this error, consider that 9 times out of 10 the problem is having an outdated version of something. If a script that you downloaded won't run, have a look at this handy list:

What to do if your script generates a red error message and won't run (in order):

1) Check that your version of mafia is current. By current, I don't mean "version X.X", I mean "rXXXX". If you don't know how to run .jar files, see (link to something helpful). If you use Windows, this tool will automatically keep your version of mafia cutting-edge current.
2) Check that you have the latest released version of the script you're trying to run (and whatever support scripts it includes). Note that scripts with version-checking will not notify you if the error happens before the script starts to run.
3) Check that you don't have outdated data files (from using the "update data" command, which no one should ever use). Type "update clear" to eliminate old data files.
4) Check the ASH Wiki for a description of your error and possible solutions.
5) If none of these solutions fix it -- then please report the error to the script author in the script thread. The script author should be able to determine whether this is a script error or a mafia error, and deal with it appropriately.
 
Last edited:

heeheehee

Developer
Staff member
Wait, there's a "Read This First" area of this forum?

[Also, dj_d's ascend.ash bundle use older versions of various scripts, so the related threads would be swamped with "Help, I updated ZLib and everything else, and I keep getting this Function 'error( string, int )' undefined!" Oh wait, that already happens. Huh.]
 

Muroni

New member
Oh thank you. Actually I'd read that but so long ago I guess I forgot it. :( That's what happens when you do a little bit here and a little bit there. New stuff, maybe 10% sticks, ha. /me makes a note to read this first every time now!
 

zarqon

Well-known member
@hee3x: I was thinking making that a sticky in "Announcements" would help tremendously.

And the issue(s) with dj_d's Ascend suite is his own fault for not updating it -- that thread is getting quite backlogged with unfixed issues. As it gets more complicated to run Ascend -- besides all the initial configuring, you also have to make sure you have the correct OLD versions of my scripts, which I no longer support since they are old, and which interfere with running current scripts -- dj_d is likely to see fewer people willing to take the plunge and ship the Mr. A. I used to pop over to that thread and help out, but I'm done helping Ascend users until he updates. I would make/post a fixed version, but dj_d has made it clear that he wants to be paid for his work. I'm not comfortable with dj_d being paid for my work.
 

heeheehee

Developer
Staff member
That'd be rather useful and possibly deprecate the current FAQ on the wiki, which nobody seems to read, anyway.

I'm not really sure why I brought up ascend.ash and those other scripts. I guess those were the only ones I could think of which would still be swamped with "HELP" posts even after the creation of such a thread. But yeah, looks like the reason would be because dj_d hasn't updated his scripts in quite some time. (Plus, someone else getting paid for your work is never fun. :( )
 

mredge73

Member
I would suggest that you change your version checking function to have the user send themselves a k-mail containing a link to the new version of the script and the link to the mafia new builds page.
Maybe that will help since it will fill up their k-mail with useful links! That should be equally as annoying as the 30 second wait! They also don't have to go through the trouble of copy/paste from the CLI, they can just click the link in the kmail.
I have already done that with my scripts; although I have only a few users, I haven't had to answer that question on my thread.
 

slyz

Developer
That won't work from within a consult script, but adding a nudge to update to a Mafia daily build would be nice.
 

xKiv

Active member
adding a nudge to update to a Mafia daily build would be nice.

... if it could work at all.
Remind me again, why don't we have a "require_mafia_version" statement that would croak during the parse phase, if fed to sufficiently non-advanced mafia version?
 

Bale

Minion
... if it could work at all.
Remind me again, why don't we have a "require_mafia_version" statement that would croak during the parse phase, if fed to sufficiently non-advanced mafia version?

Because of the fact official builds and revisions use a different numbering schema.
 

StDoodle

Minion
Yes, but grabbing said info isn't completely reliable, either, because of the way it's stored in your preferences. It's also not likely to help most of the time, either. See this thread for more info.

That being said, I'd be all for a version of check_version() that made use of what info is available on releases, and probably will incorporate it into my own version regardless.
 

Rinn

Developer
Seems to me the solution would be implement an internal function that returns the date and time the build was compiled, rather then the version.
 

xKiv

Active member
Yes, but grabbing said info isn't completely reliable, either, because of the way it's stored in your preferences. It's also not likely to help most of the time, either. See this thread for more info.

That being said, I'd be all for a version of check_version() that made use of what info is available on releases, and probably will incorporate it into my own version regardless.

I am not asking for a function. I am talking about a *statement* that would cause mafia to check version when the script is parsed, way before it aborts due to a syntax error.
Alternatively, it would be a syntax error to have a check_version statement for a too-new mafia.

Rinn said:
Seems to me the solution would be implement an internal function that returns the date and time the build was compiled, rather then the version.

Script authors live in different time zones (solvable by requiring the TZ to be specified). Also, script authors probably wouldn't appreciate having to look up dates/times for particular versions/revisions of mafia (just because you are not seeing newer version now doesn't mean one wasn't commited in the past ~half hour).
 
Last edited:

Rinn

Developer
Script authors live in different time zones (solvable by requiring the TZ to be specified). Also, script authors probably wouldn't appreciate having to look up dates/times for particular versions/revisions of mafia (just because you are not seeing newer version now doesn't mean one wasn't committed in the past ~half hour).
GMT (or kol time), and if it was down to the second it wouldn't matter if a newer build was posted a half hour later. The script author could just use whatever compile time of mafia they're currently on because clearly if they're writing a script in some version it has all the functionality needed. At worst it would force people to get a newer daily build when they don't actually need it, which they should be doing anyway if they're running daily builds in the first place. None of this is different then using the version value, except that it solves the problem of multiple different numbers because now you don't have to maintain two version checks, just a single date-time check. Either way, version or time, if you want to prevent fifty people from asking how to solve the exact same issue you need to have some kind of error checking in the first place to solve the problem for them.
 
Last edited:
Top