Posted 25 July 2013 - 06:06 PM
Hi! For practice, I am writing a GetFlint program. I know, there are plenty of them around, this is just made to test skills and to learn a bit more. Here's my current code:
The issue with this is: If I place gravel in the second slot of the turtle, it'll place the gravel in the chest that's on top of it, where only flint was supposed to go. How would I go about fixing this?
This part:
Any way to make it shorter and do that to all the slots easily and in a cleaner way?
I know there are more issues, but I'll edit them later on, gotta go to sleep now.
Thanks in advance for your help!
while true do
if turtle.detect() == true then
turtle.dig()
turtle.place()
elseif
turtle.place() == false then
turtle.dropUp()
turtle.select(2)
turtle.dropUp()
turtle.select(3)
turtle.dropUp()
turtle.select(4)
turtle.dropUp()
turtle.select(1)
print "No gravel detected, shutting down..."
sleep(3)
os.reboot()
end
end
The issue with this is: If I place gravel in the second slot of the turtle, it'll place the gravel in the chest that's on top of it, where only flint was supposed to go. How would I go about fixing this?
This part:
turtle.dropUp()
turtle.select(2)
turtle.place()
turtle.dropUp()
turtle.select(3)
turtle.dropUp()
turtle.select(4)
turtle.dropUp()
turtle.select(1)
Any way to make it shorter and do that to all the slots easily and in a cleaner way?
I know there are more issues, but I'll edit them later on, gotta go to sleep now.
Thanks in advance for your help!