Posted 13 January 2013 - 12:28 AM
Hi I'm pretty new to this turtle programming but I got a little program I wanted to finish. Its basicly just gonna be for filling in large areas.
The code I got until now Is ok but it dont have a repeat of the turning, only way I have been able to fix it is to copy paste the turning over and over again. Pluss it only takes stuff out of the 1 spot which means I need to move stuff manually into spot 1. So I need help to put stuff into slot 1 or select other spots with stuff inn, and how to automate the turning on a repeat so it every other turn, turns in the oposite direction. Or else it will go in sircles.
Anyways here is the code:
The code I got until now Is ok but it dont have a repeat of the turning, only way I have been able to fix it is to copy paste the turning over and over again. Pluss it only takes stuff out of the 1 spot which means I need to move stuff manually into spot 1. So I need help to put stuff into slot 1 or select other spots with stuff inn, and how to automate the turning on a repeat so it every other turn, turns in the oposite direction. Or else it will go in sircles.
Anyways here is the code:
function place()
if turtle.detectDown() == false then
turtle.placeDown()
end
if turtle.detectDown() then
turtle.forward()
end
end
function turnright()
if turtle.detectDown() == false then
turtle.placeDown()
end
turtle.turnRight()
turtle.forward()
turtle.turnRight()
end
function turnleft()
if turtle.detectDown() == false then
turtle.placeDown()
end
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
--start
if turtle.detect() == false then
repeat
place()
until turtle.detect()
turnright()
end
if turtle.detect() == false then
repeat
place()
until turtle.detect()
turnleft()
end