Guest User

ComputerCraft Machines States

a guest
Sep 6th, 2012
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.34 KB | None | 0 0
  1. --CONFIG--
  2. side = "bottom"
  3. local OP = 0
  4.  
  5. --FUNCTIONS--
  6. function Clear()
  7. term.clear()
  8. term.setCursorPos(1, 1)
  9. end
  10.  
  11. function saveState2()
  12. file = fs.open("state", "w")
  13. file.writeLine((colors.test(rs.getBundledOutput(side), colors.white)))
  14. file.writeLine((colors.test(rs.getBundledOutput(side), colors.orange)))
  15. file.writeLine((colors.test(rs.getBundledOutput(side), colors.magenta)))
  16. file.writeLine((colors.test(rs.getBundledOutput(side), colors.lightBlue)))
  17. file.close()
  18. end
  19.  
  20. function loadState2()
  21. file = fs.open("state", "r")
  22. shell.run("redset", side, "white", file.readLine())
  23. shell.run("redset", side, "orange", file.readLine())
  24. shell.run("redset", side, "magenta", file.readLine())
  25. shell.run("redset", side, "lightBlue", file.readLine())
  26. file.close()
  27. end
  28.  
  29. function saveState()
  30. file = fs.open("state", "w")
  31.  
  32. end
  33.  
  34. --CODE--
  35. Clear()
  36. print("N1ghtK1n9's Computer")
  37. term.setCursorPos(1, 3)
  38. write"> "
  39. input = read()
  40. if input == "engines" then
  41. Clear()
  42. outE = rs.getBundledOutput(side, colors.white)
  43.     if outE == true then
  44.     print("Turning Engines Off.")
  45.     rs.setBundledOutput(side, colors.subtract(OP, colors.white))
  46.     elseif outE == false then
  47.     print("Turning Engines On")
  48.     rs.setBundeldOutput(side, colors.combine(OP, colors.white))
  49.     end
  50.    
  51. elseif input == ("refineries") then
  52. Clear()
  53. outR = rs.getBundledOutput(side, colors.orange)
  54.     if outR == true then
  55.     print("Turning Refineries Off")
  56.     rs.setBundeldOutput(side, colors.subtract(OP, colors.orange))
  57.     elseif outE == false then
  58.     print("Turning Engines On")
  59.     rs.setBundledOutput(side, colors.combine(OP, colors.orange))
  60.     end
  61. elseif input == "geothermal" then
  62. Clear()
  63. outG = rs.getBundledOutput(side, colors.magenta)
  64.     if outG == true then
  65.     print("Turning Geothermal Generators Off")
  66.     rs.setBundledOutput(side, colors.subtract(OP, colors.magenta))
  67.     elseif outG == false then
  68.     print("Turning Engines On")
  69.     rs.setBundledOutput(side, colors.combine(OP, colors.magenta))
  70.     end
  71.    
  72.  
  73. elseif input == "enginecoolant" then
  74. Clear()
  75. outEC = rs.getBundledOutput(side, colors.lightBlue)
  76.     if outEC == true then
  77.     print("Turning Engine Coolant Off")
  78.     rs.setBundledOutput(side,colors.subtract(OP, colors.lightBlue))
  79.     elseif outEC == false then
  80.     print("Turning Engine Coolant On")
  81.     rs.setBundeldedOutput(side, colors.combine(OP, colors.lightBlue))
  82.     end
  83. elseif input == "reboot" then  
  84. os.reboot()
  85. end
Advertisement
Add Comment
Please, Sign In to add comment