Jodo32

FTB - Glasses example

Aug 2nd, 2013
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.91 KB | None | 0 0
  1. br = peripheral.wrap("top") --Terminal Glasses Swag
  2. bb = peripheral.wrap("batbox_2") -- Batbox
  3.  
  4. function bbPower()
  5.     bbLevel = tostring(bb.getStored()) --Gets Energy level in batbox
  6.     local bbString = br.getStringWidth(bbLevel) --Gets how long the EU 'text' is
  7.  
  8.     if tonumber(bb.getStored()) > 5 then --If the Eu is More than 5 then
  9.         br.addText(5, 90, "Batbox:", 0x00158F) --   These lines will display how much EU there is with:
  10.         br.addText(45, 90, bbLevel, 0x00FF2F) --                      BatBox: 38543 EU
  11.         br.addText(47 + bbString, 90, " EU", 0x00158F)
  12.     else
  13.         br.addText(5, 90, "No Energy in Batbox!", 0x00158F) -- If the EU is less than 5
  14.                                     -- then this will display
  15.                                     -- "No Energy in batbox!"
  16.     end
  17. end
  18.  
  19. while true do -- THis little snipit auto-updates how much Eu there is on the HUD
  20. br.clear() --Clears the glasses
  21. bbPower() -- Re-Shows the EU
  22. sleep(0.1) -- How fast it updates
  23. end
Advertisement
Add Comment
Please, Sign In to add comment