xavierlebel

power 4

Mar 3rd, 2014
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. os.loadAPI("button")
  2. m = peripheral.wrap("monitor_2")
  3. p = peripheral.wrap("back")
  4. bank = peripheral.wrap("blockcapacitorbank_3")
  5. m.clear()
  6.  
  7. energy = bank.getEnergyStored("left")
  8. mj = bank.getMJStored("left")
  9. mjmax = bank.getMaxMJReceived("left")
  10.  
  11. function fillTable()
  12.     button.setTable("Refuel",refuel,3,17,1,3)
  13.     button.setTable("Cancel",cancel,3,17,5,7)
  14.     button.screen()
  15. end
  16.  
  17. function getClick()
  18.     event,side,x,y = os.pullEvent("monitor_touch")
  19.     button.checkxy(x, y)
  20. end
  21.  
  22. function pulse()
  23. redstone.setOutput("back", true)
  24. end
  25.  
  26. function pulse1()
  27.     redstone.setOutput("back", true)
  28.     sleep(0,5)
  29.     redstone.setOutput("back", false)
  30. end
  31.  
  32.  
  33. function refuel()
  34.     button.toggleButton("Refuel")
  35.     p.setFreq(301)
  36.     pulse1()
  37. end
  38.  
  39. function cancel()
  40.     button.toggleButton("Cancel")
  41.     p.setFreq(302)
  42.     pulse1()
  43. end
  44.  
  45.  
  46. fillTable()
  47.  
  48. while true do
  49.  
  50. getClick()
  51.  
  52.     m.setTextColor(colors.white)
  53.     m.write("POWER MANAGEMENT V3")
  54.     m.setCursorPos(1,3)
  55.     m.write("RF:" ..energy)
  56.     m.setCursorPos(1,5)
  57.  
  58. end
Advertisement
Add Comment
Please, Sign In to add comment