Advertisement
CaptainSpaceCat

Leader

May 22nd, 2015
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.59 KB | None | 0 0
  1. tArgs = {...}
  2. rednet.open("back")
  3.  
  4. id = tArgs[1]
  5. while true do
  6.   if gps.locate() then
  7.     location = {gps.locate()}
  8.     location[1] = math.floor(location[1])
  9.     location[2] = math.floor(location[2])
  10.     location[3] = math.floor(location[3])
  11.   elseif throwError then
  12.     print("ALERT: GPS tower out of range. Turtle will travel to last known location, at X: " .. x .. ", Y: " .. y .. ", Z: " .. z)
  13.   end
  14.   if gps.locate() then
  15.     throwError = true
  16.   else
  17.     throwError = false
  18.   end
  19.   rednet.send(tonumber(id), location)
  20.   --print(location[1], location[2], location[3])
  21.   sleep(.01)
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement