Advertisement
Guest User

startup

a guest
Sep 22nd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.46 KB | None | 0 0
  1. sg = peripheral.find("stargate")
  2. if fs.exists("saves") then
  3.  
  4. else
  5. fs.makeDir("saves")
  6. end
  7. term.clear()
  8. while true do
  9. term.setCursorPos(0,0)
  10. print("welcome to Stargate Commander ")
  11. print("your address is",sg.localAddress())
  12. print("and you have",sg.energyAvailable(),"SU left in your Stargate")
  13. print("type in command here")
  14. print("type help for a list of commands")
  15. input = read()
  16. if input == "Iris" then
  17. if sg.irisState() == "Open" then
  18. sg.closeIris()
  19. else
  20. sg.openIris()
  21. end
  22. end
  23. if input == "help" then
  24. term.clear()
  25. print("Iris -- toggles the Iris")
  26. print(" -- Any unkown command will be dialed in so to dial just type in the gate address")
  27. print("Term --Terminates Connection to other gate")
  28. print("Exit --exits program")
  29. print("save (1-5) --Saves the Address your currently connected to")
  30. print("load (1-5) --loads a save")
  31. end
  32.  
  33.  
  34. sg.dial(input)
  35.  
  36. if input == "Exit" then
  37. exit()
  38. end
  39. if input == "Term" then
  40. sg.disconnect()
  41. end
  42. if input == "save 1" then save = sg.remoteAddress()
  43. end
  44. if input == "load 1" then
  45. sg.dial(save)
  46. end
  47. if input == "save 2" then save2 = sg.remoteAddress() end
  48. if input == "save 3" then save3 = sg.remoteAddress() end
  49. if input == "save 4" then save4 = sg.remoteAddress() end
  50. if input == "save 5" then save5 = sg.remoteAddress() end
  51. if input == "load 2" then sg.dial(save2) end
  52. if input == "load 3" then sg.dial(save3) end
  53. if input == "load 4" then sg.dial(save4) end
  54. if input == "load 5" then sg.dial(save5) end
  55. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement