Advertisement
davidweisgerber

Untitled

Feb 28th, 2015
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. local sensor = peripheral.wrap("right")
  2. local targets = sensor.getTargets()
  3. local totalStackSize = 0
  4. local currentStackSize = 0;
  5. local percentage = 100;
  6. while true do
  7. local details = sensor.getTargetDetails("bottom")
  8.  
  9. local firstSlot = details[1];
  10. currentStackSize = tonumber(firstSlot["size"])
  11.  
  12. -- the stack size has increased, so we've probably added to the machine
  13. if currentStackSize > totalStackSize then
  14. totalStackSize = currentStackSize
  15. end
  16.  
  17. percentage = (100 - ((100/totalStackSize) * currentStackSize));
  18. print( percentage.. "% of the way through")
  19.  
  20. sleep(0.5)
  21. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement