Jodo32

FTB - Terminal Glasses

Aug 1st, 2013
1,926
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.63 KB | None | 0 0
  1. br = peripheral.wrap("top") --Terminal Glasses Bridge
  2. bb = peripheral.wrap("batbox_0")
  3.  
  4. function header() -- Prints the Display Name
  5.     br.addText(25, 45, "Oracle Display - v0.4", 0x4FFF84)
  6. end
  7.  
  8. function Box() -- Adds the Outlines
  9.     br.addGradientBox(3, 65, 200, 2, 0x0000FF, 1, 0x9C1919, 1, 2)
  10.     br.addGradientBox(3, 110, 200, 2, 0x9C1919, 1, 0x000FF, 1, 2)
  11. end
  12.  
  13. function Time() -- Displays the Minecraft Time
  14.     local time = os.time()
  15.     time = textutils.formatTime(time, false)
  16.     br.addText(5, 70, "The current Minecraft Time is:", 0x9C1919)
  17.     br.addText(160, 70, time, 0x0000FF)
  18. end
  19.  
  20. function bbPower()
  21.         bbLevel = tostring(bb.getStored()) --Gets Energy level in batbox
  22.         local bbString = br.getStringWidth(bbLevel) --Gets how long the EU 'text' is
  23.  
  24.         if tonumber(bb.getStored()) > 5 then --If the EU is More than 5 then
  25.                 br.addText(5, 90, "Batbox:", 0x00158F) --   These lines will display how much EU there is with:
  26.                 br.addText(45, 90, bbLevel, 0x00FF2F) --                      BatBox: 38543 EU
  27.                 br.addText(47 + bbString, 90, " EU", 0x00158F)
  28.         else
  29.                 br.addText(5, 90, "No Energy in Batbox!", 0x00158F)     -- If the EU is less than 5
  30.                                                                         -- then this will display
  31.                                                                         -- "No Energy in batbox!"
  32.         end
  33. end
  34.  
  35. function Update() -- Clears the screen and then reloads the display
  36.     br.clear()
  37.     -- aeItems()
  38.     header()
  39.     Box()
  40.     Time()
  41.     bbPower()
  42.     -- aePower()
  43.     sleep(0.1)
  44. end
  45.  
  46. while true do
  47. Update()
  48. end
Advertisement
Add Comment
Please, Sign In to add comment