Difference between revisions of "Is discardable"

From Kolmafia
Jump to navigation Jump to search
imported>Relyk
m
imported>Bale
m (Bale moved page Is discardable() to Is discardable without leaving a redirect)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{
 
{{
#vardefine:name|is discardable}}{{
+
#vardefine:name|is_discardable}}{{
 
#vardefine:return_type|boolean}}{{
 
#vardefine:return_type|boolean}}{{
 
FunctionPage|
 
FunctionPage|
Line 32: Line 32:
 
}}|
 
}}|
  
see_also={{SeeAlso|use|autosell}}|
+
see_also={{SeeAlso|use|autosell|is_giftable}}|
 
}}
 
}}
  
[[Category:Skills and Effects]]
+
[[Category:Item Management]]

Latest revision as of 10:28, 21 November 2014

Function Syntax

boolean is_discardable(item check_me )

  • check_me is an item to test

This function check if item can be discarded, returning true if it can other false. Keep in mind it will return true if item can be autosold.

Code Sample

The following searches all items in inventory and stores any items on display that can be discarded but not autosold (Autosell value is 0).

batch_open();
int[item] inventory = get_inventory() ;
foreach it in inventory
   if ( is_discardable(it) && autosell_price(it) == 0 ){
      put_display( item_amount(it), it );
   }
batch_close();
// We're using a batch here to minimize server hits.

See Also

use() | autosell() | is_giftable()