Difference between revisions of "Turtle.craft"

From ComputerCraft Wiki
Jump to: navigation, search
m (Added info about parameters)
(added parameter description)
Line 2: Line 2:
 
{{Function
 
{{Function
 
|name=turtle.craft
 
|name=turtle.craft
|args=
+
|args=[[int (type)|number]] quantity ( if not supplied will craft as many as possible )
|returns=true if an item was crafted; false otherwise.
+
|returns=[[boolean (type)|boolean]] if an item was crafted
 
|api=turtle
 
|api=turtle
 
|addon=ComputerCraft
 
|addon=ComputerCraft
Line 11: Line 11:
 
Will not craft if there are any items in the turtle's inventory that are not part of the recipe, including in the slots not used for crafting.
 
Will not craft if there are any items in the turtle's inventory that are not part of the recipe, including in the slots not used for crafting.
 
The produced items will appear in the selected slot, if that slot is free. If not, it will try the next available slot.
 
The produced items will appear in the selected slot, if that slot is free. If not, it will try the next available slot.
Can also take a parameter specifying how many of the item to craft.
+
A parameter can also be supplied to specify the quantity of items to craft.
 
}}
 
}}
 
<!--
 
<!--

Revision as of 15:58, 18 January 2013


Grid Redstone.png  Function turtle.craft
Requires a Crafty Turtle.

Crafts an item if items in the turtle's inventory matches a valid recipe. The items can be placed anywhere as long as they are oriented properly with respect to one another. Can craft a maximum of one stack of items at a time; for example, if you put three stacks of 64 reed in a line and craft them, only 63 paper will be crafted, and three piles of 43 reed will remain in the turtle. Will not craft if there are any items in the turtle's inventory that are not part of the recipe, including in the slots not used for crafting. The produced items will appear in the selected slot, if that slot is free. If not, it will try the next available slot.

A parameter can also be supplied to specify the quantity of items to craft.
Syntax turtle.craft(number quantity ( if not supplied will craft as many as possible ))
Returns boolean if an item was crafted
Part of ComputerCraft
API turtle