Problems trying to unequip Familiar EQ

Camber

Member
Hello! I am writing a script to unequip all my familiar's equipment and can't get the unequip() or unequip_slot() functions to work. I've been researching the Reference manual and google and can't find out why. I just want an quick way to unequip the familiar equipment from all my familiars. Can someone spot where i went wrong? Or does someone know an easier/different way? I am using Windows Xp, KolMafia 12.0.

Thanks!

Code:
void undress_pet(familiar pet) {
	item it = familiar_equipment(pet);
	print("Pet= "+pet+" IT= " + it);
	if(have_familiar(pet)){
		//use_familiar(pet);
		
		//boolean result = unequip_slot( $slot[familiar]) ;
		boolean result = unequip( it ) ;
	}
}

void main() {
	for x from 0 upto 80 by 1
		undress_pet(to_familiar(x));
}
Results:
Code:
> call scripts\undress_pets.ash

Undefined reference 'unequip' (undress_pets.ash, line 8)
 

hippymon

Member
For a quick way of function checking... Simply open the gCLI and type in "ashref" for a FULL list of all ash functions or to search for a more specific function, unequip in this case type: "ashref unequip"
If there are no functions with "unequip" in the title it will return nothing. Keep in mind this feature ONLY returns functions recognized by .ASH scripts, there is still a wide range of CLI functions. In this case there are no .ash unequip functions so I suggest using "cli_execute("unequip " + pet)"


Code:
void undress_pet(familiar pet) {
	item it = familiar_equipment(pet);
	print("Familiar to unequip: " + pet + "- item: " + it);
	if(have_familiar(pet)){
		use_familiar(pet);
		cli_execute("unequip " + pet);
	}
}
void main(){
	for i from 0 upto 80 by 1
		undress_pet(to_familiar(x));
}
 

Camber

Member
Thank you! That did the trick. I'll remember the ashref command for the future.

Now just a little tweaking to make sure it removes the IotM equipment also.

Thanks again.
 

macman104

Member
It may work, and is possibly what you might call backwards but you could try equipping the item "none".

Also in your script, you assume that all of your familiars are equipped, when you try your unequip command with the familiar_equipment item. That may not be true, instead, the familiar may have nothing, or something else. Also, some familiar do not have a certain item. Try
Code:
void undress_pet(familiar pet) {
	if(have_familiar(pet)){
		use_familiar(pet);
		if($slot[familiar].equipped_item() != $item[none])
		{
			equip($slot[familiar], $item[none]);
		}
	}
}

void main() {
	for x from 0 upto 80 by 1
		undress_pet(to_familiar(x));
}
I have no idea if it will work, but it's a thought.
 
Top