Advertisement
TehChikenHater

cReactOS

Jul 22nd, 2014
372
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. local reactor1 = peripheral.wrap("BigReactors-Reactor_3")
  2. local reactor2 = peripheral.wrap("BigReactors-Reactor_4")
  3.  
  4. local args = {...}
  5.  
  6. if (#args == 0) then
  7. print("Usage: <command> [arguments]")
  8. return
  9. end
  10.  
  11. function terminate()
  12. return
  13. end
  14.  
  15. if (#args ~= 0) then
  16. local canContinue = true
  17. for i = 1, #args do
  18. if (args[i] == nil) then
  19. canContinue = false
  20. end
  21. end
  22. if (canContinue) then
  23. term.clear()
  24. term.setCursorPos(1, 1)
  25. if (args[1]:lower() == "activate") then
  26. if (#args == 2) then
  27. if (args[2] == "1") then
  28. print("Attempting to activate Reactor [1]")
  29. reactor1.setActive(true)
  30. sleep(0.5)
  31. if (reactor1.getActive()) then
  32. print("Reactor [1] has been activated")
  33. else
  34. print("Reactor [1] was unable to be activated")
  35. end
  36. elseif (args[2] == "2") then
  37. print("Attempting to activate Reactor [2]")
  38. reactor2.setActive(true)
  39. sleep(0.5)
  40. if (reactor2.getActive()) then
  41. print("Reactor [2] has been activated")
  42. else
  43. print("Reactor [2] was unable to be activated")
  44. end
  45. else
  46. print("Reactor ID too high")
  47. terminate()
  48. end
  49. end
  50. elseif (args[1]:lower() == "deactivate") then
  51. if (#args == 2) then
  52. if (args[2] == "1") then
  53. print("Attempting to deactivate Reactor [1]")
  54. reactor1.setActive(false)
  55. sleep(0.5)
  56. if (not reactor1.getActive()) then
  57. print("Reactor [1] has been deactivated")
  58. else
  59. print("Reactor [1] was unable to be deactivated")
  60. end
  61. elseif (args[2] == "2") then
  62. print("Attempting to deactivate Reactor [2]")
  63. reactor2.setActive(false)
  64. sleep(0.5)
  65. if (not reactor2.getActive()) then
  66. print("Reactor [2] has been deactivated")
  67. else
  68. print("Reactor [2] was unable to be deactivated")
  69. end
  70. else
  71. print("Reactor ID too high")
  72. terminate()
  73. end
  74. end
  75. else
  76. print("This command does not exist: \""..args[1].."\"")
  77. end
  78. else
  79. print("A blank or nil argument was supplied")
  80. terminate()
  81. end
  82. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement