local args = { ... }
if #args >= 1 then
local slot = tonumber(args[1])
if slot and slot >= 1 and slot <= 16 then
turtle.select(slot)
end
end
while true do
if not turtle.place() then
turtle.suckUp()
break
end
if not turtle.dig() then
break
end
end
This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
Editing Sethblings Flintify
Started by awesomness1290, 19 September 2014 - 12:41 AMPosted 19 September 2014 - 02:41 AM
im trying to put sethblings flintify program into my world but I don't want manually put gravel into the turtle. Heres my code, I don't know how to add the code in a box:
Edited on 01 February 2015 - 09:06 PM
Posted 19 September 2014 - 03:54 AM
put [code] and [/code] tags around the code.
local args = { ... }
if #args >= 1 then
local slot = tonumber(args[1])
if slot and slot >= 1 and slot <= 16 then
turtle.select(slot)
end
end
while true do
if not turtle.place() then
turtle.suckUp()
break
end
if not turtle.dig() then
break
end
end
Edited on 19 September 2014 - 01:55 AM
Posted 19 September 2014 - 04:52 AM
ok thanks but can you help with my code problems?
Posted 19 September 2014 - 06:42 AM
You're on the right track - I see you've added to the original, beats me how he managed to create a half-hour video around it - but you're still breaking out of the while loop whenever the turtle fails to dig or place a block.
So I assume your problem is that the turtle stops whenever it runs out of gravel. If it's not, please be specific as to what your issue is.
So I assume your problem is that the turtle stops whenever it runs out of gravel. If it's not, please be specific as to what your issue is.
Posted 20 September 2014 - 01:54 AM
what the turtle is doing is pretty much just taking gravel then stopping. that's all
Posted 20 September 2014 - 02:45 AM
Ok, so… given that breaking out of your while loop would cause that, have you tried not breaking out of the while loop…?
That is to say: Delete the lines that say "break".
That is to say: Delete the lines that say "break".
Posted 20 September 2014 - 04:25 AM
it works but now it doesn't pull items from the chest
Posted 20 September 2014 - 04:31 AM
I'm guessing, because you haven't specified, but did you perhaps put the chest under the turtle instead of on top of it? If so, you'd want to use turtle.suckDown() instead.
Posted 20 September 2014 - 04:45 AM
I have a me interface on top and I changed the code so instead of the turtle.suckUp() under "if not turtle.place() then" to under the "end" under "if not turtle.dig() then" if that made sense, but I only want 1 stack at all times and it puts as many as possible.
Edited on 20 September 2014 - 02:48 AM
Posted 20 September 2014 - 05:28 AM
I have a hunch that if you put that line back where it was things'll work just fine. The turtle will place blocks until it can't any more, than once it runs out, draw a stack from your interface.
You could rig it to try and keep exactly 64 items at all times, but that's added complexity for absolutely no gain. All it needs is "more than none".
You could rig it to try and keep exactly 64 items at all times, but that's added complexity for absolutely no gain. All it needs is "more than none".