ravneravn

inoculator

Nov 18th, 2013
57
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. chest = peripheral.wrap("top")
  2. ino = peripheral.wrap("right")
  3.  
  4. function getNew()
  5. newSerum = 0
  6. while newSerum == 0 do
  7. chestSize = chest.getSizeInventory()
  8. for slot = 0, chestSize do
  9. chestSerum = chest.getStackInSlot(slot)
  10. if chestSerum then
  11. if serum.name == chestSerum.name then
  12. chest.push("up", slot, 1)
  13. print("Got new "..serum.name.." serum")
  14. newSerum = 1
  15. break
  16. end
  17. else
  18. break
  19. end
  20. end
  21. sleep(10)
  22. end
  23. end
  24.  
  25. function refill()
  26. ino.push("east", 15, 1)
  27. print("refilling "..serum.name)
  28. end
  29.  
  30. function checkSerum()
  31. serum = ino.getStackInSlot(15)
  32. if serum then
  33. print(serum.dmg)
  34. if serum.dmg == 16 then
  35. refill()
  36. getNew()
  37. end
  38. end
  39. end
  40.  
  41. -----------
  42. while true do
  43. checkSerum()
  44. sleep(5)
  45. end
RAW Paste Data