Posted 02 December 2013 - 08:03 AM
I have downloaded a program for my mining turtle, it works great but every time it finishes, it goes back to its starting point, forcing me to break it and place it in the next spot or mess with raw commands.
That pushed me into making a program I call "next", and you guessed it, it moved the turtle to the next spot.
I'm not satisfied with it, because I have to run it a few times to move more than one spot, so I digged into tArgs and read about it, and still am confused.
————————————————————————————————————————————————————————————————-
I want my program to be able to read how much times to run (i.e "next 3" to loop 3 times)
That's what I got so far, I know its messy and bad, and it doesnt even work. :/ Not even talking about efficiency.
Can someone help me? I'm really confused :/
That pushed me into making a program I call "next", and you guessed it, it moved the turtle to the next spot.
I'm not satisfied with it, because I have to run it a few times to move more than one spot, so I digged into tArgs and read about it, and still am confused.
————————————————————————————————————————————————————————————————-
I want my program to be able to read how much times to run (i.e "next 3" to loop 3 times)
That's what I got so far, I know its messy and bad, and it doesnt even work. :/ Not even talking about efficiency.
local tArgs = {...}
if tArgs == 0 then
tArgs = 1
end
function next(x)
for times = 1, x do
turtle.turnRight()
for i = 1, 3 do
if turtle.forward() == false then
turtle.dig()
turtle.forward()
end
end
turtle.turnLeft()
end
end
next(tArgs)
Can someone help me? I'm really confused :/