Difference between revisions of "Autosell"

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
m (moved Autosell() to Autosell)
imported>Bale
m
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
'''boolean autosell( int quantity, item it )'''<br />
+
{{
Autosells the given items.
+
#vardefine:name|autosell}}{{
 +
#vardefine:return_type|boolean}}{{
  
<p><pre># small scriptlet (taken from my aftercore.ash)) that autosells all of your Castle combat items
+
FunctionPage|
# ... unless you have more than 1000 of each, which you shouldn't, unless you're collecting.
+
name={{#var:name}}|
void castlesell() {
 
  
use(1000, $item[Warm Subject gift certificate]);
+
function1={{Function|
autosell(1000, $item[heavy D]);
+
name={{#var:name}}|
autosell(1000, $item[original G]);
+
aggregate={{#var:aggregate}}|
autosell(1000, $item[disturbing fanfic]);
+
return_type={{#var:return_type}}|
autosell(1000, $item[furry fur]);
+
return_also={{#var:return_also}}|
autosell(1000, $item[wolf mask]);
+
parameter1={{Param|int|qty}}|
autosell(1000, $item[awful poetry journal]);
+
parameter2={{Param|item|it}}|
autosell(1000, $item[thin black candle]);
+
p1desc={{pspan|qty}} is the quantity to sell|
autosell(1000, $item[chaos butterfly]);
+
p2desc={{pspan|it}} is the item to sell|
autosell(1000, $item[plot hole]);
+
}}|
autosell(1000, $item[probability potion]);
 
autosell(1000, $item[procrastination potion]);
 
autosell(1000, $item[angry farmer candy]);
 
autosell(1000, $item[giant needle]);
 
autosell(1000, $item[Mick's IcyVapoHotness Rub]);
 
autosell(1000, $item[rave whistle]);
 
  
}</pre>
+
function_description=Attempts to autosell {{pspan|qty}} of {{pspan|it}}. Returns true if all items are sold as specified, or as many as possible, and false otherwise.</p>
 +
<p>Note that specifying a higher {{pspan|qty}} than you have of an item, or an item that cannot be autosold, will still return true as the function has done as much as it could.|
 +
 
 +
code1={{CodeSample|
 +
title=Code Sample|
 +
description=Sell off all pork gems.|
 +
code=
 +
<syntaxhighlight>
 +
if(item_amount($item[pork elf goodies sack]) > 0)
 +
  use(item_amount($item[pork elf goodies sack]), $item[pork elf goodies sack]);
 +
foreach stone in $items[hamethyst, baconstone, porquoise]
 +
  autosell(item_amount(stone), stone);
 +
</syntaxhighlight>
 +
}}|
 +
 
 +
cli_equiv=The CLI commands "sell" and "autosell" function similarly.|
 +
}}
 +
 
 +
[[Category:Item Management]]

Latest revision as of 22:07, 21 May 2010

Function Syntax

boolean autosell(int qty ,item it )

  • qty is the quantity to sell
  • it is the item to sell

Attempts to autosell qty of it. Returns true if all items are sold as specified, or as many as possible, and false otherwise.

Note that specifying a higher qty than you have of an item, or an item that cannot be autosold, will still return true as the function has done as much as it could.

Code Sample

Sell off all pork gems.

if(item_amount($item[pork elf goodies sack]) > 0)
   use(item_amount($item[pork elf goodies sack]), $item[pork elf goodies sack]);
foreach stone in $items[hamethyst, baconstone, porquoise]
   autosell(item_amount(stone), stone);

CLI Equivalent

The CLI commands "sell" and "autosell" function similarly.