Advertisement
Guest User

Boiler status display

a guest
Aug 1st, 2013
965
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. --[[
  2. Simple status display for Railcraft boiler with a Liquid fuelbox.
  3. by got_m1lk
  4. --]]
  5.  
  6. --Specify side of wired modem
  7. -- Valid: "left", "right", "front", "back", "top", "bottom"
  8. local modemside = "left"
  9.  
  10. --Specify side of monitor
  11. --If the monitor is attached to the modem specify peripheral name instead.
  12. local monitor = "top"
  13.  
  14. --Specify the ID of the attached Railcraft liquid fueled firebox
  15. local boiler = "liquid_fueled_boiler_firebox_0"
  16.  
  17.  
  18.  
  19. local net = peripheral.wrap(modemside)
  20. local mon = peripheral.wrap(monitor)
  21. local b = peripheral.wrap(boiler)
  22.  
  23. mon.clear()
  24. --Adjust the textscale if you have a bigger/smaller monitor
  25. --Increments of 0.5
  26. mon.setTextScale(1)
  27. mon.setTextColor(512)
  28. mon.setCursorPos(1,1)
  29. mon.write("Boiler status:")
  30.  
  31. while true do
  32.  
  33. tank = b.getTanks("top")
  34.  
  35.  
  36.  
  37.  
  38. local i = 3
  39.  
  40. for k,v in pairs(tank)do
  41.  
  42. mon.setCursorPos(1,i)
  43. mon.clearLine()
  44. mon.setTextColor(512)
  45.  
  46. if v["name"] ~=nil then
  47. mon.write(v["name"] .. ": ")
  48. end
  49.  
  50. mon.setTextColor(colors.orange)
  51. if v["amount"] ~=nil and v["capacity"] ~=nil then
  52. mon.setCursorPos(9,i)
  53. tmp = (v["amount"] / v["capacity"]) *100
  54. tmp = string.match(tostring(tmp),"[^%.]+")
  55. mon.write(tmp .. "%")
  56. end
  57. i = i +1
  58. end
  59.  
  60.  
  61. mon.setCursorPos(1,i)
  62. mon.clearLine()
  63. mon.setTextColor(512)
  64. temp = string.match(tostring(b.getTemperature()),"[^%.]+")
  65. mon.write("Temp: ")
  66. mon.setTextColor(colors.orange)
  67. mon.write( temp .."'C")
  68. os.sleep(1)
  69. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement