This has a decent amount of error checking (blocked path, no fuel, out of blocks). If turtle's don't need fuel on your server the script should still work OK in CC 1.41. If your server is still 3.1.2, you might need to remove the function about refueling. There is no turtle.digBehind() so while yes, it is possible, it would require your turtle to do a complete rotation to check/dig the block behind then return to the starting direction. The other option is to go forwards and dig the area before starting to place blocks, but this would take up twice as much fuel. If you want to add this, it's up to you.
--the turtle places blocks for 'height' blocks, then turns around and repeats until it has placed 'width' rows
local width = 40
local height = 24
function back()
if not turtle.back() then
print("Something's in the way!")
return false
end
return true
end
function refuel(needed)
while turtle.getFuelLevel() < needed do
selected = 0
while(turtle.refuel(1) == false) do
selected = selected + 1
if selected == 17 then
print("Out of fuel!")
return false
end
turtle.select(selected)
end
end
return true
end
function place()
selected = 0
while(turtle.place() == false) do
selected = selected + 1
if selected == 17 then
print("Out of blocks or block already placed!")
return false
end
turtle.select(selected)
end
return true
end
for w = 1, width do
if not refuel(height + 2) then
return
end
for h = 2, height do
if not (place() and back()) then
return
end
end
if not place() then
return
end
if w % 2 == 0 then
turtle.turnRight()
else
turtle.turnLeft()
end
if not back() then
return
end
if w % 2 == 0 then
turtle.turnRight()
else
turtle.turnLeft()
end
if not (back() and back()) then
return
end
end
print("Job finished successfully")
Edit: Alternately, you could modify this script to make the turtle go forwards and dig/place blocks *under* it..but now that I've posted it I'm not going to do it unless necessary