missingManuel.ash - Yet Another Manuel Script!

Turing

Member
Version 1.2 is uploaded. Removes the extra Slimes and Eds, and fixes issues with acute letters and the articles in Muertos Borrachos.

How do I make the script check if there is a newer version available?
 

Ethelred

Member
How do I make the script check if there is a newer version available?

Plagerize, plagerize, plagerize! Let no one else's work evade your eyes! Just be sure to call it research.

Seriously, look at one of the scripts that do it, and "adapt" the code to your ends.
 

Bale

Minion
How do I make the script check if there is a newer version available?

Most people just use zlib and don't worry about the specifics. Basically though the trick is to visit_url() on the thread to read in the current version number. Here's the non-zlib version of update checking that I use for Universal Recovery, although it does steal heavily from zlib.

Code:
string thisver = "3.10.6";

string check_version() {
	string soft = "Universal Recovery";
	string prop = "_version_BalesUniversalRecovery";
	int thread = 1780;
	int w; string page;
	boolean sameornewer(string local, string server) {
		if (local == server) return true;
		string[int] loc = split_string(local,"\\.");
		string[int] ser = split_string(server,"\\.");
		for i from 0 to max(count(loc)-1,count(ser)-1) {
			if (i+1 > count(loc)) return false;
			if (i+1 > count(ser)) return true;
			if (loc[i].to_int() < ser[i].to_int()) return false;
			if (loc[i].to_int() > ser[i].to_int()) return true;
		}
		return local == server;
	}
	switch(get_property(prop)) {
	case thisver: return "";
	case "":
		print("Checking for updates (running "+soft+" ver. "+thisver+")...");
		page = visit_url("http://kolmafia.us/showthread.php?t="+thread);
		matcher find_ver = create_matcher("<b>"+soft+" (.+?)</b>",page);
		if (!find_ver.find()) {
			print("Unable to load current version info.", "red");
			set_property(prop,thisver);
			return "";
		}
		w=19;
		set_property(prop,find_ver.group(1));
		default:
		if(sameornewer(thisver,get_property(prop))) {
			set_property(prop,thisver);
			print("You have a current version of "+soft+".");
			return "";
		}
		string msg = "<big><font color=red><b>New Version of "+soft+" Available: "+get_property(prop)+"</b></font></big>"+
		"<br><a href='http://kolmafia.us/showthread.php?t="+thread+"' target='_blank'><u>Upgrade from "+thisver+" to "+get_property(prop)+" here!</u></a><br>"+
		"<small>Think you are getting this message in error?  Force a re-check by typing \"set "+prop+" =\" in the CLI.</small><br>";
		find_ver = create_matcher("\\[requires revision (.+?)\\]",page);
		if (find_ver.find() && find_ver.group(1).to_int() > get_revision())
		msg += " (Note: you will also need to <a href='http://builds.kolmafia.us/' target='_blank'>update mafia to r"+find_ver.group(1)+" or higher</a> to use this update.)";
		print_html(msg);
		if(w > 0) wait(w);
		return "<div class='versioninfo'>"+msg+"</div>";
	}
	return "";
}
 

fronobulax

Developer
Staff member
Code fragments for a zlib example...

Code:
import <zlib.ash>;
...
string THIS_VERSION = "1.4";
string THIS_NAME = "DCQuest";
int THIS_THREAD = 3640;
....
	check_version(THIS_NAME,"DCQuest",THIS_VERSION,THIS_THREAD);
....

Note that this is looking for a thread on kolmafia.us and checking the first post.

In this case it is looking for
DCQuest 1.4
which I think reduces to string matching on THIS_VERSION and THIS_NAME withing Bold tags, but I have been copying and pasting for so long I don't remember exactly the difference between the first and second parameters.
 

Turing

Member
Version 1.3 is up. Now with version checking (thanks, Bale). Grey goos are now grouped. Rene C. Corman is back with a vengeance. Different versions of gremlins, nightstands, protector spirits, and clingy pirates are now recognized.

Issues with Ninja snowmen and Vibrato monsters are pending, but the groundwork is laid out to fix them soon.
 

Turing

Member
And now Version 1.4 is up, with ninja snowmen and translated Vibrato monsters. It should now be reporting correctly all 989 monsters. As always, let me know if you find a bug, or if there's some improvement or feature you'd like to see.

Edit: Just noticed I put Corman in the Bugbear Invasion area, rather than the Zombie Slayer area. I'll have that fixed for the next version.
 
Last edited:

Erich

Member
That's true? I saw it on the wiki and assumed it was an error. You verified that in your own Manuel? Weird.

Yeah, I didn't even notice until I added it to the wiki that they were the same, but I can confirm it.
 

Turing

Member
This is unfortunate. Should I bother with a patch for this, or wait to see if they change it? I don't have any Vibrato monsters in my Manuel yet, so I'd have to go in there to make sure the patch works before releasing.

Perhaps aside from a bug report, it should be asked on the radio show.
 

Darzil

Developer
Running 1.4. For some reason whilst before today it showed Stella the Turtle Poacher as having one remaining manuel factoid to get for each form, today, after getting the last ones, it shows Stella the Turtle Poacher having three remaining manuel factoids to get.
 

Turing

Member
Running 1.4. For some reason whilst before today it showed Stella the Turtle Poacher as having one remaining manuel factoid to get for each form, today, after getting the last ones, it shows Stella the Turtle Poacher having three remaining manuel factoids to get.

Is it showing all forms having three factoids remaining? What build of Mafia are you using?
 

Turing

Member
I believe what happened is that when you fought Stella, she was added again (with a subtly different name) in the monster list, so when you ran the script, it listed her twice. The one that was completed didn't show up, and the new one did, with zero factoids. She was probably even showing up in the Unsorted category.

The same will happen if you fight Sexy Sorority monsters and run the script. You'll see something like "mitzi the sexy librarian vampire (3)" in the Unsorted section, along with the corresponding "Sexy Sorority Vampire (2)" in the Haunted Sorority House section.

Restarting mafia resets the monster list, and solves the issue.
 

Turing

Member
Version 1.5 is up. Moved Corman to the appropriate area, reordered some groups, and added a group for the Taco Elves.
 

Erich

Member
an oddity:

[Unsorted]
andyellas giftwrapper, the merry gentleman (3)
bixbimbor "the nut cracker" halldecker (3)
carolin' jackwen "five gold rings" treetrimmer (3)
chestnut-roastin' rickyos "two front teeth" turducken, the festooner (3)
daveuvel "reindeer gamer" nutcracker, the polar expressionist (3)
edron figgypudding, the merry gentleman (3)
have yourself a merry little jimdir "stuffed stocking" fudgeboxer, the stocking stuffer (3)
silent-night willardrod "candy cane" figgypudding (3)
 
Top