Familiar Help

yuck foo

New member
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.
 
[quote author=yuck foo link=topic=82.msg264#msg264 date=1145117211]
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.
[/quote]

I am wanting to think I saw a have_familiar command somewhere. If that is an actual command, then:

Code:
if(have_familiar($familiar[leprechaun]))
 {
 equip_familiar($familiar[leprechaun]);
 }
I haven't tested this though.
 

Nightmist

Member
[quote author=efilnikufecin link=topic=82.msg271#msg271 date=1145148125]
If that is an actual command, then:[/quote]

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*)

Code:
 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

Member
[quote author=efilnikufecin link=topic=82.msg271#msg271 date=1145148125]
I am wanting to think I saw a have_familiar command somewhere. If that is an actual command, then:

Code:
if(have_familiar($familiar[leprechaun]))
 {
 equip_familiar($familiar[leprechaun]);
 }
I haven't tested this though.
[/quote]

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 where I have, in part, the following:

Code:
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

Member
well I just checked the code in KolMafiaASH.java which is where all the other ASH commands are and there is no
Code:
have_familiar
there is
Code:
equip_familair
So yea, just so you know.
 
Top