Advertisement
Guest User

reaktor2

a guest
Nov 23rd, 2014
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.04 KB | None | 0 0
  1. bat=peripheral.wrap("top")
  2. mon=peripheral.wrap("bottom")
  3.  
  4. stanje=rs.getBundledOutput("left")
  5. if (stanje==1) then
  6.   reaktor="ukljucen"
  7. else
  8.   reaktor="Iskljucen"
  9. end
  10. maxBat=bat.getMaxEnergyStored("unkhnown")
  11. y=1
  12.  
  13. mon.clear()
  14. function nr()
  15.   y=y+1
  16.   mon.setCursorPos(1,y)
  17. end
  18. while true do
  19.   y=3
  20.   mon.setCursorPos(1,1)
  21.   mon.setTextColor(colors.yellow)
  22. --  mon.setBackgroundColor(colors.blue)
  23.   mon.write("Stanje Baterije ;")
  24. --  mon,setBackground(colors.black)
  25.   mon.setCursorPos(1,3)
  26.   struja=bat.getEnergyStored("unkhnown")
  27.   mon.write(struja)
  28.   proc=math.floor((struja/maxBat)*100)
  29.   mon.write("   "..proc.."%")
  30.   sleep(0.5)  
  31.     if proc <= 50 then
  32.       mon.clear()
  33.       rs.setBundledOutput("left",1)
  34.       reaktor="ukljucen"
  35.       boja=colors.green
  36.     else
  37.      if proc >=98 then
  38.       mon.clear()
  39.       rs.setBundledOutput("left",0)
  40.       reaktor="Iskljucen"
  41.       boja=colors.red    
  42.      end
  43.     end
  44.   nr()
  45.   mon.setTextColor(boja)
  46.   mon.write("reaktor je : "..reaktor)
  47.   mon.setTextColor(colors.white)
  48. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement