I've been using a custom script of mine for a few years now, but strange bugs pop up and I've always wondered if I was using script imports incorrectly or something. Below is the main() function that I copy-pasted from SmartStasis into my script fxer.ash, with two blocks of modifications as commented in the code: Actions that have to fire before SmartStasis takes an action, and Actions that can fire whenever SmartStasis chooses.
1st change: To use a nanorhino you have to use a muscle skill as your first skill (like Toss, if you cast entangling noodles that is Myst class and you can't Nanobrawny effect). So my mod is just to fire a macro directly to the server and not enqueue anything with smartstasis/batbrain.
Then you see build_custom(), which SS/Batbrain use to create the actions.
2nd change: Then I add a few more skills, if necessary, to the custom[] combat queue array. Such as Creepy Grin if it hasn't been used yet.
Those are my only additions but strange bugs pop up for me such as:
1) On firing the Romantic Arrow, mafia halts and says you're on your own, I've posted about it before here: http://kolmafia.us/showthread.php?1...for-a-simple-CCS&p=98824&viewfull=1#post98824
2) Recently a macro has started getting built that tries to use the Indigo Cup repeatedly in a combat, even though it's a once-per-combat item and is marked as such in BatFactors.txt, I've posted about it here: http://kolmafia.us/showthread.php?6...onsult-scripts&p=117925&viewfull=1#post117925
Hopefully this is just me being a bad scripter, so perhaps this code shows what obvious error I'm making and how to correct it. Anyone else had trouble firing romantic arrows from their scripts?
1st change: To use a nanorhino you have to use a muscle skill as your first skill (like Toss, if you cast entangling noodles that is Myst class and you can't Nanobrawny effect). So my mod is just to fire a macro directly to the server and not enqueue anything with smartstasis/batbrain.
Then you see build_custom(), which SS/Batbrain use to create the actions.
2nd change: Then I add a few more skills, if necessary, to the custom[] combat queue array. Such as Creepy Grin if it hasn't been used yet.
Those are my only additions but strange bugs pop up for me such as:
1) On firing the Romantic Arrow, mafia halts and says you're on your own, I've posted about it before here: http://kolmafia.us/showthread.php?1...for-a-simple-CCS&p=98824&viewfull=1#post98824
2) Recently a macro has started getting built that tries to use the Indigo Cup repeatedly in a combat, even though it's a once-per-combat item and is marked as such in BatFactors.txt, I've posted about it here: http://kolmafia.us/showthread.php?6...onsult-scripts&p=117925&viewfull=1#post117925
Hopefully this is just me being a bad scripter, so perhaps this code shows what obvious error I'm making and how to correct it. Anyone else had trouble firing romantic arrows from their scripts?
PHP:
// SmartStasish.ash Consult Script for your CCS, with additions
void main(int initround, monster foe, string pg) {
act(pg);
vprint_html("Profit per round: "+to_html(baseround()),5);
// *** MODIFICATIONS TO FIRE BEFORE SmartStasis ***
// Attempt to get Nanobrawny buff from nanorhino
if( my_fam() == $familiar[nanorhino] && $familiar[nanorhino].image == "nanorhinoc.gif"){
// Track the number of nanorhino uses today
set_property("_nanorhinoUses", get_property("_nanorhinoUses").to_int() + 1);
//custom[count(custom)] = to_event("skill " + get_combat_skill("muscle").to_int(),"",1);
abort("ready for nanorino combat skill!");
macro("skill " + get_combat_skill("muscle").to_int()); // Need to fire this to server before SS tries entangling noodles or some such
}
// *** END BEFORE SmartStasis MODS ***
// custom actions
build_custom();
// *** MODIFICATIONS TO FIRE WHENEVER SmartStasis WANTS ***
// Attempt to unleash the nanites if it will banish a monster
if( have_effect($effect[nanobrawny]) >= 40 && get_banish_monsters("perm") contains foe){
custom[count(custom)] = to_event("skill " + $skill[Unleash Nanites].to_int(),"",1);
//macro("skill " + $skill[Unleash Nanites].to_int());
}
// Attempt to temporarily banish monsters if you have skills available
if( get_banish_monsters("temp") contains foe ){
// Pantsgiving (30 advs, 5 daily)
if( have_skill($skill[Talk About Politics]) && get_property("_pantsgivingBanish").to_int() < 5){
custom[count(custom)] = to_event("skill " + $skill[Talk About Politics].to_int(),"",1);
}
// Vivala mask (10 advs, 1 daily)
else if( have_skill($skill[Creepy Grin]) && !get_property("_vmaskBanisherUsed").to_boolean() ){
custom[count(custom)] = to_event("skill " + $skill[creepy grin].to_int(),"",1);
}
// Stinky cheese eye (10 advs, 1 daily)
else if( have_skill($skill[Give Your Opponent the Stinkeye]) && !get_property("_stinkyCheeseBanisherUsed").to_boolean() ){
custom[count(custom)] = to_event("skill " + $skill[Give Your Opponent the Stinkeye].to_int(),"",1);
}
}
// Use the romantic arrow if we've got our Obtuse Angel with us
if( my_fam() == $familiar[Obtuse Angel] && get_putty_monster() == foe){
custom[count(custom)] = to_event("skill " + $skill[Fire a badly romantic arrow].to_int(),"",1);
}
// *** END WHENEVER SmartStasis MODS ***
switch (m) { // add boss monster items here since BatMan is not being consulted
case $monster[conjoined zmombie]: for i from 1 upto item_amount($item[half-rotten brain])
custom[count(custom)] = get_action("use 2562"); break;
case $monster[giant skeelton]: for i from 1 upto item_amount($item[rusty bonesaw])
custom[count(custom)] = get_action("use 2563"); break;
case $monster[huge ghuol]: for i from 1 upto item_amount($item[can of Ghuol-B-Gone™])
custom[count(custom)] = get_action("use 2565"); break;
}
if (count(queue) > 0 && queue[0].id == "pickpocket" && my_class() == $class[disco bandit]) try_custom();
else enqueue_custom();
// combos
build_combos();
if (($familiars[hobo monkey, gluttonous green ghost, slimeling] contains my_fam() && !happened("famspent")) || have_equipped($item[crown of thrones])) try_combos();
else enqueue_combos();
// stasis loop
stasis();
if (round < maxround && !is_our_huckleberry() && adj.stun < 1 && stun_action(false).stun > to_int(dmg_dealt(buytime.dmg) == 0) &&
kill_rounds(smack) > 1 && min(buytime.stun-1, kill_rounds(smack)-1)*m_dpr(0,0)*meatperhp > buytime.profit) enqueue(buytime);
macro();
vprint("SmartStasis complete.",9);
}