This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Telokis's profile picture

[Function] Move a turtle to a defined position

Started by Telokis, 04 April 2013 - 12:27 PM
Telokis #1
Posted 04 April 2013 - 02:27 PM
Hello everybody !

I have made a little function for a programe and I think it should be a good idea to share it.
Here is the description in the file:

Spoiler

-- goToPos Function. --
-- By Ninetainedo -- NoFake Dev Team --
-- Moves the turtle to xTmp, yTmp, zTmp considerating it is on 0, 0, 0. (Also turns the turtle to sideTmp considerating it is currently facing 0). --
-- Example :
--
-- .....
-- ...T.
-- .....
-- .D...
--
-- On this draw (Top view), the Turtle is the 'T', the destination is the 'D' and the turtle is facing on right (1)
-- I have to do goToPos(-2, -2, 0, -1, "szyx")
-- The last parameter represents the order the turtle has to move. In this case, it will move in this order : side, z, y, x
--
-- Axis are defined with turtle facing 0 :
-- x is forward
-- y is right
-- z is up
--

http://pastebin.com/msnX5jFP

An image example :
Spoiler

To move the turtle to the stone block, I just have to do goToPos(-2, -2, -1, -1, "szyx") !

Hope it will be usefull !
sinkir #2
Posted 14 April 2013 - 12:49 AM
perfect, thank you, :rolleyes:/>