Advertisement
m3Zz

Mobfarming

Mar 17th, 2013
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.05 KB | None | 0 0
  1. function clear()
  2.  term.clear()
  3.  term.setCursorPos (1,1)
  4. end
  5.  
  6. function check()
  7.  if turtle.getItemCount(16)>0 then
  8.   deposit()
  9.  end
  10. end
  11.  
  12. function deposit()
  13. clear()
  14. print("My inventory is full!")
  15. print("Depositing in chest...")
  16. turtle.turnRight()
  17. turtle.turnRight()
  18.  for i1=1, 16, 1 do
  19.   clear()
  20.   print("My inventory is full!")
  21.   print("Depositing in chest...")
  22.   print("Current slot: "..i1)
  23.   turtle.select(i1)
  24.   turtle.drop()
  25.  end
  26. turtle.select(1)
  27. print("Done!")
  28. print("Getting back to work!")
  29. sleep(1)
  30. turtle.turnLeft()
  31. turtle.turnLeft()
  32. timer=os.startTimer(1)
  33. end
  34.  
  35. i=0
  36. timer=os.startTimer(1)
  37. clear()
  38. while true do
  39.  local event, arg = os.pullEvent()
  40.   if event == "timer" then
  41.    if arg == timer then
  42.     timer=os.startTimer(1)
  43.    end
  44.   else
  45.   if event == "key" then
  46.    if arg == 28 then
  47.     print("Shutting down...")
  48.     sleep(0.5)
  49.     break
  50.    end
  51.   end
  52. end
  53.  check()
  54.  clear()
  55.  print("Killed mobs: "..i)
  56.  print("Hit [ENTER] to stop the program!")
  57.  if turtle.attack() then
  58.   i=i+1
  59.  end
  60. end
  61. clear()
  62. print("Program stopped.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement