Guest User

Untitled

a guest
Jun 18th, 2014
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.64 KB | None | 0 0
  1. while true do
  2. peripherals = peripheral.getNames()
  3. voidtable = {}
  4. jartable = {}
  5. os.loadAPI("button")
  6.  
  7.  
  8. for i = 1, #peripherals do
  9.   if peripheral.getType(peripherals[i]) == "tilejarvoid" then
  10.       table.insert(voidtable, peripheral.wrap(peripherals[i]))
  11.     end
  12. end
  13.  
  14. for i = 1, #peripherals do
  15.   if peripheral.getType(peripherals[i]) == "tilejar" then
  16.       table.insert(jartable, peripheral.wrap(peripherals[i]))
  17.     end
  18. end
  19.  
  20. mjar = peripheral.wrap("top")
  21. mjar.setTextScale(0.5)
  22.  
  23. mvoid = peripheral.wrap("top")
  24. mvoid.setTextScale(0.5)
  25.  
  26. mjar.setTextColor(colors.blue)
  27.  
  28. pos = 1
  29. mjar.clear()
  30. mvoid.clear()
  31.  
  32. for i = 1, #jartable do
  33.   mjar.setCursorPos(1, pos)
  34.   jaramount = jartable[i].getEssentiaAmount("")
  35.      if jaramount<=20 then mjar.setTextColor(colors.red) end
  36.      if jaramount<40 and jaramount>20 then mjar.setTextColor(colors.yellow) end
  37.      if jaramount>=40 then mjar.setTextColor(colors.green) end
  38.   mjar.write(jartable[i].getSuctionType(""):gsub("%a", string.upper, 1))
  39.   mjar.setCursorPos(20, pos)
  40.  
  41.   mjar.write(string.sub(jaramount, string.len(jaramount) - 1))
  42.   pos = pos + 1
  43. end
  44.  
  45. pos = 1
  46.  
  47. for i = 1, #voidtable do
  48.   mvoid.setCursorPos(55, pos)
  49.   voidamount = voidtable[i].getEssentiaAmount("")
  50.      if voidamount<=20 then mjar.setTextColor(colors.red) end
  51.      if voidamount<40 and voidamount>20 then mjar.setTextColor(colors.yellow) end
  52.      if voidamount>=40 then mjar.setTextColor(colors.green) end
  53.   mvoid.write(voidtable[i].getSuctionType(""):gsub("%a", string.upper, 1))
  54.   mvoid.setCursorPos(75, pos)
  55.  
  56.   mvoid.write(string.sub(voidamount, string.len(voidamount) - 1))
  57.   pos = pos + 1
  58.  
  59. end
  60.   sleep(15)
  61.   end
Advertisement
Add Comment
Please, Sign In to add comment