Posted 05 January 2013 - 08:30 AM
Godd evening,
I have a little problme with this program… I tried to create a program to craft every item from vanilla…
I made a table for the items and later i try to craft them. To avoid making an entry for every item i tried to regroup item with the same pattern in the crafting grid.
Ex.: recipe of torch = recipe of lever
When I try to run my program I get an error on line 246. An unexpected symbol. But I don't know how to solve this.
Here is my code
or the version of pastebin
http://pastebin.com/EpEPB8ps
Thank you for your attention and help.
Have a nice evening everybody!!!!
I have a little problme with this program… I tried to create a program to craft every item from vanilla…
I made a table for the items and later i try to craft them. To avoid making an entry for every item i tried to regroup item with the same pattern in the crafting grid.
Ex.: recipe of torch = recipe of lever
When I try to run my program I get an error on line 246. An unexpected symbol. But I don't know how to solve this.
Here is my code
Spoiler
--[[Recipe List]]--
recipes = {
["Stick"] = {
map = {
[1] = 0, [2] = 0, [3] = 0,
[5] = 0, [6] = 1, [7] = 0,
[9] = 0, [10]= 1, [11]= 0
},
},
["Torch"] = {
map = {
[1] = 0, [2] = 0, [3] = 0,
[5] = 0, [6] = 1, [7] = 0,
[9] = 0, [10]= 2, [11]= 0
},
},
["Minecart"] = {
map = {
[1] = 0, [2] = 0, [3] = 0,
[5] = 1, [6] = 0, [7] = 1,
[9] = 1, [10]= 1, [11]= 1
},
},
["Axe"] = {
map = {
[1] = 1, [2] = 1, [3] = 0,
[5] = 1, [6] = 2, [7] = 0,
[9] = 0, [10]= 2, [11]= 0
},
},
["Pickaxe"] = {
map = {
[1] = 1, [2] = 1, [3] = 1,
[5] = 0, [6] = 2, [7] = 0,
[9] = 0, [10]= 2, [11]= 0
},
},
["Shovel"] = {
map = {
[1] = 0, [2] = 1, [3] = 0,
[5] = 0, [6] = 2, [7] = 0,
[9] = 0, [10]= 2, [11]= 0
},
},
["Hoe"] = {
map = {
[1] = 1, [2] = 1, [3] = 0,
[5] = 0, [6] = 2, [7] = 0,
[9] = 0, [10]= 2, [11]= 0
},
},
["Flint and Steel"] = {
map = {
[1] = 0, [2] = 0, [3] = 0,
[5] = 1, [6] = 0, [7] = 0,
[9] = 0, [10]= 2, [11]= 0
},
},
["Bucket"] = {
map = {
[1] = 0, [2] = 0, [3] = 0,
[5] = 1, [6] = 0, [7] = 1,
[9] = 0, [10]= 1, [11]= 0
},
},
["Compass"] = {
map = {
[1] = 0, [2] = 1, [3] = 0,
[5] = 1, [6] = 2, [7] = 1,
[9] = 0, [10]= 1, [11]= 0
},
},
["Map"] = {
map = {
[1] = 1, [2] = 1, [3] = 1,
[5] = 1, [6] = 2, [7] = 1,
[9] = 1, [10]= 1, [11]= 1
},
},
["Fishing Rod"] = {
map = {
[1] = 0, [2] = 0, [3] = 1,
[5] = 0, [6] = 1, [7] = 2,
[9] = 1, [10]= 0, [11]= 2
},
},
["Shears"] = {
map = {
[1] = 0, [2] = 0, [3] = 0,
[5] = 0, [6] = 1, [7] = 0,
[9] = 1, [10]= 0, [11]= 0
},
},
["Fire Charge"] = {
map = {
[1] = 0, [2] = 0, [3] = 0,
[5] = 1, [6] = 2, [7] = 0,
[9] = 0, [10]= 3, [11]= 0
},
},
["Sword"] = {
map = {
[1] = 0, [2] = 1, [3] = 0,
[5] = 0, [6] = 1, [7] = 0,
[9] = 0, [10]= 2, [11]= 0
},
},
["Bow"] = {
map = {
[1] = 0, [2] = 1, [3] = 2,
[5] = 1, [6] = 0, [7] = 2,
[9] = 0, [10]= 1, [11]= 2
},
},
["Arrows"] = {
map = {
[1] = 0, [2] = 1, [3] = 0,
[5] = 0, [6] = 2, [7] = 0,
[9] = 0, [10]= 3, [11]= 0
},
},
["Helmet"] = {
map = {
[1] = 0, [2] = 0, [3] = 0,
[5] = 1, [6] = 1, [7] = 1,
[9] = 0, [10]= 0, [11]= 1
},
},
["Chestplate"] = {
map = {
[1] = 1, [2] = 0, [3] = 1,
[5] = 1, [6] = 1, [7] = 1,
[9] = 1, [10]= 1, [11]= 1
},
},
["Leggings"] = {
map = {
[1] = 1, [2] = 1, [3] = 1,
[5] = 1, [6] = 0, [7] = 1,
[9] = 1, [10]= 0, [11]= 1
},
},
["Boots"] = {
map = {
[1] = 0, [2] = 0, [3] = 0,
[5] = 1, [6] = 0, [7] = 1,
[9] = 1, [10]= 0, [11]= 1
},
},
["Door"] = {
map = {
[1] = 1, [2] = 1, [3] = 0,
[5] = 1, [6] = 1, [7] = 0,
[9] = 1, [10]= 1, [11]= 0
},
},
["Redstone Repeater"] = {
map = {
[1] = 0, [2] = 0, [3] = 0,
[5] = 1, [6] = 2, [7] = 1,
[9] = 3, [10]= 3, [11]= 3
},
},
[" Bowl"] = {
map = {
[1] = 0, [2] = 0, [3] = 0,
[5] = 1, [6] = 0, [7] = 1,
[9] = 0, [10]= 1, [11]= 0
},
},
["Bread"] = {
map = {
[1] = 0, [2] = 0, [3] = 0,
[5] = 0, [6] = 0, [7] = 0,
[9] = 1, [10]= 1, [11]= 1
},
},
["Sugar Cane"] = {
map = {
[1] = 0, [2] = 0, [3] = 0,
[5] = 0, [6] = 1, [7] = 0,
[9] = 0, [10]= 0, [11]= 0
},
},
["Cake"] = {
map = {
[1] = 1, [2] = 1, [3] = 1,
[5] = 2, [6] = 3, [7] = 2,
[9] = 4, [10]= 4, [11]= 4
},
},
["Cookie"] = {
map = {
[1] = 0, [2] = 0, [3] = 0,
[5] = 0, [6] = 0, [7] = 0,
[9] = 1, [10]= 2, [11]= 1
},
},
["Melon Block"] = {
map = {
[1] = 1, [2] = 1, [3] = 1,
[5] = 1, [6] = 1, [7] = 1,
[9] = 1, [10]= 1, [11]= 1
},
},
["Sign"] = {
map = {
[1] = 1, [2] = 1, [3] = 1,
[5] = 1, [6] = 1, [7] = 1,
[9] = 0, [10]= 2, [11]= 0
},
},
["Book"] = {
map = {
[1] = 0, [2] = 0, [3] = 0,
[5] = 1, [6] = 1, [7] = 0,
[9] = 1, [10]= 2, [11]= 0
},
},
["Beds"] = {
map = {
[1] = 0, [2] = 0, [3] = 0,
[5] = 1, [6] = 1, [7] = 1,
[9] = 2, [10]= 2, [11]= 2
},
},
["Cauldron"] = {
map = {
[1] = 1, [2] = 0, [3] = 1,
[5] = 1, [6] = 0, [7] = 1,
[9] = 1, [10]= 1, [11]= 1
},
},
["Brewing Stand"] = {
map = {
[1] = 0, [2] = 0, [3] = 0,
[5] = 0, [6] = 1, [7] = 0,
[9] = 2, [10]= 2, [11]= 2
},
},
}
--[[Equivalence]]--
recipes["Minecart with Furnace"] = recipes["Minecart with Chest"] = recipes["Redstone Torch"] = recipes["Lever"] = recipes["Eye of Ender"] = recipes["Light Gray Dye"] = recipes["Gray Dye"] = recipes["Rose Red"] = recipes["Orange Dye"] = recipes["Dandelion Yellow"] = recipes["Lime Dye"] = recipes["Light Blue Dye"] = recipes["Cyan Dye"] = recipes["Purple Dye"] = recipes["Magenta Dye"] = recipes["Pink Dye"] = recipes["Magma Cream"] = recipes["Glistering Melon"] = recipes["Torch"]
recipes["Minecart"] = recipes["Boat"]
recipes["Compass"] = recipes["Clock"]
recipes["Flint and Steel"] = recipes["Carrot on a Stick"]
recipes["Fire Charge"] = recipes["Mushroom Stew"] = recipes["Pumpkin Pie"] = recipes["Book and Quill"] = recipes["Fermented Spider Eye"]
recipes["Map"] = recipes["Golden Apple"] = recipes["Enchanted Golden Apple"] = recipes["Golden Carrot"] = recipes["Painting"] = recipes["Item Frame"]
recipes["Sugar Cane"] = recipes["Melon Seeds"] = recipes["Pumpkin Seeds"] = recipes["Minerals"] = recipes["Bone Meal"] = recipes["Blaze Powder"] = recipes["Gold Nugget"]
recipes["Bread"] = recipes["Paper"]
recipes["Melon Block"] = recipes["Gold Ingot"]
recipes["Bucket"] = recipes["Flower Pot"] = recipes["Glass Bottle"]
--[[Craft]]--
function craftRecipe(recipe)
for k,v in pairs(recipe.map) do
turtle.select(k)
if v==1 then
turtle.select(4)
turtle.transferTo(k, 1)
elseif v==2 then
turtle.select(8)
turtle.transferTo(k, 1)
elseif v==3 then
turtle.select(12)
turtle.transferTo(k, 1)
elseif v==4 then
turtle.select(13)
turtle.transferTo(k, 1)
elseif v==5 then
turtle.select(14)
turtle.transferTo(k, 1)
elseif v==6 then
turtle.select(15)
turtle.transferTo(k, 1)
elseif v==7 then
turtle.select(16)
turtle.transferTo(k, 1)
end
end
turtle.select(1)
end
--[[Run Function]]--
craftRecipe(recipes["Torch"])
or the version of pastebin
http://pastebin.com/EpEPB8ps
Thank you for your attention and help.
Have a nice evening everybody!!!!