missingManuel.ash - Yet Another Manuel Script!

Revision 16170 reports on the previously unknown monster ID and then reports the correct number of factoids you have for that monster.

Here is a (slightly) updated copy of mm.ash

Code:
script "missingManuel.ash";

static boolean [monster] blocked_monsters = $monsters[
		Hockey Elemental, Count Bakula, Infinite Meat Bug, The Master of Thieves, Crazy Bastard, Baiowulf, Hypnotist of Hey Deze, The Temporal Bandit, Knott Slanding, Pooltergeist (Ultra-Rare), QuickBASIC Elemental, The Nuge,
		The Whole Kingdom, The Hermit,
		Don Crimbo, Edwing Abbidriel, Crys-Rock, Trollipop, The Colollilossus, The Fudge Wizard, The Abominable Fudgeman, Uncle Hobo, Underworld Tree,
		Hammered Yam Golem, Soused Stuffing Golem, Plastered Can of Cranberry Sauce, Inebriated Tofurkey,
		space beast matriarch,
		The Darkness (blind),
		CDMoyer's Butt, Hotstuff's Butt, Jick's Butt, Mr. Skullhead's Butt, Multi Czar's Butt, Riff's Butt,
		Slime2, Slime3, Slime4, Slime5,
		Ed the Undying (1), Ed the Undying (2), Ed the Undying (3), Ed the Undying (4), Ed the Undying (5), Ed the Undying (6), Ed the Undying (7),
		Count Drunkula (Hard Mode), Falls-From-Sky (Hard Mode), Great Wolf of the Air (Hard Mode), Mayor Ghost (Hard Mode), The Unkillable Skeleton (Hard Mode), Zombie Homeowners' Association (Hard Mode),
		wild seahorse,
		giant pumpkin-head, large-headed werewolf, oddly-proportioned ghost,
		All-Hallow's Steve, The Sagittarian, general seal, Frank "Skipper" Dan\, the Accordion Lord, Chef Boy\, R&D, spirit alarm clock,
		Disorganized Files, Endless Conference Call, Hideous Slide Show, Tedious Spreadsheet, Unoptimized Database, Your Overflowing Inbox, Chatty Coworker, The Book Of Faces, The Tome Of Tropes, The Water Cooler, Totally Malicious 'Zine, The Best Game Ever,
		Caveman Dan, Crimbomega];

boolean [monster] get_all_monsters()
{
    boolean [monster] all_monsters = all_monsters_with_id();

    // Remove uncopyable monsters that have a known id

    // Here is how we would do it if KoLmafia had a "nocopy" proxy field
    /*
    foreach m in all_monsters {
	if ( m.nocopy ) {
	    remove all_monsters[ m ];
	}
    }
    */

    foreach m in blocked_monsters {
	remove all_monsters[ m ];
    }

    return all_monsters;
}

void visit_page( string page )
{
    print( page );
    visit_url( "questlog.php?which=6&vl=" + page.to_lower_case() );
}

void visit_all()
{
    flush_monster_manuel_cache();
    visit_page("A");
    visit_page("B");
    visit_page("C");
    visit_page("D");
    visit_page("E");
    visit_page("F");
    visit_page("G");
    visit_page("H");
    visit_page("I");
    visit_page("J");
    visit_page("K");
    visit_page("L");
    visit_page("M");
    visit_page("N");
    visit_page("O");
    visit_page("P");
    visit_page("Q");
    visit_page("R");
    visit_page("S");
    visit_page("T");
    visit_page("U");
    visit_page("V");
    visit_page("W");
    visit_page("X");
    visit_page("Y");
    visit_page("Z");
    print("Now I know my ABCs!");
    visit_url("questlog.php?which=6&vl=-");
}

int three, two, one, zero;

string GetLocName(string locName)
{
    if (locName == "Foyer") return "Vanya's Castle";
    if (locName == "A Well-Groomed Lawn") return "Landscaper's Map";
    if (locName == "Post-War Junkyard") return "Junkyard";
    if (locName == "1st Floor, Shiawase-Mitsuhama Building") return "Shiawase-Mitsuhama Building";
    return locName;
}

boolean print_all = false;

