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

Absolute Coords

Started by Zim, 27 February 2012 - 08:38 AM
Zim #1
Posted 27 February 2012 - 09:38 AM
I want to know the absolute x,y,z coords of a turtle

Some of the API's seem to have code that keeps track of a turtles coords with reference to its start position, but so that I can get turtles to work together on more complex jobs I need to know the absolute x,y,z within the world.
Advert #2
Posted 27 February 2012 - 12:53 PM
This is intentional; you can solve it by starting all the turtles at the same location, or next to each other (and adding/subtracting from x/y).
6677 #3
Posted 27 February 2012 - 01:07 PM
I want to know the absolute x,y,z coords of a turtle

Some of the API's seem to have code that keeps track of a turtles coords with reference to its start position, but so that I can get turtles to work together on more complex jobs I need to know the absolute x,y,z within the world.
What you need to do is manually input the starting position of the turtle. Hit f3 to find your co-ordinates and work the turtles out from there. Just take note that the y level shown with f3 is the y level of your head so a turtle on the floor will need 1 subtracting from that value. Then you can keep track of the turtles co-ordinates from there. It may require code modification but its the only working solution right now.
Liraal #4
Posted 27 February 2012 - 01:45 PM
Use the solution above coupled with my API and you get a reliable source of turtle position. You can even save it to a file.
Zim #5
Posted 27 February 2012 - 05:56 PM
Thats not really a solution, detecting the coords from an external gui function and then feeding them into a tracked variable. As elegant as a work around that is it doesn't solve a lot of problems where I need to know a terminal or turtle's location without telling it first.
Rick93NL #6
Posted 27 February 2012 - 08:38 PM
Always make your turtles in the same spot, and call it position 0, 0, 0. Then keep track of where your turtles are and save the positions in a file. During the boot of your turtles let them look in the file and get there position.

Other then having to make your turtles always at the same position it's a good solution :P/>/>. GL!
Liraal #7
Posted 27 February 2012 - 08:51 PM
Always make your turtles in the same spot, and call it position 0, 0, 0. Then keep track of where your turtles are and save the positions in a file. During the boot of your turtles let them look in the file and get there position.

Other then having to make your turtles always at the same position it's a good solution :P/>/>. GL!

Look 3 posts above… :)/>/>