Advertisement
LDDestroier

Quick GPS Startup

Jun 23rd, 2015
391
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.84 KB | None | 0 0
  1. -- pastebin run 8fKCR6Eh
  2.  
  3. if not fs.exists("/startup") then
  4.     term.clear()
  5.     term.setCursorPos(1,2)
  6.     print("No startup found.")
  7.     print("Checking for existing GPS server...")
  8.     supX, supY, supZ = gps.locate(1)
  9.     if supX == nil then
  10.         print("Enter X:")
  11.         write(">")
  12.         repeat
  13.             newX = tonumber(read())
  14.         until newX ~= nil
  15.         print("Enter Y:")
  16.         write(">")
  17.         repeat
  18.             newY = tonumber(read())
  19.         until newY ~= nil
  20.         print("Enter Z:")
  21.         write(">")
  22.         repeat
  23.             newZ = tonumber(read())
  24.         until newZ ~= nil
  25.     else
  26.         print("Oh good, one was found.")
  27.         newX = supX
  28.         newY = supY
  29.         newZ = supZ
  30.     end
  31.     print("Setting up GPS server...")
  32.     file = fs.open("/startup", "w")
  33.     file.writeLine("shell.run('gps host " .. newX .. " " .. newY .. " " .. newZ .. "')")
  34.     file.close()
  35.     os.reboot()
  36. else
  37.     print("Startup already exists. Cancel.")
  38. end
  39. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement