Advertisement
kyle1320

Untitled

Mar 17th, 2013
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. item = "gravel"
  2. maxAmount = 64
  3. maxStack = 64
  4. sendSide = 4
  5. parent = 1930
  6. counter = 1963
  7.  
  8. itemID = 0
  9. sorter = peripheral.wrap("front")
  10.  
  11. rednet.open("right")
  12.  
  13. getID = function()
  14. rednet.send(parent, textutils.serialize({[1]=0, [2]=item}))
  15. ID, message = rednet.receive()
  16. if ID == parent then
  17. itemID = message + 0
  18. end
  19. end
  20.  
  21. count = function()
  22. cnt = sorter.list(0)[itemID]
  23.  
  24. if cnt == nil then
  25. return 0
  26. else
  27. return cnt
  28. end
  29. end
  30.  
  31. start = function()
  32. getID()
  33.  
  34. sorter.sort(sendSide)
  35.  
  36. while true do
  37. event, ID, message = os.pullEvent()
  38.  
  39. if event == "isort_item" then
  40. if ID + 0 == itemID then
  41. sorter.sort(0)
  42. else
  43. sorter.sort(sendSide)
  44. end
  45. end
  46. end
  47. end
  48.  
  49. start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement