ZLib -- Zarqon's useful function library

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Apparently the limitation for grimstone masks is not just to Ed (though he has his own message) but to all non-standard classes? Vampyres certainly get a message saying ""You can't use this item as a non-standard class. Sorry.".
 

taltamir

Member
@zarqon you recently added grimstone mask not being valid in ed. But I recently found out that (despite no mention in the wiki at the time) it is also invalid in Vampyre. The vampyre message is also a generic one that says "You can't use this item as a non-standard class. Sorry."
so I think it should be invalid for all classes that are not part of the main 6
 

zarqon

Active member
Okay, grimstone masks can now only walk if you are one of the six vanilla classes. Otherwise, they are invalid.
 

fronobulax

Developer
Would you consider modifying the version checking to either stop checking a URL at the forum or possibly munging an old style URL to the correct one? (That was possible on another vBulletin to XenForo upgrade and I can help dig if you need it).
 

fronobulax

Developer
OK. I thought there was a formula but there wasn't.

I was told the solution is
  • 1) A XenForo add-on called "XenForo Redirects for vBulletin (free)
  • 2) A properly configured .htaccess file

OR
  • Change/edit the URL.

Not sure the system level change is worth it. grep in my scripts directory shows most of the references are in zarqon scripts or are in comments, not code.
 

fewyn

Administrator
Staff member
I do have that Addon installed :( So I'm not sure why isn't pull up the right places. Do you have an example of what URL it's visiting specifically?
 

fronobulax

Developer
This is one.


The error message is

Server returned response code 404 (Not Found) for https://kolmafia.us/showthread.php

AFAIK I am passing "3640" as an int to zlib's check_version and it is building the URL.
 

fronobulax

Developer
If zarqon could update the script to go to https://kolmafia.us/threads/post.3640/ where 3640 is the ID it should load whatever thread fine.

Yep.


Would you consider modifying the version checking to either stop checking a URL at the forum or possibly munging an old style URL to the correct one? (That was possible on another vBulletin to XenForo upgrade and I can help dig if you need it).

zarqon got married (maybe a couple years ago?) and I confess he has been somewhat less responsive since then.
 
Now that Dark Mode is coming to KoLmafia (r20534), it would be nice to extend vprint() to accept different text colors for light and dark modes:

Code:
boolean vprint(string message, string light_color, string dark_color, int level) {
  return vprint(message, _is_dark_mode() ? dark_color : light_color, level);
}

Since we don't have built-in support for checking dark mode yet, here's a backwards-compatible function:

Code:
boolean _is_dark_mode() {
  return create_matcher(
    "carbon|cobalt|darcula|dark|deepocean|dracula|highcontrast|mono[ck]ai|night|nord|oceanic|spacegray|vuesion",
    get_property("swingLookAndFeel").to_lower_case()
  ).find();
}
 

MCroft

Developer
Now that Dark Mode is coming to KoLmafia (r20534), it would be nice to extend vprint() to accept different text colors for light and dark modes:

Code:
boolean vprint(string message, string light_color, string dark_color, int level) {
  return vprint(message, _is_dark_mode() ? dark_color : light_color, level);
}

Since we don't have built-in support for checking dark mode yet, here's a backwards-compatible function:
KoLMafia has it

public static Boolean isDarkTheme()

What do you need to get that into ash/js?
 
KoLMafia has it

public static Boolean isDarkTheme()

What do you need to get that into ash/js?

I think it can be added through net/sourceforge/kolmafia/textui/RuntimeLibrary.java. But I only recently began tinkering with KoLmafia code, so don't trust me on that.
 

zarqon

Active member
Sorry y'all, somehow the change in forum software has disrupted my usual system of checking for thread updates. Crimbo has given me some extra impetus to figure it out though.

So! In r47 I've adjusted URL-based version checking to use the new forum URL. I also added the two-color variant of vprint as suggested by philmasterplus. Looks like ASH has is_dark_mode() now so I just added the one function. While I was at it, I also adjusted the no-color-specified version to default to 'silver' rather than 'black' in dark mode.

Being able to use color themes is pretty friggin' sweet by the way!
 

Herfnerfenberf

New member
I've been trying to use volcano_mining.ash but I keep getting the error message
Function 'is_dark_mode( )' undefined. This script may require a more recent version of KoLmafia and/or its supporting scripts. (zlib.ash, line 60)
 

scudunculus

New member
Someone is doing something wrong somewhere along the way, not sure where. But I too, was getting errors from zlib telling me that is_dark_mode is causing problems.

So here are the steps I took:
Is mafia up to date? Help -> Copyright Information -> says version 20.7, same as my jar file is named
Okay so I'll look to see what the latest version is from sourcefourge... -> says download Kolmafia-20.7.exe, checks out.
Is zlib updated? script manager -> update script
still doesn't solve the problem.


So just to clarify, I did in fact solve the problem by downloading the latest kolmafia jar, but I feel strongly that those steps should have been enough to identify the problem. Either the version information is not being properly kept up to date, or zlib itself is relying on features in a daily build rather than a normal release (and thus breaking for those that prefer stable releases rather than dailies). Is this just a problem with mafia development that has nothing to do with zlib dev?
 

fronobulax

Developer
Someone is doing something wrong somewhere along the way, not sure where. But I too, was getting errors from zlib telling me that is_dark_mode is causing problems.

So here are the steps I took:
Is mafia up to date? Help -> Copyright Information -> says version 20.7, same as my jar file is named
Okay so I'll look to see what the latest version is from sourcefourge... -> says download Kolmafia-20.7.exe, checks out.
Is zlib updated? script manager -> update script
still doesn't solve the problem.


So just to clarify, I did in fact solve the problem by downloading the latest kolmafia jar, but I feel strongly that those steps should have been enough to identify the problem. Either the version information is not being properly kept up to date, or zlib itself is relying on features in a daily build rather than a normal release (and thus breaking for those that prefer stable releases rather than dailies). Is this just a problem with mafia development that has nothing to do with zlib dev?

It is idiomatic around here that "latest build" and "up to date" refer to the builds available from https://ci.kolmafia.us/ and not what is available at SourceForge.

There is a mechanism for script writers to indicate that a particular daily build (or newer) is required, the since directive. As noted above zarqon failed to update that when a zlib update was pushed, but that error has since been corrected.

Users who wish to protect themselves from similar oversights by script authors tend to do so by always using the "latest build" as defined above. The days when the daily builds were buggy and unstable are long gone and since 5 months have passed since the SourceForge build was last updated the commitment to keeping SourceForge up to date might be wavering.

Your steps to try and resolve the issue were perfectly reasonable although ultimately incorrect :)
 
Top