This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Shrogadunter's profile picture

Turtle block placement

Started by Shrogadunter, 10 January 2015 - 06:30 AM
Shrogadunter #1
Posted 10 January 2015 - 07:30 AM
This maybe something that's already been done, but I was hoping to find any trails leading to code written for turtles to go in a certain direction for a specific distance, place a block, turn and then repeat until it's placed 4 points. I feel like it could be used easily place a quarry out on the open water. Any idea on where to start with this? It's 2 am and my girl is waiting for me in bed so I may be the worst coder in the world right now.
Bomb Bloke #2
Posted 10 January 2015 - 07:54 AM
It's 2 am and my girl is waiting for me in bed so I may be the worst coder in the world right now.

"Coder" might not be the right word for it.

You're basically after knowledge of loops: http://lua-users.org/wiki/ControlStructureTutorial

Eg:

local distance = 10  -- Or whatever.

for a = 1, 4 do
	turtle.placeDown()
	for b = 1, distance do turtle.forward() end
	turtle.turnRight()
end
Edited on 10 January 2015 - 06:55 AM