Posted 30 June 2012 - 02:44 PM
Hey all another little tutorial to show how to set up the gps api. What you are going to need is at least 4 computers each with a modem and a disk drive. Now place 4 of the computers in the corners of a large square 50 x 50 I'm not sure how big it can be but 50 x 50 should work. I named my computers Host A through Host D. Ok now to set up the hosts. Attach a modem to the right side and a disk drive to the left. Insert a floppy disk in each then create a file on the floppy and name it startup. in each startup file put this code
The second line sets up the host. The x, y, and z are the hosts location. To get its location stand on the computer and press F3 use the x, y, and z that is displayed. Subtract 1 from y because you were standing on the computer.
When you have all this finished reboot the host and it should come up with
Position is X, Y, Z
Serving GPS Requests
Now every time you start Minecraft you GPS system is up and running. A boot disk was the simplest way to achieve this with out editing the main startup files.
Ok now to test it on a wireless turtle. Use the following code
if all the above was done correctly the turtle should be displaying its name(if you gave it one) and its x, y, and z location.
After much testing and hair pulling I Discovered that all the GPS Computers and Turtles have to be at the same height or y position to Communicate with each other.
rednet.open("right")
shell.run("gps", "host", x, y, z)
The first line opens the modem for use.The second line sets up the host. The x, y, and z are the hosts location. To get its location stand on the computer and press F3 use the x, y, and z that is displayed. Subtract 1 from y because you were standing on the computer.
When you have all this finished reboot the host and it should come up with
Position is X, Y, Z
Serving GPS Requests
Now every time you start Minecraft you GPS system is up and running. A boot disk was the simplest way to achieve this with out editing the main startup files.
Ok now to test it on a wireless turtle. Use the following code
term.clear()
term.setCursorPos(1, 1 )
rednet.open("right")
cx,cy,cz = gps.locate(10)
rednet.close("right")
print(os.getComputerLabel())
print("Current Position is")
print("X = ",cx)
print("Y = ",cy)
print("Z = ",cz)
if all the above was done correctly the turtle should be displaying its name(if you gave it one) and its x, y, and z location.
After much testing and hair pulling I Discovered that all the GPS Computers and Turtles have to be at the same height or y position to Communicate with each other.