auto script trigger

ckb

Minion
Staff member
There are a number of Mafia "auto" scripts, and I wonder when they are triggered. Specifically:

betweenBattleScript
afterAdventureScript

What is the difference between these? Are they the same?

postAscensionScript
preAscensionScript
kingLiberatedScript

When are these triggered? I would guess kingLiberatedScript happens as soon as you click the prism, but what about the others?

Thanks,
ckb
 

Bale

Minion
Easiest just to point you at the documentation on script triggers: HERE.

I'm a bit of an overachiever though, so here are your specific answers:

  • betweenBattleScript: Triggered before an adventure. That's after you tell it to adventure, but before actually following the link to the relevant snarfblat.
  • afterAdventureScript: Triggered after each adventure encounter, either combat or noncombat.
  • postAscensionScript: Triggered when you leave Valhalla and enter your new life at level 1 (or level 13 if you are BIG).
  • preAscensionScript: Triggered when you try to shuffle off the mortal coil and enter Valhalla.
  • kingLiberatedScript: Triggered when you break the King's prism.

It may seem weird that a "betweenBattleScript" happens before adventuring which is less descriptive than the others, but there are historical reasons for that which predate the existence of an afterAdventureScript.
 
Last edited:

Theraze

Active member
betweenBattleScript is actually before adventuring.
afterAdventureScript is, as it says, after the adventure is done.
There are times when each is a better option. I set my auto-olfaction in my aAS rather than in the bBS because it would have been changed during the adventure, as opposed to before. Same went for KoLHS booze...

postAscension runs when Valhalla is done.
preAscension runs before you go to Valhalla.
kingLiberated runs when you break the prism.

postAscension is usually something like newLife, setting things that are ascension-based on your new character.
preAscension is usually cleaning up your stuff before jumping, stuff like using the maps and getting goofballs and the like.
kingLiberated includes stuff like pulling your once-a-day items and running breakfast, various bits and pieces like that.

Usually. :D YMMV.
 

Bale

Minion
Sorry about the bad link. Fixed now thanks to you.

As long as we're on the subject, I've got a really nice kingLiberatedScript

