Use familiar

From Kolmafia
Revision as of 23:04, 21 January 2015 by imported>Eliteofdelete
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Function Syntax

boolean use_familiar(familiar buddy )

  • buddy is the familiar to equip

Switches your current familiar for the the familiar buddy specified. Returns true if the specified familiar buddy is your current familiar after the function's completion (so it will return true if you try to switch to your current familiar).

Code Samples

Following example is a function that will look through all possible familiars based on the numeric modifier given and return the best one to use. If you have it, it will use it.

familiar my_bestfam (string check) {
   familiar current = $familiar[none];
   float best = 0.0;
   foreach it in $familiars[] { //checks based on your familiars current weight and equipment
      float drop = numeric_modifier(it, check, familiar_weight(it), familiar_equipped_equipment(it));
      if (drop > best) {
         best = drop;
         current = it;
         print(""+it+" has "+check+" rate of "+drop+".", "blue");
      }
   }
print("Best found familiar for "+check+" was "+current, "green");
return current;
}

familiar best_fam;
best_fam = my_bestfam("meat drop"); //Some common possibilities for my_bestfam: meat drop, item drop, monster level, initiative, experience
if (have_familiar(best_fam)) {
   print("Equipping "+best_fam+".", "green");
   use_familiar(best_fam);
}
else print("You currently do not have "+best_fam+".", "red");

For a full list of numeric modifiers, see the following thread: List.

CLI Equivalent

The CLI command "familiar" has the same function when a familiar type is specified as the only parameter.

See Also

have_familiar()