Advertisement
Guest User

Untitled

a guest
Jan 21st, 2020
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.40 KB | None | 0 0
  1. -- this loads the varible
  2. local iConfig = nil
  3. local sName = "config"
  4. local sBundelSide = "back"
  5. local function save(sInput)
  6. local file = io.open(sName,"w")
  7. file:write(tostring(sInput))
  8. file:close()
  9. end
  10. local function AddOutput(sSide, ...)
  11. local c = colors.combine(rs.getBundledOutput(sSide), ...)
  12. rs.setBundledOutput(sSide, c)
  13. save(c)
  14. end
  15. local function RemoveOutput(sSide, ...)
  16. local c = colors.subtract(rs.getBundledOutput(sSide), ...)
  17. rs.setBundledOutput(sSide, c)
  18. save(c)
  19. end
  20.  
  21. if fs.exists(sName) then
  22. print("Loading config")
  23. file = io.open(sName,"r")
  24. iConfig = tonumber(file:read())
  25. print(iConfig)
  26. file:close()
  27. print("Config loaded")
  28. else
  29. print("No config")
  30. iConfig = 0
  31. end
  32. print(iConfig)
  33. rs.setBundledOutput(sBundelSide,iConfig) -- this sets it as the output
  34. sleep(1) -- gives time for output to change
  35. -- end
  36. local x1 = nil -- resets x1
  37. while x1 ~= "consol" do
  38. save(rs.getBundledOutput(sBundelSide)) -- saves eveery tiem you return to main menu
  39. term.clear()
  40. print("-------------------------------------------")
  41. print("----------------Main menu:-----------------")
  42. print("-------------------------------------------")
  43. print("Options:")
  44. print("-------------------------------------------")
  45. print("Querry")
  46. if rs.testBundledInput("back", colors.lime ) == true then
  47. print("Status: Online")
  48. else
  49. print("Status: Offline")
  50. end
  51. print("OilPump")
  52. if rs.testBundledInput("back", colors.pink ) == true then
  53. print("Status: Online")
  54. else
  55. print("Status: Offline")
  56. end
  57. print("Cooling")
  58. if rs.testBundledInput("back", colors.gray ) == true then
  59. print("Status: Online")
  60. else
  61. print("Status: Offline")
  62. end
  63. print("Security")
  64. if rs.testBundledInput("back", colors.lightGray ) == true then
  65. print("Status: Online")
  66. else
  67. print("Status: Offline")
  68. end
  69. print("MobFarm")
  70. if rs.testBundledInput("back", colors.cyan ) == true then
  71. print("Status: Online")
  72. else
  73. print("Status: Offline")
  74. end
  75. print("Consol")
  76. print("-------------------------------------------")
  77. write("Enter menu command: ")
  78. x1 = io.read()
  79. x2 = nil -- these reset the system
  80. x3 = nil
  81. x4 = nil
  82. x5 = nil
  83. x6 = nil
  84. if x1 == "querry" then
  85. while x2 ~= "back" do
  86. term.clear()
  87. print("-------------------------------------------")
  88. print("----------------Querry menu:---------------")
  89. print("-------------------------------------------")
  90. if rs.testBundledInput("back", colors.lime ) == true then
  91. print("Status: Online")
  92. else
  93. print("Status: Offline")
  94. end
  95. print("To turn Querry on, type on.")
  96. print("To turn Querry off, type off.")
  97. print("To get back to the main menu, type back.")
  98. print("-------------------------------------------")
  99. write("Enter querry command: ")
  100. x2 = io.read()
  101. if x2 == "on" then
  102. AddOutput("back", colors.white )
  103. term.clear()
  104. print("------------------------------------------")
  105. print("The querry is now on.")
  106. print("------------------------------------------")
  107. sleep(1)
  108. elseif x2 == "off" then
  109.  
  110. RemoveOutput("back", colors.white )
  111. print("------------------------------------------")
  112. print("The querry is now off.")
  113. print("------------------------------------------")
  114. sleep(1)
  115. end -- if x2 = on/off
  116. end -- while x2
  117. end -- if Querry
  118. if x1 == "oilpump" then
  119. while x3 ~= "back" do
  120. term.clear()
  121. print("-------------------------------------------")
  122. print("---------------Oilpump menu:---------------")
  123. print("-------------------------------------------")
  124. if rs.testBundledInput("back", colors.pink ) == true then
  125. print("Status: Online")
  126. else
  127. print("Status: Offline")
  128. end
  129. print("To turn on the oilpumps, type on.")
  130. print("To turn off the oilpumps, type off.")
  131. print("To get back to the main menu, type back.")
  132. print("-------------------------------------------")
  133. write("Enter oilpump command: ")
  134. x3 = io.read()
  135. if x3 == "on" then
  136. AddOutput("back", colors.orange )
  137. term.clear()
  138. print("------------------------------------------")
  139. print("The oilpumps are now on.")
  140. print("------------------------------------------")
  141. sleep(1)
  142. elseif x3 == "off" then
  143. RemoveOutput("back", colors.orange )
  144. term.clear()
  145. print("------------------------------------------")
  146. print("The oilpumps are now off.")
  147. print("------------------------------------------")
  148. sleep(1)
  149. end -- if x3 = on/off
  150. end -- while x3
  151. end -- if oilpumps
  152. if x1 == "cooling" then
  153. while x4 ~= "back" do
  154. term.clear()
  155. print("-------------------------------------------")
  156. print("---------------Cooling menu:---------------")
  157. print("-------------------------------------------")
  158. if rs.testBundledInput("back", colors.gray ) == true then
  159. print("Status: Online")
  160. else
  161. print("Status: Offline")
  162. end
  163. print("To turn on the Cooling, type on.")
  164. print("To turn off the Cooling, type off.")
  165. print("To get back to the main menu, type back.")
  166. print("-------------------------------------------")
  167. write("Enter Cooling command: ")
  168. x4 = io.read()
  169. if x4 == "on" then
  170. AddOutput("back", colors.magenta )
  171. term.clear()
  172. print("------------------------------------------")
  173. print("The cooling is now on.")
  174. print("------------------------------------------")
  175. sleep(1)
  176. elseif x4 == "off" then
  177. RemoveOutput("back", colors.magenta )
  178. term.clear()
  179. print("------------------------------------------")
  180. print("The Cooling is now off.")
  181. print("------------------------------------------")
  182. sleep(1)
  183. end -- if x4 = on/off
  184. end -- while x4
  185. end -- if Cooling
  186. if x1 == "security" then
  187. while x5 ~= "back" do
  188. term.clear()
  189. print("-------------------------------------------")
  190. print("---------------Security menu:--------------")
  191. print("-------------------------------------------")
  192. if rs.testBundledInput("back", colors.lightGray ) == true then
  193. print("Status: Online")
  194. else
  195. print("Status: Offline")
  196. end
  197. print("To turn security on, type on.")
  198. print("To turn security off, type off.")
  199. print("To get back to the main menu, type back.")
  200. print("-------------------------------------------")
  201. write("Enter security command: ")
  202. x5 = io.read()
  203. if x5 == "on" then
  204. AddOutput("back", colors.lightBlue )
  205. term.clear()
  206. print("------------------------------------------")
  207. print("The security is now on.")
  208. print("------------------------------------------")
  209. sleep(1)
  210. elseif x5 == "off" then
  211. RemoveOutput("back", colors.lightBlue )
  212. term.clear()
  213. print("------------------------------------------")
  214. print("The security is now off.")
  215. print("------------------------------------------")
  216. sleep(1)
  217. end -- if x5 = on/off
  218. end -- while x5
  219. end -- if security
  220. if x1 == "mobfarm" then
  221. while x6 ~= "back" do
  222. term.clear()
  223. print("-------------------------------------------")
  224. print("---------------MobFarm menu:---------------")
  225. print("-------------------------------------------")
  226. if rs.testBundledInput("back", colors.cyan ) == true then
  227. print("Status: Online")
  228. else
  229. print("Status: Offline")
  230. end
  231. print("To turn on the Mob farm, type on.")
  232. print("To turn off the Mob farm, type off.")
  233. print("To get back to the main menu, type back.")
  234. print("-------------------------------------------")
  235. write("Enter command: ")
  236. x6 = io.read()
  237. if x6 == "on" then
  238. AddOutput("back", colors.yellow )
  239. term.clear()
  240. print("------------------------------------------")
  241. print("The Mob farm is now on.")
  242. print("------------------------------------------")
  243. sleep(1)
  244. elseif x6 == "off" then
  245. RemoveOutput("back", colors.yellow )
  246. term.clear()
  247. print("------------------------------------------")
  248. print("The Mob farm is now off.")
  249. print("------------------------------------------")
  250. sleep(1)
  251. end -- if x6 = on/off
  252. end -- while x6
  253. end -- if modfarm
  254. end -- Main end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement