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

Getting a turtles current coordinates?

Started by Avous, 26 January 2013 - 08:41 PM
Avous #1
Posted 26 January 2013 - 09:41 PM
Is there a way to make a turtle figure out its own current coordinates? I need to copy it a few variables to get it to move into a correct position. I can't figure out GPS or if that would do it.
Luanub #2
Posted 26 January 2013 - 10:00 PM
You just need to manually set it's starting location, then make your own movement functions. You will want to use 3 different variables, one for x axis, one for y axis, and one for the direction its facing(you will also want these to be persistant vars so that when the turtle reboots it knows where it is). Then in you're movement functions depending of the face either add or subtract to the x/y axis.

I guess you will also want to add a 4th for the height the turtle is at, in case it needs to move up or down to get to the desired coordinates.
Avous #3
Posted 26 January 2013 - 10:02 PM
snip

darn i was hoping there was a way to detect it.
Luanub #4
Posted 26 January 2013 - 10:36 PM
If you use gps there is, but even then its best to use a combination of gps and the method I mentioned above to reduce rednet traffic. The gps system is not to difficult to setup and use. What issues are you having with it?
Avous #5
Posted 27 January 2013 - 07:06 AM
If you use gps there is, but even then its best to use a combination of gps and the method I mentioned above to reduce rednet traffic. The gps system is not to difficult to setup and use. What issues are you having with it?

I need it to pull its coordinates and move back there where ever the program is run, in this case, a Quarry. Wherever it is placed and ran it needs to pull its coordinates to move back to its starting position to deposit items so i can use user defined variables. but I'd like to keep it down to a few simple questions, (Max Layer Level?, Is ender chest mod installed?, Should I skip stone/dirt/gravel?) and then off it goes.
Avous #6
Posted 27 January 2013 - 10:49 AM
If anyone has any ideas I still desperately need em.
Luanub #7
Posted 27 January 2013 - 11:00 AM
Read this hopefully it will help you http://www.computercraft.info/forums2/index.php?/topic/3088-how-to-guide-gps-global-position-system/
Avous #8
Posted 27 January 2013 - 11:53 AM
Darn, is that the only way? guess I'll have to use a user defined input.