Jako81624

Reactor

Jul 22nd, 2014
1,977
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. mon = peripheral.wrap("right")
  2. reactor = peripheral.wrap("left")
  3.  
  4. mon.setBackgroundColor(colors.blue)
  5.  
  6. while true do
  7.   mon.clear()
  8.   mon.setTextScale(1.5)
  9.   mon.setCursorPos(1,2)
  10.   mon.setTextColor(colors.white)
  11.   mon.write("ReactorOS 1.0")
  12.   mon.setCursorPos(1,4)
  13.   mon.write("1: Reactor On")
  14.   mon.setCursorPos(1,6)
  15.   mon.write("2: Reactor Off")
  16.   mon.setCursorPos(1,8)
  17.   mon.write("3: Check Temperature")
  18.   event, side, x, y = os.pullEvent("monitor_touch")
  19.   if x > 0 and x < 12 and y == 4 then
  20.     print("Reactor On")
  21.     mon.clear()
  22.     reactor.setActive(true)
  23.     mon.setTextScale(2)
  24.     mon.setCursorPos(1,1)
  25.     mon.setTextColor(colors.red)
  26.     mon.write("Reactor Engaged")
  27.     sleep(5)
  28.    
  29.   else if x > 0 and x < 13 and y == 6 then
  30.     print("Reactor Off")
  31.     mon.clear()
  32.     reactor.setActive(false)
  33.     mon.setTextScale(2)
  34.     mon.setCursorPos(1,1)
  35.     mon.setTextColor(colors.red)
  36.     mon.write("Reactor Disengaged")
  37.     sleep(5)
  38.  
  39.   else if x > 0 and x < 19 and y == 8 then
  40.     print("Temperature Read")
  41.     mon.clear()
  42.     mon.setTextScale(2)
  43.     mon.setCursorPos(1,1)
  44.     mon.setTextColor(colors.red)
  45.     mon.write("Temperature:")
  46.     mon.setCursorPos(1,4)
  47.     temp = reactor.getFuelTemperature()
  48.     print(temp , " C")
  49.     mon.write(temp)
  50.     mon.setCursorPos(1,5)
  51.     mon.write("Degrees C")
  52.     sleep(5)
  53.   end  
  54. end
  55. end
  56. end
Advertisement
Add Comment
Please, Sign In to add comment