boolean process_monster ( monster m, string loc, boolean print_header )
{
    int missed = 3 - monster_factoids_available( m, true );

    if (missed == 0) {
	three += 1;
	if ( !print_all ) {
	    return print_header;
	}
    }

    if (missed == 1)
	two += 1;
    else if (missed == 2)
	one += 1;
    else if (missed == 3)
	zero += 1;

    if ( print_header ) {
	print("[" + GetLocName(loc) + "]");
    }

    if (missed > 2) {
	print(m + " {" + missed + "}", "red");
    }
    else {
	print(m + " {" + missed + "}");
    }

    return false;
}

void CheckManuel ()
{
    print_all = user_confirm("Display full list?");

    print("Checking Monster Manuel...", "blue");
    visit_all();
    print("Done checking Monster Manuel!", "blue");

    boolean [monster] all_monsters = get_all_monsters();

    print("=================================");
    boolean print_header;
    foreach loc in $locations[] {
	print_header = true;
	monster [int] mon_list = get_monsters(loc);
	foreach i, m in mon_list {
	    if ( m.id > 0 && all_monsters contains m ) {
		print_header = process_monster( m, loc.to_string(), print_header );
		remove all_monsters[ m ];
	    }
	}
	if ( !print_header ) {
	    print("=================================");
	}
    }

    // Here is where we would process "Extra Areas" where we have
    // manually inserted certain monsters.

    print_header = true;
    foreach m in all_monsters {
	print_header = process_monster( m, "Unsorted", print_header );
    }
    if ( !print_header ) {
	print("=================================");
    }
	
    print("");
    print("You have casually researched " + one + " creatures.");
    print("You have thoroughly researched " + two + " creatures.");
    print("You have exhaustively researched " + three + " creatures.");
    print("You have not researched " + zero + " creatures.");
    print("Total creatures: " + (one + two + three + zero) + ".");
    print("Done.", "blue");
}

void main ()
{
    if ( !visit_url("questlog.php?which=6").contains_text( "[Monster Manuel]" )) {
	print("Thank you, Mario, but your Monster Manuel is in another castle!", "blue");
	print("Perhaps you should consider getting one?");
	print("");
	print("=================================");
	print("[Every Single Area]");
	print("NOTHING!  ABSOLUTELY NOTHING!", "red");
	print("=================================");
	print("");
	print("You have casually researched 0 creatures.");
	print("You have thoroughly researched 0 creatures.");
	print("You have exhaustively researched 0 creatures.");
	print("You have not researched ANY creatures.");
	print("Done.", "blue");
	return;
    }

    CheckManuel();
}
 
Final (?) iteration of mm.ash from me. It bothered me that we have:

monster [int] get_monsters( location)
boolean [monster] all_monsters_with_id()

Seems like the return type of the latter is more useful, in that you can just foreach over it to get successive monsters, without having to worry about the stupid array index. So Revision 16171 adds:

boolean [monster] get_location_monsters( location )

This allowed a big simplification of code in mm.ash - especially when I added the "extraMonsters" and "extraAreas" functionality that the original missingManuel.ash has. I think the only thing it is missing is "postAreas", which is used for ordering the extra areas, I think. That's not something I care about - alphabetical is good enough - but if Turing wants it, he is welcome to add it.

He is also welcome to put back the "notify turing" and "version checking" stuff, which I also removed. Heck, if he's going to take this code and make it his own going forward (which I recommend, since it is much simplified), he can do anything he wants before checking it into SVN. ;)
 

Attachments

Here is a tiny improvement to a function. We don't need to remove monsters with id = 0 from what all_monsters_with_id() returns, since they won't be there. Attempting to do so is a no-op, but it's a wasted Java map lookup, so, it's cleaner to not bother.

I suppose another approach would be to put only monsters with an id into blocked_monsters, but all the monsters there are known to not have factoids, so if we ever learn the id of one of them in the future and add it to KoLmafia, having them in the list will protect against them suddenly appearing to be missing factoids.

This version of the script is all about not breaking when KoLmafia changes in the future. :)

Code:
boolean [monster] get_all_monsters()
{
    boolean [monster] all_monsters = all_monsters_with_id();

    // Remove blocked monsters that have a known id
    foreach m in blocked_monsters {
	if ( m.id > 0 ) {
	    remove all_monsters[ m ];
	}
    }

    return all_monsters;
}
 
I have uploaded this version instead.

I was thinking you'd add support for monsters with ID 0. Though I suppose it makes a certain amount of sense to leave those out since they probably aren't in the fax network yet if their ID is still 0 so not having that is a sort of feature.
 
You are correct. That is a feature.

