Advertisement
soulgriever

Install OC v1

Jun 23rd, 2020
2,409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.28 KB | None | 0 0
  1. function nameTurtle()
  2.  term.clear()
  3.  term.setCursorPos(2,2)
  4.  print("What shall we name the turtle?")
  5.  local input = read()
  6.  os.setComputerLabel(input)
  7.  term.clear()
  8.  term.setCursorPos(1,1)
  9.  print("We named the turtle:")
  10.  term.write(os.getComputerLabel())
  11.  sleep(5)
  12. end
  13.  
  14. function install()
  15.  shell.run("pastebin get 6dNgXmT5 OreQuarry")
  16.  shell.run("pastebin get 7arKuHCS gps-deploy")
  17.  fs.move("/disk/OreQuarry", "/OreQuarry")
  18.  fs.move("/disk/gps-deploy", "/gps-deploy")
  19.  term.clear()
  20.  term.setCursorPos(1,1)
  21.  print("Turtle:")
  22.  print(os.getComputerLabel())
  23.  print("Is now installed with OreQuarry and gps-deploy")
  24. end
  25.  
  26. if os.getComputerLabel() ~= nil then
  27.  install()
  28. end
  29.  
  30. if os.getComputerLabel() == nil then
  31.  term.clear()
  32.  term.setCursorPos(2,2)
  33.  print("You have not chosen a name for this")
  34.  term.setCursorPos(3,3)
  35.  term.write("turtle.")
  36.  term.setCursorPos(3,5)
  37.  print("Would you like to do so now?")
  38.  term.setCursorPos(13,7)
  39.  term.write("Y/N?")
  40.  term.setCursorPos(11,8)
  41.  local rep = 1
  42.  repeat
  43.   local event,key = os.pullEvent("key")
  44.   if key == keys.y then
  45.    rep = 0
  46.    nameTurtle()
  47.   end
  48.   if key == keys.n then
  49.    os.setComputerLabel(tostring(os.getComputerID()))
  50.    rep = 0
  51.    term.clear()
  52.    term.setCursorPos(1,1)
  53.    print("Turtle Label:")
  54.    term.write(os.getComputerLabel())
  55.    sleep(5)
  56.   end
  57.  until rep == 0
  58.  
  59.  install()
  60.  
  61. end
  62. shell.run("cd /")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement