Advertisement
hyndgrinder

ME Inventory Manager

Nov 26th, 2013
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function quitProgram()
  2. local e, msg=os.pullEvent("char")
  3.     if msg=="q"
  4.     then quit=true
  5.     end
  6. end
  7.  
  8. function man_ovr()
  9. local e=os.pullEvent()
  10. if e=="redstone" then
  11. ovr=true
  12. end
  13. end
  14.  
  15. function readSlots()
  16.   for i=0, sz-1, 1 do
  17.       tbl[i+1]=p.getStackInSlot(i)
  18.       term.setCursorPos(1,1)
  19.       pct= math.floor((i+1) / 27 * 100)
  20.       print(pct.. "% complete")
  21.   end
  22. end
  23.  
  24. function wait()
  25. sleep(0.05)
  26. end
  27. -------------------------------------------------
  28. mon=peripheral.wrap("top")
  29. i=0
  30. cell=peripheral.wrap("left")
  31. note=peripheral.wrap("right")
  32.  
  33. -- infinite loop
  34. while true do
  35. parallel.waitForAny(quitProgram,wait,man_ovr)
  36.  
  37. if quit ==true then
  38. print ("quitting program")
  39. break
  40. end
  41.  
  42. if ovr==true then
  43. cell.setEnergySend(100)
  44. else
  45. cell.setEnergySend(0)
  46. end
  47. --60 cycles till it exits and provides power to clear any machines
  48.  
  49. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement