preAscension Scripts

Theraze

Active member
Since I didn't see another thread for this, though I'd throw up a script for automated things I like to do as part of my preAscension experience. Bits of this come from Bale, but at this point most isn't his. :) I think. Basically does the following:
1) Grabs Goofballs if you haven't gotten the free ones yet.
2) Gets you a balloon monkey key, if you have a balloon monkey.
3) Turns in your gunpowder.
4) Turns in rat whiskers.
5) Sets your current familiar as your next 100% familiar.

What else am I missing? Alternatively, if someone actually wants the preAscension.ash file, I could attach it, but I'm thinking that it's more likely that bits are likely to keep changing as things strike the brain. For example, should probably run a still check... use it up if you're ascending and still have uses left. Or do uses stay used between ascensions on the same day?
PHP:
import <zlib.ash>

void goofballs() { 
    if(visit_url("tavern.php?place=susguy&pwd").contains_text("First bottle's free, man")) {
         print("I know they're bad for me, but... \"Hey! Free Goofballs!\"", "olive");
         visit_url("tavern.php?action=buygoofballs&pwd"); 
    } 
} 

void balloon_monkey() { 
    if(retrieve_item(1, $item[balloon monkey])) 
        visit_url("lair2.php?preaction=key&whichkey=436&pwd"); 
} 

void gunpowder() { 
    if(available_amount($item[barrel of gunpowder]) > 0) 
    {
        retrieve_item(available_amount($item[barrel of gunpowder]), $item[barrel of gunpowder]);
        visit_url("postwarisland.php?place=lighthouse&action=pyro&pwd");
    }
} 

void rat_whiskers() { 
    if(available_amount($item[rat whisker]) > 0) 
    {
        retrieve_item(available_amount($item[rat whisker]), $item[rat whisker]);
        visit_url("town_wrong.php?action=whisker&pwd");
    }
} 

void next_familiar() { 
    vars["is_100_run"] = normalized(my_familiar(),"familiar");
    updatevars();
} 

void main() { 
    if(get_property("kingLiberated").to_boolean()) { 
        goofballs(); 
        balloon_monkey(); 
        gunpowder(); 
        rat_whiskers(); 
        next_familiar();
    } else abort("WTF!? Why is a preAscensionScript running?"); 
}
 
Ooo! Some of that code is mine! I don't have the gunpowder check in my preAscension script so I'm stealing it.
 
Once we have an actual way of checking if the quest is done without a server hit, I'll throw it in there. Until then, if I'm going to do the server hit anyways, might as well see if it works. Similar to how we don't know if underwater adventuring is easily available, so you might as well see if the castle is open and if you save the page contents, you might be able to save a server hit or two later on...
 
Probably similar to buying items using sand dollars from big brother. Whether or not you can breathe underwater (and therefore, visit the store), mafia decrements the sand dollars from your inventory. If you refresh after a failed visit, they all come back, but... burned through a bunch of meat once trying to buy a Skate Park map when I didn't realize I'd run out of underwater breathing. :)

Anyways, this will get fixed once the enhanced quest tracking happens. Then, mafia can be set to just decrement your whiskers and increase your meat if the quest is actually done. Similarly, it can know if you've actually released Big Brother yet or not. But... that's outside the scope of our preAscension scripts, for now.
 
How about cooking quest keys into key limes? Bonus points for a check that key limes still sell for more than non-key limes, and checking if they user has a chef and/or adventures that will be lost anyways.
 
True... I rarely make chefs though, so I skip the whole cooking key thing. I'd rather spend the adventure in the castle usually. :) For people who actually use helpers/Inigo though, it's probably a good plan to add.
 
Mine buys/acquires anything I might need, checks for trophies (redundant) and buys them if they are there, makes tp drinks if swords, autosells quest items (redundant) all based on which class you specify,

I actually don't need anywhere near all the items it acquires but since I generally ascend straight after freeing the king, they arn't being bought each time since I have them from the previous time

Code:
// Pre Ascend by mskc
// version 1.0

// settings
boolean acquiretrophies = true;
boolean buyitems = true;
boolean autosellitems = true;

// end settings

boolean [item] autosell;
int [item] neededitems;
int [item] neededmusitems;
int [item] neededmysitems;
int [item] neededmoxitems;

// items to autosell
autosell[$item[a creased paper strip]] = true;
autosell[$item[a crinkled paper strip]] = true;
autosell[$item[a crumpled paper strip]] = true;
autosell[$item[a folded paper strip]] = true;
autosell[$item[a ragged paper strip]] = true;
autosell[$item[a ripped paper strip]] = true;
autosell[$item[a rumpled paper strip]] = true;
autosell[$item[a torn paper strip]] = true;

