Advertisement
Guest User

Go

a guest
May 22nd, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.54 KB | None | 0 0
  1. print("Go...")
  2.  
  3.  
  4. function drawMon()
  5.  
  6.   mon.setBackgroundColor(colors.black)
  7.   mon.clear()
  8.  
  9.   mon.setCursorPos(2,2)
  10.   if g.getActive() == true then
  11.     mon.setBackgroundColor(colors.lime)
  12.     mon.write("ON ")
  13.   else
  14.     mon.setBackgroundColor(colors.red)
  15.     mon.write("OFF")
  16.   end
  17.  
  18.   for i = 1,10 do
  19.   mon.setBackgroundColor(colors.yellow)
  20.   mon.setCursorPos(6,i+1)
  21.   mon.write("   ")
  22.   mon.setBackgroundColor(colors.black)
  23.   end
  24.  
  25.   eS = g.getEnergyStored()
  26.   eSt = g.getEnergyProducedLastTick()
  27.   cT = g.getCasingTemperature()
  28.   mon.setCursorPos(10,2)
  29.   mon.write("Energy: "..eS)
  30.   mon.setCursorPos(10,3)
  31.   mon.write("Energy/T: "..eSt)
  32.   mon.setCursorPos(10,4)
  33.   mon.write("Casingtemp.: "..cT)
  34.  
  35.   cfr = g.getControlRodLevel(0)
  36.   mon.setCursorPos(6,(cfr+10)/10)
  37.   mon.setBackgroundColor(colors.red)
  38.   mon.write("   ")
  39.   mon.setBackgroundColor(colors.black)
  40.   mon.setCursorPos(10,5)
  41.   mon.write("Fuel-Rod: "..cfr.."%")
  42. end
  43.  
  44. drawMon()
  45.  
  46. while true do
  47.   timer = os.startTimer(1)
  48.   local event,side,x,y = os.pullEvent()
  49.   if event == "timer" then
  50.     drawMon()
  51.   elseif event == "monitor_touch" then
  52.     if x > 1 and x < 5 and y == 2 then
  53.       if g.getActive() == true then
  54.         g.setActive(false)
  55.         drawMon()
  56.       else
  57.         g.setActive(true)
  58.         drawMon()
  59.       end
  60.     elseif x > 5 and x < 9 and y > 1 and y < 12 then
  61.       crs = (y-1)*10
  62.       g.setAllControlRodLevels(crs)
  63.       drawMon()
  64.     end
  65.   elseif event == "key" then
  66.     print("Broke Loop Through Button")
  67.     break
  68.   end
  69.  
  70. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement