Difference between pages "Talk:Batch close" and "Autosell price"

From Kolmafia
(Difference between pages)
Jump to navigation Jump to search
imported>Jasonharper
(Bad example!)
 
imported>Jasonharper
m (Explanation of negative values)
 
Line 1: Line 1:
This is a really bad example of how to use batches:
+
{{#vardefine:name|autosell_price}}
* The batchable commands are all executed conditionally, so the order in which the first instance of each one is unpredictable, and therefore the order in which the batched commands are executed is unpredictable.  If both autosellable and mallsellable items were processed prior to the first item that had a nonzero closet amount, the batch of take_closet()s will be executed LASTThis really needs to be done in at least two separate batches - the autosell and mallsell can be safely done in the same batch, since at most one will be done for any given item.
+
{{#vardefine:return_type|int}}
* There are extraneous server-hitting commands inside the batch, for no reason whatsoever.  If cli_execute() became batchable (unlikely, but not entirely impossible), the script would malfunction because the inventory counts inside the main loop wouldn't reflect the outfit changevisit_url() is safe in a batch only because it has an individually significant return value.
+
 
* In any case, an example that the user CAN'T SAFELY TRY FOR THEMSELVES does not strike me as being particularly educational.
+
{{FunctionPage|
--[[User:Jasonharper|Jasonharper]] 11:58, 5 March 2010 (UTC)
+
name={{#var:name}}|
 +
function_category=Item Management|
 +
 
 +
function1={{Function|
 +
name={{#var:name}}|
 +
aggregate={{#var:aggregate}}|
 +
return_type={{#var:return_type}}|
 +
return_also={{#var:return_also}}|
 +
parameter1={{Param|item|it}}|
 +
p1desc={{pspan|it}} is the item to check the price of|
 +
}}|
 +
 
 +
function_description=Returns the autosell price of item {{pspan|it}}, or a value <= 0 if the item cannot be autosoldThe value will be presented as a negative number in a few unusual cases where an item can't be autosold, but does have a defined value detectable by other means: a Mall minimum price other than 100, or a price in one of the sign restaurantsThe laser-broiled pear is an example of a non-autosellable item with a value detectable both ways.|
 +
 
 +
needscode=yes|
 +
 
 +
see_also={{SeeAlso|autosell}}|
 +
}}
 +
{{RFI|Is there something I'm not thinking of, as the old description said non-autosell items returned a negative value?<br />Tested items included quest keys, macguffin diary & useless powder (all returned 0)}}

Revision as of 13:39, 5 March 2010



needs(code_samples);

Function Syntax

int autosell_price(item it )

  • it is the item to check the price of

Returns the autosell price of item it, or a value <= 0 if the item cannot be autosold. The value will be presented as a negative number in a few unusual cases where an item can't be autosold, but does have a defined value detectable by other means: a Mall minimum price other than 100, or a price in one of the sign restaurants. The laser-broiled pear is an example of a non-autosellable item with a value detectable both ways.

See Also

autosell()


Attention KoLmafia Experts!

We need your help; some details of this function's operation are unknown or unclear.

The following specific question has been raised:

  • Is there something I'm not thinking of, as the old description said non-autosell items returned a negative value?
    Tested items included quest keys, macguffin diary & useless powder (all returned 0)