Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function forward(int)
- for c = 1, int do
- turtle.forward()
- end
- end
- local bSapling --boolean on whether there are saplings
- local iWood --total wood collected
- local back = false
- local sizeRow = 11
- local numRow = 6
- if turtle.getItemCount(2)==0 then
- bSapling = false
- else
- bSapling = true
- end
- while true do
- back = false
- if not bSapling then
- print("Need more saplings")
- while turtle.getItemCount(2)==0 do
- os.sleep(4)
- end
- print("Thanks!")
- end
- bSapling = true
- turtle.forward()
- turtle.turnLeft()
- for r=1,numRow do
- for i=1, sizeRow do
- while turtle.compare() do
- turtle.dig()
- turtle.digUp()
- turtle.turnLeft()
- turtle.dig()
- turtle.turnRight()
- turtle.up()
- end
- turtle.turnRight()
- while turtle.down() do
- turtle.dig()
- end
- turtle.turnLeft()
- turtle.select(2)
- if bSapling and turtle.getItemCount(2) > 0 then
- turtle.place()
- end
- if turtle.getItemCount(2)==0 then
- bSapling = false
- end
- turtle.select(1)
- turtle.turnRight()
- turtle.forward()
- turtle.turnLeft()
- end
- print("End of row"..tostring(r))
- if not (r==6) then
- if back then
- print("Just came from back")
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- back = false
- else
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- back = true
- print("Just came from front")
- end
- end
- end
- turtle.turnRight()
- turtle.turnRight()
- forward(8)
- turtle.turnLeft()
- if bSapling then
- if turtle.getItemCount(3) > 0 then
- for i = 3,9 do
- if turtle.getItemCount(i) >0 then
- turtle.select(i)
- turtle.drop()
- end
- end
- turtle.select(1)
- end
- else
- if turtle.getItemCount(2) > 0 then
- for i = 2,9 do
- if turtle.getItemCount(i) >0 then
- turtle.select(i)
- turtle.drop()
- end
- end
- turtle.select(1)
- end
- end
- turtle.turnRight()
- turtle.turnRight()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement