outfit_pieces()

From KoLMafia
Jump to: navigation, search

Function Syntax

item [int] outfit_pieces(string outfit )

  • outfit is the name of an outfit

This function returns an array of the items which compose an outfit. This works for both KoL standard outfits and custom outfits. If outfit is not a valid outfit, then this will return an empty aggregate.

Code Sample

The following code will determine if you can currently equip a given outfit.

boolean can_equip(string testOutfit) {
   if(count(outfit_pieces(testOutfit)) == 0) {
      print(testOutfit + " is not a valid outfit!", "red");
      return false;
   }
   foreach key,doodad in outfit_pieces(testOutfit)
      if(!can_equip(doodad)) return false;
   return true;
}

See Also