1 posts
Posted 24 October 2012 - 05:06 PM
1- is there any way to make the turtle place blocks?
2- if there is how can i fill in a large floor with wood?
536 posts
Posted 24 October 2012 - 05:18 PM
1:
http://computercraft...itle=Turtle_api2:
local left = true
for y=1,maxy do
local x = 0
while x <= maxx do
while turtle.detect() do turtle.dig() sleep(0) end
turtle.place()
turtle.forwards()
end
if left then
left = false
turtle.turnLeft()
while turtle.detect() do turtle.dig() sleep(0) end
if not turtle.detect() then turtle.forwards() end
turtle.turnLeft()
else
left = true
turtle.turnRight()
while turtle.detect() do turtle.dig() sleep(0) end
if not turtle.detect() then turtle.forwards() end
turtle.turnRight()
end
end
^^^Untested^^^
You really should look around the forums however, this is both in the wrong place and the information you asked for is almost certainly in the forums somewhere.
136 posts
Posted 24 October 2012 - 05:22 PM
Should put things like this in the "Ask a Pro" board
2005 posts
Posted 24 October 2012 - 08:31 PM
No, this is more "read the
API description and the forum rules first." Ask a pro is for after you've done both of those.
248 posts
Posted 24 October 2012 - 08:39 PM
Guys, calm down and don't rage.
And broken, read the rules before posting a new thread, and do some research before too
2005 posts
Posted 25 October 2012 - 12:24 AM
Oh, com'on, you've seen us rage and this is not it. We can be really bad when we get mad.
22 posts
Posted 25 October 2012 - 09:22 PM
1:
http://computercraft...itle=Turtle_api2:
local left = true
for y=1,maxy do
local x = 0
while x <= maxx do
while turtle.detect() do turtle.dig() sleep(0) end
turtle.place()
turtle.forwards()
end
if left then
left = false
turtle.turnLeft()
while turtle.detect() do turtle.dig() sleep(0) end
if not turtle.detect() then turtle.forwards() end
turtle.turnLeft()
else
left = true
turtle.turnRight()
while turtle.detect() do turtle.dig() sleep(0) end
if not turtle.detect() then turtle.forwards() end
turtle.turnRight()
end
end
^^^Untested^^^
You really should look around the forums however, this is both in the wrong place and the information you asked for is almost certainly in the forums somewhere.
I might be stupid, or blind, but your while seems to be an infinite loop.
For that kind of loops, you usually go for a FOR loop, as you don't have to remember to increment the variable, even more with lua not supporting the "x+=1"
Well, at least the guy asked, even if he would have had his answers in the tutorial of the wiki.
2005 posts
Posted 26 October 2012 - 02:23 AM
See, much more rage-like.
536 posts
Posted 27 October 2012 - 09:53 AM
woops, forgot x = x + 1
and using a while loop at that point worked just as well and made it a little bit simpler, if I was writing that in Notepad I probably would have used a for loop but I was sort of just writing it simply as an example of what could be done in the post box…