Advertisement
Marlingaming

Test Chamber Manager V3

May 16th, 2022 (edited)
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. local test_id = "0"
  2. local test_state = -1
  3. local test_start = 0
  4. local test_end = 0
  5. local test_label = "1/1"
  6. local test_elements = {"Button Interaction"}
  7.  
  8.  
  9. function Loop()
  10. ChamberManager("on")
  11. while true do
  12. local event, a, b, c = os.pullEvent()
  13. if event == "rednet_message" then
  14.  
  15. elseif event == "key" then
  16.  
  17. else
  18. if redstone.getInput("bottom") == true then--test subject exits
  19. test_end = os.time()
  20. ChamberManager("reset")
  21. elseif redstone.getInput("left") == true then--test begins
  22. test_start = os.time()
  23. end
  24. end
  25. os.queueEvent("pass")
  26. end
  27. end
  28.  
  29. function ChamberManager(action)
  30. if action == "reset" then
  31. redstone.setOutput("right",true)
  32. os.sleep(3)
  33. redstone.setOutput("right",false)
  34. elseif action == "off" then
  35. redstone.setOutput("top",false)
  36. DisplayError_Monitor("chamber offline")
  37. elseif action == "on" then
  38. redstone.setOutput("top",true)
  39. DrawMonitor()
  40. end
  41. end
  42.  
  43. function DisplayError_Monitor(error)
  44. local monitor = peripheral.find("monitor_0")
  45. monitor.setBackgroundColor(colors.black)
  46. monitor.setTextColor(colors.yelloe)
  47. monitor.clear()
  48. monitor.setCursorPos(1,1)
  49. monitor.write("an Error has occured")
  50. monitor.setCursorPos(2,3)
  51. monitor.write(error)
  52. end
  53.  
  54. function DrawMonitor()
  55. local monitor = peripheral.find("monitor_0")
  56. monitor.setBackgroundColor(colors.white)
  57. monitor.clear()
  58. monitor.setCursorPos(2,2)
  59. monitor.setTextColor(colors.black)
  60. monitor.write("Aperture Science")
  61. monitor.setCursorPos(2,3)
  62. monitor.write(test_label)
  63. monitor.setCursorPos(2,9)
  64. monitor.write("testing elements")
  65. for i = 1, #test_elements do
  66. monitor.setCursorPos(2,9 + i)
  67. monitor.write(test_elements[i])
  68. end
  69. end
  70.  
  71. Loop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement