This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Bonedeadskull's profile picture

[HELP] Crafty Turtle

Started by Bonedeadskull, 19 November 2012 - 05:49 AM
Bonedeadskull #1
Posted 19 November 2012 - 06:49 AM
I'm just trying to learn crafty turtles since I don't see to many tutorials on them so if you could tell me one of them that would be awesome but what is the error in this program it will always return false where slot 1 and 5 are planks and it should make sticks.


map = {
[1] = true, [2] = false, [3] = false, [4] = false,
[5] = true, [6] = true, [7] = false, [8] = false,
[9] = false, [10]= true, [11]= false, [12] = false,
[13] = false, [14] = false, [15] = false, [16] = false
}
if map == true then
turtle.craft(1,5)
turtle.select(1)
turtle.dropDown()
else
print ("Please clear out the turtle inventory.")
end
remiX #2
Posted 19 November 2012 - 06:58 AM
I've never used these turtles before but to check a value of something in a key.

map = {
[1] = true, [2] = false, [3] = false, [4] = false,
[5] = true, [6] = true, [7] = false, [8] = false,
[9] = false, [10]= true, [11]= false, [12] = false,
[13] = false, [14] = false, [15] = false, [16] = false
}

if map[1] then
-- if the first key of the map table is true
else
-- if false
end

To loop through all of them

for i = 1, #map do
if map[i] then
-- if key map[i] is true then ...
else
-- if key map[i] is false then ...
end
Orwell #3
Posted 19 November 2012 - 08:01 AM
I'm afraid it doesn't work like that… You just need to have the recipe in your inventory like you would have it on a crafting table (ignore rightmost column and lower row) and make a call to turtle.craft without parameters:

local success = turtle.craft()
Lyqyd #4
Posted 19 November 2012 - 06:30 PM
I'm afraid it doesn't work like that… You just need to have the recipe in your inventory like you would have it on a crafting table (ignore rightmost column and lower row) and make a call to turtle.craft without parameters:

local success = turtle.craft()

This is not quite correct either. I believe the crafting recipe can occupy any of the four 3x3 subsets of the grid, but the crafting recipe must be the only contents of the turtle's inventory.