Bale will probably find it familiar looking, since it spawned out his busting snipped posted earlier in this thread.
I wasn't really planning to publish this yet. It could use a little cleanup at least, but whatever, it should be understandable enough. Currently, the script is kinda stupid, and doesn't check stuff like you actually owning a protopack, but like I said, I wasn't really planning to share it around just yet.
It doesn't even check if you are already adventuring with the protopack, though that might be taken care of by the strict inequality in the turns check. I rarely find myself actually adventuring with the protopack, except in run, between the CSA backpack, Bjorn and Carpe items.
Code:
void SaveSetup() {
if (!SetupSaved) {
print("Saving setup ...", "green");
fam = my_familiar();
throne = my_enthroned_familiar();
bjorn = my_bjorned_familiar();
foreach eqSlot in $slots[]
equipment[eqSlot] = equipped_item(eqSlot);
aa = get_auto_attack();
aas = get_property("afterAdventureScript");
set_property("afterAdventureScript", ""); //Note Awkward workaround: required to stop nested calls of the after Adventure script (as would otherwise happen after any of the adv1() calls in the script). The nesting messes up the restoration of the setup
SetupSaved = TRUE; //To prevent overriding the first saved setup, in case multiple of the functions in the script get called in succession (like picking a bricko fight and then busting a ghost).
//Specifically done at the end, because Restoring a partial setup can get kinda messy (folder holder slots are in $slots[], as I found out the hard way after wondering for a while why my folder holder would randomly be empty every once in a while).
}
}
void RestoreSetup() {
if (SetupSaved) {
set_property("afterAdventureScript", aas);
if (aa != get_auto_attack())
set_auto_attack(aa);
if(fam != my_familiar())
use_familiar(fam);
foreach eqSlot in $slots[]
{
if (equipped_item(eqSlot) != equipment[eqSlot])
equip(eqSlot, equipment[eqSlot]);
}
if (throne != my_enthroned_familiar())
enthrone_familiar( throne );
if (bjorn != my_bjorned_familiar())
bjornify_familiar(bjorn);
print("... Restored setup", "green");
}
}
void BrickoPrime() {
location ghostLocation = to_location(get_property("ghostLocation"));
if (to_boolean(get_property("kingLiberated")) && ghostLocation == $location[none] && total_turns_played() > get_property("nextParanormalActivity").to_int() ) {
if (get_property("_brickoFights").to_int()<10) {
SaveSetup();
set_auto_attack(99148055);
outfit("birthday suit");
if (chooseFamiliar() != my_familiar()) use_familiar(chooseFamiliar());
cli_execute("/outfit Free Drops");
equip($slot[back],$item[protonic accelerator pack]);
cli_execute("maximize .25 ML, Item, empty, -equip sneaky pete's leather jacket, -equip sneaky pete's leather jacket (collar popped)");
use( 1, $item[BRICKO Ooze] );
location ghostLocation = to_location(get_property("ghostLocation"));
if ( ghostLocation != $location[none] )
cli_execute("/timer 51 Ghost!");
}
else {
SaveSetup();
equip($slot[back],$item[protonic accelerator pack]);
adv1(my_location(),0,"");
location ghostLocation = to_location(get_property("ghostLocation"));
if ( ghostLocation != $location[none] )
cli_execute("/timer 51 Ghost!");
}
}
}
void main() {
try {
if ( can_interact() )
{
lightsOut(); //Handles the lights out Quest
digitizeMonster(); //Picks up digitize wanderers in helpful zones. Will equip a protopack if the timing is just right, to save the brickofight.
brickoPrime();
bustGhost(); //Basically Bales function, but with though with similar outfit switching
}
}
finally { RestoreSetup(); }
}
A few notes: chooseFamiliar() is my own little function, basically a simplified implementation of:
http://kolmafia.us/showthread.php?18051-FamiliarDrops-Get-profitable-drops-from-familiars&p=138341 (I really should see if I can adapt that script, it does so much more).
"Free Drops" is the outfit I setup for aftercore purposes to use whenever I'm working on some sort of quest where I don't really need a specialized outfit. Bounty hunting would be the most obvious example, though I haven't done that in a while. It holds equipments that cause drops in or after combat, or other otherwise can make these combats more valuable. Currently it's holding holds the CSA backpack, stinky cheese sword, kol con 13 snowglobe, pantsgiving, screege, cheengs, xiblaxian holo-wrist-puter and a crown of thrones (enthroned familiar varies, but it's usually something like a warbear drone or pottery owl just to collect drops).
The reason I use cli_execute() is to get the normal kol functionality: it will equip the items in the outfit when it can, and leave the other slots empty (to be filled up by the maximize call later). If I use the ash outfit() command it will abort if I currently don't have my stinky cheese sword (because I'm currently running with the eye for example), and while I can catch that return value, I would rather it just equip what it can and ignore the rest.
As for the autoattack problem that started all this: I currently have a little abort in the function to stop when it runs into those two ghosts, so I can check it out in vanilla kol to see what the fuck happens, but that one I posted earlier was the only one I ran into today, and I just ascended, so that will probably be a while.