Throw items

From Kolmafia
Jump to navigation Jump to search

Function Syntax

buffer throw_items(item first ,item second )

  • first is the first item to use
  • second is the second item to use

This function attempts to use two items in a combat round (for those with the skill Ambidextrous Funkslinging), and returns the html response from said attempt.

Code Samples

The following is a consult script designed to defeat the shadow. If you have Ambidextrous Funkslinging it will throw two items otherwise it throws one.

void main( int roundnumber, monster opp, string pagetext) {
   if (opp != $monster[your shadow])
      abort("We are not fighting the shadow for some reason....");
   print("Fighting "+opp+".", "green");
   int x = 1;
   while (!contains_text(pagetext,  "The shadow version of yourself explodes") && have_effect($effect[beaten up]) < 1) {
      print("Using Healing Items", "green");
      if (have_skill($skill[Ambidextrous Funkslinging])) {
         if (item_amount($item[gauze garter]) >= 2)
            pagetext = throw_items($item[gauze garter], $item[gauze garter]);
         else if (item_amount($item[filthy poultice]) >= 2)
            pagetext = throw_items($item[filthy poultice], $item[filthy poultice]);
         else if (item_amount($item[gauze garter]) == 1 && item_amount($item[filthy poultice]) > 0)
            pagetext = throw_items($item[gauze garter], $item[filthy poultice]);
         else if (item_amount($item[gauze garter]) == 1)
            pagetext = throw_item($item[gauze garter]);
         else if (item_amount($item[filthy poultice]) == 1)
            pagetext = throw_item($item[filthy poultice]);
         else abort("We ran out of healing items, awkward....finish the shadow yourself");   
      }
      else {
         if (item_amount($item[red pixel potion]) > 0)
            pagetext = throw_item($item[red pixel potion]);
         else if (item_amount($item[gauze garter]) > 0)
            pagetext = throw_item($item[gauze garter]);
         else if (item_amount($item[filthy poultice]) > 0)
            pagetext = throw_item($item[filthy poultice]);
         else {    
            abort("We ran out of healing items, awkward....finish the shadow yourself");   
         }
      }
      if (x > 9) 
         abort("Shadow got stuck.");
      x+=1;
   }
   if (have_effect($effect[beaten up]) > 0) {   
      abort("The shadow beat you :(, please kill him yourself");
   }
   else {
      print("You beat your shadow!", "green");   
   }
}

More info and usage of consult scripts can be found at Custom Combat Script, near the bottom.

CLI Equivalent

The CCS action "item" has the same effect (if supplied with two item names with a comma in between). (You can change your CCS with the command "ccs" on the CLI.)

See Also

attack() | runaway() | throw_item() | use_skill()

More Information

See Consult Scripts for more information.

Special

If the character in question does not have Funkslinging, KoL returns with the error "That doesn't make any sense."

If the second parameter is $item[none], this function is functionally identical to throw_item() (even if the character does not have funkslinging).

Returns an empty buffer if used outside of a consult script.