// needed items, these will be created, bought or acquired in some way or another
// these are needed regardless of the ascending class!
neededitems[$item[boris's key lime pie]] = 1;
neededitems[$item[jarlsberg's key lime pie]] = 1;
neededitems[$item[sneaky pete's key lime pie]] = 1;
neededitems[$item[star key lime pie]] = 4;
neededitems[$item[digital key lime pie]] = 4;
neededitems[$item[milk of magnesium]] = 12;
//neededitems[$item[clockwork maid]] = 1;
neededitems[$item[antique hand mirror]] = 1;
neededitems[$item[not-a-pipe]] = 18;
neededitems[$item[tomb ratchet]] = 15;
neededitems[$item[disassembled clover]] = 50;
neededitems[$item[wet stew]] = 1;
neededitems[$item[barbed-wire fence]] = 1;
neededitems[$item[baseball]] = 1;
neededitems[$item[black pepper]] = 1;
neededitems[$item[bronzed locust]] = 1;
neededitems[$item[chaos butterfly]] = 1;
neededitems[$item[disease]] = 1;
neededitems[$item[fancy bath salts]] = 1;
neededitems[$item[frigid ninja stars]] = 1;
neededitems[$item[hair spray]] = 1;
neededitems[$item[inkwell]] = 1;
neededitems[$item[Knob Goblin firecracker]] = 1;
neededitems[$item[leftovers of indeterminate origin]] = 1;
neededitems[$item[mariachi G-string]] = 1;
neededitems[$item[meat vortex]] = 1;
neededitems[$item[NG]] = 1;
neededitems[$item[photoprotoneutron torpedo]] = 1;
neededitems[$item[plot hole]] = 1;
neededitems[$item[powdered organs]] = 1;
neededitems[$item[pygmy blowgun]] = 1;
neededitems[$item[razor-sharp can lid]] = 1;
neededitems[$item[sonar-in-a-biscuit]] = 1;
neededitems[$item[spider web]] = 1;
neededitems[$item[stick of dynamite]] = 1;
neededitems[$item[tropical orchid]] = 1;
neededitems[$item[wand of nagamar]] = 1;
neededitems[$item[large box]] = 3;
neededitems[$item[tomb ratchet]] = 15;
neededitems[$item[mick's icyvapohotness inhaler]] = 5;
neededitems[$item[handsomeness potion]] = 1;
neededitems[$item[adder bladder]] = 1;
neededitems[$item[meat engine]] = 1;
neededitems[$item[dope wheels]] = 1;
neededitems[$item[white pixel]] = 30;
neededitems[$item[star]] = 8;
neededitems[$item[line]] = 7;
neededitems[$item[star chart]] = 1;
neededitems[$item[red pixel potion]] = 6;
neededitems[$item[cyclops eyedrops]] = 2;
neededitems[$item[mojo filter]] = 3;
neededitems[$item[Meleegra pills]] = 1;


// needed muscle items
neededmusitems[$item[Knob sausage chow mein]] = 15;
neededmusitems[$item[tequila with training wheels]] = 9;
neededmusitems[$item[lime]] = 9;
neededmusitems[$item[Mon Tiki]] = 21;

// needed mysticality items
neededmysitems[$item[bat wing chow mein]] = 15;
neededmysitems[$item[old-fashioned]] = 9;
neededmysitems[$item[cherry]] = 9;
neededmysitems[$item[gimlet]] = 21;

// needed moxie items
neededmoxitems[$item[rat appendix chow mein]] = 15;
neededmoxitems[$item[dry martini]] = 9;
neededmoxitems[$item[olive]] = 9;
neededmoxitems[$item[Mae West]] = 21;

void autosellitems() {
	print("Autoselling items...","olive");
	foreach i in autosell {
		if (item_amount(i) > 0) {
			if (autosellitems == true) {
			print("Autoselling " + to_string(i));
			autosell(item_amount(i),i);
			} else {
				print("You should autosell:" + to_string(i),"red");
			}
		}
	}
}

void acquireitems(class aClass) {
	print("Aquiring non-class-specific items...","olive");
	foreach i in neededitems {
		if (neededitems[i] > item_amount(i)) {
			print(to_string(i) + " (" + neededitems[i] + "/" + item_amount(i) + ")","red");
			if (buyitems == true) {
				retrieve_item(neededitems[i],i);
			}
		} else {
			print(to_string(i) + " (" + neededitems[i] + "/" + item_amount(i) + ")","green");
		}
	}
	
	int [item] classitems;
	if (aClass==$class[Turtle Tamer] || aClass==$class[Seal Clubber]){
		classitems=neededmusitems;
	} else if (aClass==$class[Pastamancer] || aClass==$class[Sauceror]) {
		classitems=neededmysitems;
	} else if (aClass==$class[Disco Bandit] || aClass==$class[Accordion Thief]) {
		classitems=neededmoxitems;
	}
	
	print("Aquiring class-specific items...","olive");
	foreach i in classitems {
		if (classitems[i] > item_amount(i)) {
			print(to_string(i) + " (" + classitems[i] + "/" + item_amount(i) + ")","red");
			if (buyitems == true) {
				retrieve_item(classitems[i],i);
			}
		} else {
			print(to_string(i) + " (" + classitems[i] + "/" + item_amount(i) + ")","green");
		}
	}
}

void checkandacquiretrophies() {
	print("Checking for trophies...","olive");
	string trophypage = visit_url("trophy.php");
	matcher trophymatcher = create_matcher("name\=whichtrophy.*?value\=(.*?)\>",trophypage);
	while (find(trophymatcher)){
		print("You are entitled to trophy " + group(trophymatcher,1),"red");
		if (acquiretrophies==true) {
			print("Purchasing trophy " + group(trophymatcher,1),"blue");
			if (my_meat() >= 10000) {
				string buytrophy=visit_url("trophy.php?action=buytrophy&whichtrophy="+group(trophymatcher,1),true);
			} else {
				print("Not enough meat","red");
			}
		}
	}
	if (acquiretrophies==true) {
		trophypage = visit_url("trophy.php");
		if (contains_text(trophypage,"entitled to the") == true) {
			print("Something may have gone wrong, there are still trophies to collect!");
		}
	}
}



class parseclass(string c) {
	class cls=to_class(c);

	if(cls==$class[none]) {
		switch(c) {
			case "tt":
			case "turtle":return $class[Turtle Tamer];
			case "sc":
			case "seal":return $class[Seal Clubber];
			case "pm":
			case "pasta":return $class[Pastamancer];
			case "sauce":return $class[Sauceror];
			case "db":
			case "disco":return $class[Disco Bandit];
			case "at":
			case "accordion":
			case "accord":return $class[Accordion Thief];
			default:return $class[none];
		}
	}
	return cls;
}



void main(string ascendingclass) {
	class aClass=parseclass(ascendingclass);
	if (aClass==$class[none]) {
		print("Couldn't parse '" + ascendingclass + "' to a valid class","red");
		exit;
	}
	
	if (my_level() < 13) {
		print("You arn't ready to ascend yet! Go and finish what you started","red");
		exit;
	}
	
	print("Is the king free?");
	if (contains_text(visit_url("questlog.php?which=1"),"freed the King!")) {
		print("Yes.");
	} else {
		Print("No. Go and free him first.");
		exit;
	}

	autosellitems();
	acquireitems(aClass);
	checkandacquiretrophies();

	// if have tps then make drinks
	if (aClass==$class[Turtle Tamer] || aClass==$class[Seal Clubber]){
		create(item_amount($item[tiny plastic sword]),$item[bodyslam]);
	} else if (aClass==$class[Pastamancer] || aClass==$class[Sauceror]) {
		create(item_amount($item[tiny plastic sword]),$item[cherry bomb]);
	} else if (aClass==$class[Disco Bandit] || aClass==$class[Accordion Thief]) {
		create(item_amount($item[tiny plastic sword]),$item[dirty martini]);
	}

	print("All Done","green");

}
 
Code:
// items to autosell
autosell[$item[a creased paper strip]] = true;
autosell[$item[a crinkled paper strip]] = true;
autosell[$item[a crumpled paper strip]] = true;
autosell[$item[a folded paper strip]] = true;
autosell[$item[a ragged paper strip]] = true;
autosell[$item[a ripped paper strip]] = true;
autosell[$item[a rumpled paper strip]] = true;
autosell[$item[a torn paper strip]] = true;

KoLmafia will automatically and silently autosell those before you ascend. Just sayin.
 
True... I rarely make chefs though, so I skip the whole cooking key thing. I'd rather spend the adventure in the castle usually. :) For people who actually use helpers/Inigo though, it's probably a good plan to add.

You can't adventure in the castle drunk. (You can do things like use reflections of a map, maps to safety shelters, and play Dungeon Fist.)
 
I never overdrink into ascension. Several wasted turns, but the value of those turns for crafting v. paying attention to those turns... guess maybe I should shift that at some point, but if you notice, none of my actions actually cost turns in the preAscension script. Anything that costs turns gets done outside the script. :) Least in mine. Which is part of why I posted to see what other people do. :)
 
Back
Top