Sells item: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Bale
r9555
 
imported>Eliteofdelete
No edit summary
 
Line 19: Line 19:
function_description=Returns true if {{pspan|master}} will sell {{pspan|it}}.|
function_description=Returns true if {{pspan|master}} will sell {{pspan|it}}.|


needscode=yes|
code1={{CodeSample|
title=Code Samples|
description=The following example looks through each item in your inventory and tells you if a coinmaster sells it.|
code=
<syntaxhighlight>
int[item] stuff = get_inventory();
foreach master in $coinmasters[]
  foreach it in stuff
      if (sells_item(master, it))
        print(""+master+" sells "+it+" which you currently have "+stuff[it]+" of.", "blue");
 
 
</syntaxhighlight>|
 
}}|


see_also={{SeeAlso|sell|sell_price}}|
see_also={{SeeAlso|sell|sell_price}}|

Latest revision as of 22:24, 21 January 2015

Function Syntax

boolean sells_item(coinmaster master ,item it )

  • master is the coinmaster to query
  • it is the item to query

Returns true if master will sell it.

Code Samples

The following example looks through each item in your inventory and tells you if a coinmaster sells it.

int[item] stuff = get_inventory();
foreach master in $coinmasters[]
   foreach it in stuff
      if (sells_item(master, it))
         print(""+master+" sells "+it+" which you currently have "+stuff[it]+" of.", "blue");

See Also

sell() | sell_price()