I'm trying to make a mining turtle clear a Eleven by Eleven area but I can't figure out how to redo sections of code a number of time.
http://pastebin.com/np68sbbb
There's the pastebin of my code, what am I doing wrong here? Could someone please help me out here?
Could I please get help with "for i = X, X do"
Started by Avous, Nov 26 2012 07:57 AM
3 replies to this topic
#1
Posted 26 November 2012 - 07:57 AM
#2
Posted 26 November 2012 - 08:10 AM
You really aren't doing anything wrong (minus the "end" on the last line that shouldn't be there), except digging in a spiral pattern is much more difficult than if you were digging in a zig-zag pattern.
The "digIfDetect()" part is only so that it doesn't try to dig empty blocks.
local function digIfDetect() if turtle.detect() then turtle.dig() end end for i=1, 11 do for ii=1, 11 do digIfDetect() turtle.forward() end if i%2 == 0 then turtle.turnLeft() digIfDetect() turtle.forward() turtle.turnLeft() else turtle.turnRight() digIfDetect() turtle.forward() turtle.turnRight() end end
The "digIfDetect()" part is only so that it doesn't try to dig empty blocks.
#3
Posted 26 November 2012 - 08:18 AM
Thank you very much!
I'll edit it as per your suggestions and update this post with the details
I'll edit it as per your suggestions and update this post with the details
#4
Posted 26 November 2012 - 08:58 AM
Nevermind! i got it! thank you!
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











