Get ingredients: Difference between revisions
imported>StDoodle Created page with '{{#vardefine:name|get_ingredients}} {{#vardefine:return_type|int [item]}} {{#vardefine:aggregate|yes}} {{FunctionPage| name={{#var:name}}| function_category=Item Management| fu…' |
imported>Icon315 No edit summary |
||
(6 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
{{#vardefine:name|get_ingredients}} | {{ | ||
{{#vardefine:return_type|int [item]}} | #vardefine:name|get_ingredients}}{{ | ||
{{#vardefine:aggregate|yes}} | #vardefine:return_type|int [item]}}{{ | ||
#vardefine:aggregate|yes}}{{ | |||
FunctionPage| | |||
name={{#var:name}}| | name={{#var:name}}| | ||
function1={{Function| | function1={{Function| | ||
Line 18: | Line 18: | ||
function_description=Returns a map keyed by item names with the values equal to the quantity of each ingredient required to make {{pspan|parse_me}}. Note that for multi-stage crafting (where you combine several items to get intermediate items, and then combine those for the final result), only the last stage of requirements is listed. This function will parse items that can be created through multi-use of items as well as "traditional" creation methods such as cooking, cocktailcrafting, and smithing.| | function_description=Returns a map keyed by item names with the values equal to the quantity of each ingredient required to make {{pspan|parse_me}}. Note that for multi-stage crafting (where you combine several items to get intermediate items, and then combine those for the final result), only the last stage of requirements is listed. This function will parse items that can be created through multi-use of items as well as "traditional" creation methods such as cooking, cocktailcrafting, and smithing.| | ||
special= Returns an empty map for items that cannot be created.| | code1={{CodeSample| | ||
title=Code Sample| | |||
description=Check to see if the character can equip a Hippo Poncho.| | |||
code= | |||
<syntaxhighlight> | |||
int [item] reqd = get_ingredients($item[SOMETHING]); | |||
foreach i in reqd { | |||
if (item_amount(i) < reqd[i]) print("You don't have enough: " + i.to_string()); | |||
} | |||
</syntaxhighlight> | |||
}}| | |||
more_info=See the {{kolwiki|Discoveries}} for more information.| | |||
special= Returns an empty map for items that cannot be created at the moment, taking into account gender, skills, adventures remaining, tools in inventory, current date, and access to certain forms of crafting (e.g. Crimbo Town).| | |||
}} | }} | ||
[[Category:Item Management]] |
Latest revision as of 21:44, 5 August 2010
Function Syntax
int [item] get_ingredients(item parse_me )
- parse_me is the creatable item to list the ingredients for
Returns a map keyed by item names with the values equal to the quantity of each ingredient required to make parse_me. Note that for multi-stage crafting (where you combine several items to get intermediate items, and then combine those for the final result), only the last stage of requirements is listed. This function will parse items that can be created through multi-use of items as well as "traditional" creation methods such as cooking, cocktailcrafting, and smithing.
Code Sample
Check to see if the character can equip a Hippo Poncho.
int [item] reqd = get_ingredients($item[SOMETHING]);
foreach i in reqd {
if (item_amount(i) < reqd[i]) print("You don't have enough: " + i.to_string());
}
More Information
See the Discoveries for more information.
Special
Returns an empty map for items that cannot be created at the moment, taking into account gender, skills, adventures remaining, tools in inventory, current date, and access to certain forms of crafting (e.g. Crimbo Town).