edoreld

Untitled

Jun 7th, 2013
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. local bridge = peripheral.wrap("left")
  2. local net = peripheral.wrap("back")
  3.  
  4. local width = 200
  5. local machines = {
  6. {
  7. ["id"] = "matter_fabricator_0",
  8. ["name"] = "Matter Fab"
  9. }
  10. }
  11.  
  12. for key,value in pairs(machines) do
  13. value["label"] = bridge.addText(5,5,"Matter Fabricator:",0x1B1224)
  14. value["bar"] = bridge.addBox(5,15,0,5,0xC5360F,0.0)
  15. value["bar"].setZIndex(2)
  16. end
  17.  
  18. local progress = 0
  19.  
  20. while true do
  21. for i=#machines,1,-1 do
  22. machine = machines[i]
  23. if net.isPresentRemote(machine["id"]) then
  24. progress = net.callRemote(machine["id"],"getProgress")
  25. maxProgress = net.callRemote(machine["id"],"getMaxProgress")
  26. machine["bar"].setWidth(width * maxProgress / progress)
  27. else
  28. machine["bar"].delete()
  29. machine["label"].delete()
  30. end
  31. end
  32. os.sleep(1)
  33. end
  34.  
  35.  
  36. -- arguments: x, y, width, height, color, opacity
  37. -- mybox = bridge.addBox(0,0,80,40,0x0099FF,0.7)
  38.  
  39. -- arguments: x, y, text, color
  40. -- mytext = bridge.addText(10, 10, "hello!", 0xCC0000)
  41.  
  42. --while true do
  43. -- term.clear()
  44. -- term.setCursorPos(1,1)
  45.  
  46. -- print("1. Clear Glasses.")
  47. -- print("2. Print a blue rectangle.")
  48. -- print("3. Show matter fabricator")
  49. -- print("0. Exit")
  50.  
  51. -- local answer = tonumber(read())
  52.  
  53.  
  54. -- if answer == 1 then
  55. -- bridge.clear()
  56. -- elseif answer == 2 then
  57. -- box = bridge.addBox(0,0,80,40,0x0099FF,0.7)
  58. -- elseif answer == 0 then
  59. -- break
  60. -- end
  61. -- end
Advertisement
Add Comment
Please, Sign In to add comment