Posted 02 August 2014 - 10:28 PM
forgot to paste the code inbetween the code markers most likely that one will get rejected thus writing a new post (please delete the old post)
So first off i'll start off by saying i'm quit new to coding as a whole thus most likely made thing allot more complicated then it should be.
I'm trying to make a turtle replant my farm. This farm is bigger then one stack of seeds can fill and it's worth mentioning that i'm still at CC 1.5. So in the end i made something that constantly checks if his slots are still filled and if not switches the slot + it walks a preset route.
Now somehow mid program the turtle stops walking forward in a for i = 1,18,1 do turtle.forward() end. Now i think i made somesort of basic mistake while creating this and it feels as if the rest of the program runs to fast without waiting for the other parts to finish.
i have tried adding in sleep(1) commands here and there to see if it would make a difference, but it seems it made it only a little better.
Any help in this would be greatly appreciated.
for the code
Sorry if it looks messy, but this is the best i could do for now.
So first off i'll start off by saying i'm quit new to coding as a whole thus most likely made thing allot more complicated then it should be.
I'm trying to make a turtle replant my farm. This farm is bigger then one stack of seeds can fill and it's worth mentioning that i'm still at CC 1.5. So in the end i made something that constantly checks if his slots are still filled and if not switches the slot + it walks a preset route.
Now somehow mid program the turtle stops walking forward in a for i = 1,18,1 do turtle.forward() end. Now i think i made somesort of basic mistake while creating this and it feels as if the rest of the program runs to fast without waiting for the other parts to finish.
i have tried adding in sleep(1) commands here and there to see if it would make a difference, but it seems it made it only a little better.
Any help in this would be greatly appreciated.
for the code
local function farmbot()
local function detectslot()
turtle.select(2)
x = 2
z = 3
while true do
if turtle.getItemCount(x) < 1 then
turtle.select(z)
x = x + 1
z = z + 1
else
break
end
end
end
--- ending detectslot
detectslot()
sleep(1)
for i = 1,6,1 do
turtle.forward()
turtle.placeDown()
detectslot()
sleep(1)
end
turtle.turnRight()
turtle.forward()
turtle.placeDown()
detectslot()
sleep(1)
turtle.turnRight()
detectslot()
sleep(1)
for i = 1,5,1 do
turtle.forward()
turtle.placeDown()
detectslot()
sleep(1)
end
turtle.turnLeft()
turtle.forward()
turtle.placeDown()
detectslot()
sleep(1)
turtle.turnLeft()
for i = 1,5,1 do
turtle.forward()
turtle.placeDown()
detectslot()
sleep(1)
end
turtle.up()
turtle.turnLeft()
for i = 1,2,1 do
turtle.forward()
end
turtle.turnRight()
end
------- ending farmbot
for r = 1,4,1 do
for i = 1,3,1 do
farmbot()
end
turtle.turnRight()
for i = 1,4,1 do
turtle.forward()
sleep(1)
end
turtle.turnRight()
for i = 1,18,1 do [color=#ff0000]<---- weirdly enough it stops mid way this line altho it keeps doing left right commands[/color]
turtle.forward()
sleep(1)
end
for i = 1,2,1 do
turtle.turnRight()
end
for i = 1,3,1 do
turtle.down()
end
end
Sorry if it looks messy, but this is the best i could do for now.
Edited on 02 August 2014 - 09:08 PM