4 posts
Posted 11 April 2013 - 05:35 PM
Ok here's an easy question I was wondering about
Can you do turtle.turnRights(2) instead of writing turtle.turnRight() twice ? because When I did it, the turtle only turn right once.
1619 posts
Posted 11 April 2013 - 05:48 PM
No, but you can write a function to do it for you.
function right(times)
for i = 1,times do
turtle.turnRight()
end
end
4 posts
Posted 11 April 2013 - 05:51 PM
No, but you can write a function to do it for you.
function right(times)
for i = 1,times do
turtle.turnRight()
end
end
Alright thank you
2217 posts
Location
3232235883
Posted 12 April 2013 - 08:08 AM
shorter version:
shell.run("turn","right","2")
1619 posts
Posted 12 April 2013 - 08:13 AM
shorter version:
shell.run("turn","right","2")
Noes! Everything must be functions!
2217 posts
Location
3232235883
Posted 12 April 2013 - 08:15 AM
function right(times)
shell.run("turn","right",tostring(times))
end
that better?
might aswell just run that single line instead of calling a function every time .-.
1852 posts
Location
Sweden
Posted 12 April 2013 - 09:04 AM
I gotta agree with Dlcruz129 on this one.. It's not as good to use shell.run
since you can customize much more in functions..
function right(times)
for i = 1, times do
turtle.turnRight()
end
end
--Then you just call it like this
right(2)