OK, here is an alternate outfit caching function which works for me:
Code:
void cache_outfits()
{
if (outfits_cached || (my_basestat($stat[Mysticality]) < 200 || my_basestat($stat[Muscle]) < 200 || my_basestat($stat[Moxie]) < 200))
{
return;
}
vprint("Caching outfits...", "green", 1);
string custom_outfits=visit_url("account_manageoutfits.php");
boolean outfit_exists(string page, string o) {
return contains_text(page,"value=\""+o+"\"");
}
boolean save = true;
if (outfit_exists(custom_outfits, "Mysticality"))
{
strip_familiar("Mysticality");
switch_hand("Mysticality");
save = !outfit("Mysticality");
}
if ( save )
{
outfit( "Birthday Suit" );
maximize("Mysticality" + maximize_familiar, false);
cli_execute("outfit save Mysticality");
}
familiarCache["Mysticality"].f = my_familiar();
familiarCache["Mysticality"].i = familiar_equipped_equipment(my_familiar());
save = true;
if (outfit_exists(custom_outfits, "Muscle"))
{
strip_familiar("Muscle");
switch_hand("Muscle");
save = !outfit("Muscle");
}
if ( save )
{
outfit( "Birthday Suit" );
maximize("Muscle" + maximize_familiar, false);
cli_execute("outfit save Muscle");
}
familiarCache["Muscle"].f = my_familiar();
familiarCache["Muscle"].i = familiar_equipped_equipment(my_familiar());
save = true;
if (outfit_exists(custom_outfits, "Moxie"))
{
strip_familiar("Moxie");
switch_hand("Moxie");
save = !outfit("Moxie");
}
if ( save )
{
outfit( "Birthday Suit" );
maximize("Moxie" + maximize_familiar, false);
cli_execute("outfit save Moxie");
}
familiarCache["Moxie"].f = my_familiar();
familiarCache["Moxie"].i = familiar_equipped_equipment(my_familiar());
save = true;
if (outfit_exists(custom_outfits, "Gauntlet"))
{
strip_familiar("Gauntlet");
switch_hand("Gauntlet");
save = !outfit("Gauntlet");
}
if ( save )
{
outfit( "Birthday Suit" );
maximize("HP" + maximize_familiar, false);
cli_execute("outfit save Gauntlet");
}
familiarCache["Gauntlet"].f = my_familiar();
familiarCache["Gauntlet"].i = familiar_equipped_equipment(my_familiar());
save = true;
if (outfit_exists(custom_outfits, "MPDrain"))
{
strip_familiar("MPDrain");
switch_hand("MPDrain");
save = !outfit("MPDrain");
}
if ( save )
{
outfit( "Birthday Suit" );
string command = "MP" + maximize_familiar;
foreach it in $items[]
{
if (it.boolean_modifier("Moxie May Control MP") || it.boolean_modifier("Moxie Controls MP"))
{
command = command + ", -equip " + it.to_string();
}
}
maximize(command, false);
cli_execute("outfit save MPDrain");
}
familiarCache["MP"].f = my_familiar();
familiarCache["MP"].i = familiar_equipped_equipment(my_familiar());
save = true;
if (outfit_exists(custom_outfits, "MP Regen"))
{
strip_familiar("MP Regen");
switch_hand("MP Regen");
save = !outfit("MP Regen");
}
if ( save )
{
outfit( "Birthday Suit" );
maximize("0.5 MP Regen min, 0.5 MP Regen max" + maximize_familiar, false);
cli_execute("outfit save MP Regen");
}
familiarCache["MP Regen"].f = my_familiar();
familiarCache["MP Regen"].i = familiar_equipped_equipment(my_familiar());
save = true;
if (outfit_exists(custom_outfits, "Damage"))
{
strip_familiar("Damage");
switch_hand("Damage");
save = !outfit("Damage");
}
if ( save )
{
string command = combat_stat.to_string();
foreach i in combat_equipment
{
item equipment = combat_equipment[i].to_item();
if (equipment != $item[none] && available_amount(equipment) > 0 )
{
command = command + ", +equip " + equipment.to_string();
}
}
command = command + ", -familiar";
if(combat_stat.to_string() == "muscle")
command = command + ", +melee";
else if(combat_stat.to_string() == "moxie")
command = command + ", -melee";
outfit( "Birthday Suit" );
maximize(command, false);
cli_execute("outfit save Damage");
}
familiarCache["Damage"].f = $familiar[none];
familiarCache["Damage"].i = $item[none];
outfits_cached = true;
vprint("Outfits caching complete!", "green", 1);
}