Throw items: Difference between revisions
imported>StDoodle Created page with '{{ #vardefine:name|throw_items}}{{ #vardefine:return_type|buffer}}{{ FunctionPage| name={{#var:name}}| function_category=In-combat Consulting| function1={{Function| name={{#var…' |
imported>Eliteofdelete No edit summary |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 5: | Line 5: | ||
FunctionPage| | FunctionPage| | ||
name={{#var:name}}| | name={{#var:name}}| | ||
function1={{Function| | function1={{Function| | ||
Line 20: | Line 19: | ||
function_description=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.| | function_description=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.| | ||
code1={{CodeSample| | |||
title=Code Samples| | |||
description=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.| | |||
code= | |||
<syntaxhighlight> | |||
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"); | |||
} | |||
} | |||
</syntaxhighlight>| | |||
moreinfo=More info and usage of consult scripts can be found at [http://wiki.kolmafia.us/index.php?title=Custom_Combat_Script Custom Combat Script], near the bottom. | |||
}}| | |||
see_also={{SeeAlso|attack|runaway|throw_item|use_skill}}| | see_also={{SeeAlso|attack|runaway|throw_item|use_skill}}| | ||
cli_equiv=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.)| | cli_equiv=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.)| | ||
more_info= See [[Custom_Combat_Script#Consult_Scripts|Consult Scripts]] for more information.| | more_info= See [[Custom_Combat_Script#Consult_Scripts|Consult Scripts]] for more information.| | ||
special=Returns an empty buffer if used outside of a consult script.| | special=If the character in question does not have Funkslinging, KoL returns with the error "That doesn't make any sense."</p><p>If the second parameter is $item[none], this function is functionally identical to [[throw_item|throw_item()]] (even if the character does not have funkslinging).</p><p>Returns an empty buffer if used outside of a consult script.| | ||
}} | }} | ||
[[Category:In-combat Consulting]] |
Latest revision as of 22:56, 21 January 2015
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
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.