Code:
// Get special gear for each class
boolean [item] class_gear(class c) {
	switch(c) {
	case $class[Seal Clubber]:
		return $items[sealskin drum, seal medal, Meat Tenderizer is Murder, warbear exo-arm,
			Krakrox's Loincloth, Claw of the Infernal Seal, Scalp of Gorgolok,
			Frosty's carrot, Frosty's nailbat, Frosty's old silk hat,
			Great Wolf's headband, Great Wolf's left paw, Great Wolf's right paw];
	case $class[Turtle Tamer]	:
		return $items[washboard shield, spirit bell, Ouija Board\, Ouija Board, warbear foil hat,
			Galapagosian Cuisses, Garter of the Turtle Poacher, Elder Turtle Shell,
			Zombo's grievous greaves, Zombo's shield, Zombo's skullcap,
			Unkillable Skeleton's breastplate, Unkillable Skeleton's shinguards, Unkillable Skeleton's skullcap];
	case $class[Pastamancer]:
		return $items[spaghetti-box banjo, experimental carbon fiber pasta additive, Hand that Rocks the Ladle, warbear energy bracers,
			Angelhair Culottes, Bandolier of the Spaghetti Elemental, Colander of Em-er'il,
			Oscus's dumpster waders, Oscus's pelt, Wand of Oscus,
			Mayor Ghost's cloak, Mayor Ghost's khakis, Mayor Ghost's toupee];
	case $class[Sauceror]:
		return $items[marinara jug, hazardous sauce dosimeter, Saucepanic, warbear oil pan,
			Newman's Own Trousers, Gravyskin Belt of the Sauceblob, Ancient Saucehelm,
			Ol' Scratch's ash can, Ol' Scratch's ol' britches, Ol' Scratch's stovepipe hat,
			Drunkula's cape, Drunkula's silky pants, Thunkula's drinking cap];
	case $class[Disco Bandit]:
		return $items[makeshift castanets, The Sagittarian's leisure pants, Frankly Mr. Shank, warbear laser beacon,
			Volartta's bellbottoms, Bling of the New Wave, Disco 'Fro Pick,
			Chester's bag of candy, Chester's cutoffs, Chester's moustache,
			Covers-Your-Head, Drapes-You-Regally, Warms-Your-Tush];
	case $class[Accordion Thief]:
		return $items[left-handed melodica, Skipper's accordion, Shakespeare's Sister's Accordion, warbear exhaust manifold,
			Lederhosen of the Night, La Hebilla del Cinturón de Lopez, El Sombrero De Lopez,
			zombie accordion, zombie mariachi hat, zombie mariachi pants];
	}
	return $items[];
}

void get_stuff() {

	// Empty closet and Hangks
	if(get_property("lastEmptiedStorage").to_int() != my_ascensions()) {
		empty_closet();
		visit_url("storage.php?action=pullall&pwd");
	}
	
	batch_open();  // I am hopeful that one day we will again be able to batch closet requests
	foreach it in class_gear(my_class())
		if(item_amount(it) < 1 && closet_amount(it) > 0) take_closet(1, it);
	batch_close();
}

void equip_character() {
	// Set aftercore familiar
	familiar pick_fam() {
		foreach f in $familiars[Angry Jung Man, Blavious Kloop, 
		  Steam-Powered Cheerleader, Psychedelic Bear, Dancing Frog, Piano Cat, Casagnova Gnome, Jitterbug, Attention-Deficit Demon, Coffee Pixie, 
		  Jumpsuited Hound Dog, Green Pixie, Peppermint Rhino, Baby Gravy Fairy]
			if(have_familiar(f)) return f;
		return $familiar[none];
	}
	use_familiar(pick_fam());
	
	// Might need to copy something. Let's not wait to find out in the relevant combat
	if(item_amount($item[Rain-Doh black box]) < 1 && item_amount($item[can of Rain-Doh]) > 0)
		use(1, $item[can of Rain-Doh]);
	
	string back() {
		if(available_amount($item[buddy bjorn]) == 0)
			return "";
		equip($item[buddy bjorn]);
		return " +equip buddy bjorn";
	}
	string melee() {
		switch(my_primestat()) {
		case $stat[muscle]: return " +melee";
		case $stat[moxie]: return " -melee";
		}
		return "";
	}
	if(have_effect($effect[Merry Smithsness]) < 1 && retrieve_item(1, $item[Flaskfull of Hollow]))
		use(1, $item[Flaskfull of Hollow]);
	maximize("items, .1 meat, -equip mayor ghost's sash -equip navel ring of navel gazing" + back() + melee(), false);
}

void equip_familiars() {
	item it;
	foreach f in $familiars[]
		if(have_familiar(f) && familiar_equipped_equipment(f) == $item[none]) {
			it = familiar_equipment(f);
			if(it != $item[none] && item_amount(it) > 0) {
				print('Equipping your '+f+', "'+f.name+'," with '+it);
				visit_url("familiar.php?action=equip&pwd&whichfam="+ to_int(f) +"&whichitem="+ to_int(it));
			}
		}
}

void breakfast() {
	// Search for new clovers
	(visit($coinmaster[hermit]) && my_meat() > 2000 && hermit(5, $item[ten-leaf clover]));
	cli_execute("breakfast");
	string loginScript = get_property("loginScript");
	if(loginScript != "")
		cli_execute(loginScript);
}
	
void main() {
	// Cashout from kBay
	#visit_url("sendmessage.php?pwd=&action=send&towho=kBay&message=cashout&savecopy=on");
	
	get_stuff();
	equip_familiars();
	equip_character();
	cli_execute("eudora game");
	breakfast();
}
 
Last edited:
Top