Advertisement
DumperJumper

Untitled

May 27th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. emptyInvCount = 0
  2. local side = "left"
  3.  
  4. function split(inputstr, sep)
  5. if sep == nil then
  6. sep = "%s"
  7. end
  8. local t={} ; i=1
  9. for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
  10. t[i] = str
  11. i = i + 1
  12. end
  13. return t
  14. end
  15.  
  16. while true do
  17. local emptyInv = true
  18. for slot=1, 16, 1 do
  19. turtle.select(slot)
  20. if turtle.getItemCount() > 0 then
  21. emptyInv = false
  22. local name = split(string.upper(turtle.getItemDetail()["name"]), ":")[2]
  23. local mod = split(string.upper(turtle.getItemDetail()["name"]), ":")[1]
  24. if string.find(name, "ORE") then
  25. if string.find(name, "FERROUS") or string.find(name, "URAN") or string.find(mod, "PROJRED|CORE") or string.find(mod, "THAUMCRAFT") then
  26. print("'"..name.."' by "..mod.." was found")
  27. turtle.dropUp()
  28. else
  29. print("'"..name.."' by "..mod.." was found")
  30. turtle.drop()
  31. end
  32. else
  33. turtle.dropUp()
  34. end
  35. end
  36. sleep(0.2)
  37. end
  38.  
  39. rednet.open(side)
  40. local rID = rednet.lookup("QIMP", "QI_Monitor")
  41.  
  42.  
  43. if rID then
  44. if emptyInv then
  45. rednet.send(rID, "qi:InvEmpty", "QIMP")
  46. else
  47. rednet.send(rID, "qi:InvOK", "QIMP")
  48. end
  49. else
  50. print("WARNING: Could not resolve hostname QI_Monitor")
  51. end
  52.  
  53. rednet.close(side)
  54. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement