Difference between revisions of "Buys item"
Jump to navigation
Jump to search
imported>Bale (r9555) |
imported>Eliteofdelete |
||
Line 19: | Line 19: | ||
function_description=Returns true if {{pspan|master}} will purchase {{pspan|it}}.| | function_description=Returns true if {{pspan|master}} will purchase {{pspan|it}}.| | ||
− | + | code1={{CodeSample| | |
+ | title=Code Samples| | ||
+ | description=Checks what items, if any, in your inventory will be bought by coinmasters.| | ||
+ | code= | ||
+ | <syntaxhighlight> | ||
+ | int[item] inventory = get_inventory(); | ||
+ | foreach it in inventory | ||
+ | foreach shop in $coinmasters[] | ||
+ | if (buys_item(shop, it)) | ||
+ | print("The coinmaster "+shop+" will buy your "+it+".", "blue"); | ||
+ | </syntaxhighlight>| | ||
+ | }}| | ||
see_also={{SeeAlso|buy|buy_price}}| | see_also={{SeeAlso|buy|buy_price}}| |
Latest revision as of 08:24, 11 January 2015
Function Syntax
boolean buys_item(coinmaster master ,item it )
- master is the coinmaster to query
- it is the item to query
Returns true if master will purchase it.
Code Samples
Checks what items, if any, in your inventory will be bought by coinmasters.
int[item] inventory = get_inventory();
foreach it in inventory
foreach shop in $coinmasters[]
if (buys_item(shop, it))
print("The coinmaster "+shop+" will buy your "+it+".", "blue");