Guest User

test

a guest
Aug 13th, 2014
402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.47 KB | None | 0 0
  1. maxEnergy = 51200000*120
  2.  
  3. mon = peripheral.wrap("right")
  4.  
  5. os.loadAPI('/gui')
  6.  
  7. powerBar = gui.createButton("powerBar")
  8. powerBar:draw ( 5,8,30,colors.white,colors.green,true,colors.black,colors.white )
  9.  
  10.  
  11.  
  12. while true do
  13.   rednet.open("bottom")
  14.   id, curE = rednet.receive()
  15.   totalEnergy = tonumber(curE) * 120
  16.    
  17.   rawPer = totalEnergy/maxEnergy
  18.   pPercent = math.floor((rawPer*100)+0.5)
  19.  
  20.   powerBar:update( pPercent )
  21.   print(pPercent)
  22.  
  23.   sleep(1)
  24. end
Advertisement
Add Comment
Please, Sign In to add comment