Difference between revisions of "Is tradeable"

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
m
imported>Heeheehee
m (Added code example.)
Line 18: Line 18:
 
function_description=This function checks to see if the item {{pspan|check_me}} can be traded, returning true if it can and false otherwise.|
 
function_description=This function checks to see if the item {{pspan|check_me}} can be traded, returning true if it can and false otherwise.|
  
needscode=yes|
+
code1={{CodeSample|
 +
title=Code Samples|
 +
description=The following function dumps your entire inventory into your mall store.|
 +
code=
 +
<syntaxhighlight>
 +
void inv_dump() {
 +
  if(have_shop()) {
 +
      foreach i in get_inventory()
 +
        if(is_tradeable(i)) put_shop(0, item_amount(i), i);
 +
  }
 +
}
 +
</syntaxhighlight>
 +
}}|
  
 
see_also={{SeeAlso|is_displayable|is_giftable}}|
 
see_also={{SeeAlso|is_displayable|is_giftable}}|
 
}}
 
}}

Revision as of 04:55, 16 March 2010

Function Syntax

boolean is_tradeable(item check_me )

  • check_me is an item to test

This function checks to see if the item check_me can be traded, returning true if it can and false otherwise.

Code Samples

The following function dumps your entire inventory into your mall store.

void inv_dump() {
   if(have_shop()) {
      foreach i in get_inventory()
         if(is_tradeable(i)) put_shop(0, item_amount(i), i);
   }
}

See Also

is_displayable() | is_giftable()