Having the script list exactly those monsters that are known to have factoids and for which KoLmafia knows the ID # means that Turing no longer needs to add unknown monsters that are speculated to have factoids; as soon as they are confirmed to have factoids - and we are therefore able to get the monster ID into KoLmfia - they will automatically appear in this script, no changes necessary.

Now, if you want to see ID=0 monsters so that you can decide which card to try pulling in the hopes that it will appear, then use the Fax Hunt spreadsheet that we all use to help with that. If you succeed in pulling a new monster, cool! It will immediately appear in this script for you, and when you report it and KoLmafia updates it, it will appear for everybody else.
 
PS.

Sneezy, the Reindeer
gift-wrapping vampire
Arc-Welding Elfborg

These are the monsters that I know of that Faustbot claims to have, but which KoLmafia doesn't know the ID for. I am sure that Turing doesn't want to go add them now so that he can remove them tomorrow when KoLmafia learns their ID.
 
There are a few unkillable monsters that do have factoids, but they are unobtainable. Cyrus the Virus is one of them, and not excluded from the script. How these were discovered: http://forums.kingdomofloathing.com/vb/showpost.php?p=4324998&postcount=615
So, what do you think should be done here?

Cyrus the Virus has a monster ID and factoids and is not on the "exclude" list, so he appears - correctly.
The Whole Kingdom and The Best Game Ever do not have monster ids listed, so are excluded by this script automatically - but they are also on the "exclude" list, so will (correctly) not be shown as missing, even if we learn the monster IDs.
rock snake and rock homunculus should be pullable from the Deck. I don't think the former has been seen yet - and perhaps there is something they need to fix in KoL to make it happen - but, since we have their monster ids, this script (correctly) lists their factoids as missing.

So, I guess that was an interesting enough post you linked to, I don't understand what you think this script needs to do that it isn't already doing.
 
Can remove Blazing Bat. It was added from FaxBot, which has had it for ages, not Deck of Cards, and has no Factoids.
 
So, I guess that was an interesting enough post you linked to, I don't understand what you think this script needs to do that it isn't already doing.

I don't think anything needs to be done really, I just thought it would be nice to let other people know that there really isn't 'supposed' to be a way to get these, even though they exist (but if anyone figures out HOW to get them, I hope they share)
 
The pumpkin tree (one of the four Shivering Timbers) trees doesn't seem to be showing up in the script. I don't have any of its factoids, the fur tree or the hangman tree. The last two are showing up when I run the script as me needing 3 factoids each. The pumpkin tree is not showing at all (though I still need its 3 factoids).

The blazing bat and snakefire were both nuked from orbit for copyability (I lost one from my fax and the other from my Rain-Doh), so they can probably be nixed.

The Weapons-Assembly Elfborg is showing as an "Unsorted", instead of hanging out with his buddies in the Crimbotown Toy Factory 2007.

Thanks so much for the continued work on this script!

~Aramada
 
The pumpkin tree (one of the four Shivering Timbers) trees doesn't seem to be showing up in the script. I don't have any of its factoids, the fur tree or the hangman tree. The last two are showing up when I run the script as me needing 3 factoids each. The pumpkin tree is not showing at all (though I still need its 3 factoids).
The pumpkin tree was added to KoLmafia in revision 16245. If you are not running at least that revision, it will not show up.

The blazing bat and snakefire were both nuked from orbit for copyability (I lost one from my fax and the other from my Rain-Doh), so they can probably be nixed.
I have a blazing bat in my Chateau painting. At least, I can see its picture there. I haven't tried fighting it recently.

In any case, I have a note oustanding to Riff discussing it (and others), since HotStuff told me he'd make those critters faxable again if Riff gave them factoids and personally lobbied him to make them faxable. No response, yet, but we'll see. :)

The Weapons-Assembly Elfborg is showing as an "Unsorted", instead of hanging out with his buddies in the Crimbotown Toy Factory 2007.
Works for me. I suggest you upgrade to the latest version of KoLmafia and try again.
 
::checks Mafia version::realizes it is 16240:: DOH! Sorry about that, I know better.

After HotStuff nuked them from being copyable, the one in my Rain Doh still LOOKED like it had a monster in it, but as soon as I tried to use it, I got a message about how something strange happened and the monster I thought I had copied there managed to slip away. I'd be willing to bet the same thing happens when you click on your Chateau painting (though now I'm curious!)

Fingers crossed on Riff feeling factoid inspired!

~Aramada
 
Back
Top