View Full Version : Familiar Help
yuck foo
04-15-2006, 04:06 PM
I'm looking at the Ref and Tut, and can't figure out how to do what I want...
How do I have a script determine if I have a specific familiar? If I equip_familiar() a familiar I don't have, the script stops. my_familiar() only returns the one currently out of the terrarium.
Thanks.
efilnikufecin
04-16-2006, 12:42 AM
I'm looking at the Ref and Tut, and can't figure out how to do what I want...
How do I have a script determine if I have a specific familiar?* If I equip_familiar() a familiar I don't have, the script stops.* my_familiar() only returns the one currently out of the terrarium.
Thanks.
I am wanting to think I saw a have_familiar command somewhere. If that is an actual command, then:
if(have_familiar($familiar[leprechaun]))
{
equip_familiar($familiar[leprechaun]);
}
I haven't tested this though.
Nightmist
04-16-2006, 05:21 AM
If that is an actual command, then:
If it isnt then the messy way that you can do it is to use a URL to equip a familiar and then status refresh. Since if the raw url just returns you dont have that familiar mafia wont abort. (So, the steps would be, check if im currently using *fam*, if not use a raw url to attempt to equip that fam, refresh your status (And in doing so your current familiar), if currently still not using *fam* you dont have *fam*)
if( my_familiar() != $familiar[*Fam*])
{
cli_execute( "familiar.php?action=newfam&newfam=*FamNumber*");
if( my_familiar() != $familiar[*Fam*])
{
~Script stuff that you use when you dont have a *Fam*~
}
}
Tirian
04-19-2006, 11:11 PM
I am wanting to think I saw a have_familiar command somewhere. If that is an actual command, then:
if(have_familiar($familiar[leprechaun]))
{
equip_familiar($familiar[leprechaun]);
}
I haven't tested this though.
If it is, it is undocumented. I suppose I could check the source....
Still, I don't have any trouble using equip_familiar without having it abort the script. You can check out my "dressing your familiar" script here (http://kolmafia.us/index.php/topic,91.new.html#new) where I have, in part, the following:
boolean dress_pet(familiar pet)
{
item it;
it = familiar_to_item(pet);
if (item_amount(it)==0) return false;
if (!equip_familiar(pet)) return false;
if (!equip(it)) return false;
if (item_amount(it)>0) sell_item(item_amount(it), it);
return true;
}
And this works no matter whether I own the familiar or not.
Thinking out loud without doing any testing, I wonder if the difference is that I am using the function in a boolean context. That is, if equip_familiar(pet); aborts the script, maybe if (!equip_familiar(pet)) council(); wouldn't.
macman104
04-20-2006, 03:00 AM
well I just checked the code in KolMafiaASH.java which is where all the other ASH commands are and there is no
have_familiarthere is
equip_familair So yea, just so you know.
Powered by vBulletin® Version 4.2.0 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.