Advertisement
thatparadox

WaypointCom

Aug 29th, 2013
507
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.04 KB | None | 0 0
  1. for a,b in pairs(rs.getSides()) do
  2.   if peripheral.getType(b) == 'modem' then
  3.    rednet.open(b)
  4.    break
  5.   end
  6. end
  7.  
  8. while true do
  9.   term.clear()
  10.   term.setCursorPos(1,1)
  11.   write("Press Enter key when ready to proceed. You'll have 1 minute to enter coordinates before the system times out.")
  12.   dud = read()
  13.   rednet.broadcast("waypoint")
  14.   id, confirm = rednet.receive(1)
  15.   if confirm == "ready" then
  16.     write("Enter X coordinate: ")
  17.     x = read()
  18.     write("Enter Y coordinate: ")
  19.     y = read()
  20.     write("Enter Z coordinate: ")
  21.     z = read()
  22.     term.clear()
  23.     term.setCursorPos(1,1)
  24.     rednet.send(id, x)
  25.     sleep(.1)
  26.     rednet.send(id, y)
  27.     sleep(.1)
  28.     rednet.send(id, z)
  29.     id, confirm = rednet.receive()
  30.     if confirm == "complete" then
  31.      print("Coordinates sent")
  32.      sleep(3)
  33.     else
  34.      print("No response from pilot. Coordinates not sent.")
  35.      os.sleep(3)
  36.     end
  37.   else
  38.     term.clear()
  39.     term.setCursorPos(1,1)
  40.     print("No responce from pilot. Ship out of range")
  41.     os.sleep(3)
  42.   end
  43. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement