SHARE
TWEET

afichage stockage energy reactor

pitrey Nov 9th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. modemC = peripheral.wrap('back') --cable
  2. --modemW = peripheral.wrap('bottom')--wifi
  3.  
  4.  
  5. rednet.open('back')
  6. --rednet.open('bottom')
  7. --modemW.open(5)
  8.  
  9.  
  10. RFn1 = 0
  11. RFn2 = 0
  12.  
  13. moni = peripheral.wrap("top")
  14. moni.setBackgroundColor(colors.black)
  15. moni.setTextScale(2)
  16. cube = peripheral.wrap("Induction Matrix_0")
  17. cubeMax = cube.getMaxEnergy()
  18.  
  19.  
  20. function quelColor(energy)
  21. if energy < 20 then c = colors.red end
  22. if energy >20 and energy < 70 then c = colors.yellow end
  23. if energy > 70 then c = colors.green  end
  24. return(c)
  25. end
  26.  
  27. function titre (x,y,titre,c)
  28. moni.setTextColor(c)
  29. moni.setCursorPos(x,y)
  30. moni.write (titre)
  31. end
  32.  
  33. function etat (x,y,n1,n2)
  34. e = (n1 - n2)/100
  35. e = math.floor (e)/10
  36. if e < 0 then c = colors.red
  37. else c = colors.green end
  38. moni.setTextColor(c)
  39. moni.setCursorPos(x,y)
  40. moni.write (e)
  41. moni.write ('K')
  42. end
  43.  
  44. function barre (x,y,ener,col)
  45. moni.setCursorPos(x,y)
  46. I = ener /8
  47. for i =1,I do
  48. moni.setBackgroundColor(col)
  49. moni.write(" ")
  50. end
  51. moni.setBackgroundColor(colors.black)
  52. end
  53.  
  54.  
  55. while true do
  56. RF = math.floor((cube.getEnergy() / cubeMax ) *1000)/10
  57. RFn1 = cube.getEnergy()
  58. moni.clear()
  59. titre(2,2,"RF Principal",colors.white)
  60.  
  61.  
  62. titre(6,3,RF,quelColor(RF))
  63. moni.write("%")
  64. barre(2,4,RF,quelColor(RF))
  65. etat(5,5,RFn1,RFn2)
  66.  
  67.  
  68. moni.setBackgroundColor(colors.black)
  69. RFn2 = RFn1
  70.  
  71. sleep(30)
  72. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top