Bimgo

Turtle-Centrale de tri

Feb 16th, 2013
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.15 KB | None | 0 0
  1. -- Turtle de répartition bois -> charcoal
  2. function compare()
  3.     marque = -1
  4.     for j = 13, 16 do
  5.         if turtle.compareTo(j) == true then
  6.             marque = j
  7.         end
  8.     end
  9.     return marque
  10. end
  11.  
  12. function ItemCount()
  13.     for i = 1, 16 do
  14.         turtle.select(i)
  15.         if turtle.getItemCount(i) >= 3 then
  16.             print("Find item to dispatch in slot "..i)
  17.             turtle.dropDown(1)
  18.             turtle.dropUp(1)
  19.             turtle.drop(1)
  20.         end
  21.         print("check slot "..i.."/16")
  22.         --sleep (2)
  23.         shell.run('clear')
  24.     end
  25. ItemCount()
  26. end
  27. ----------------------------------------------------------------
  28. -- DEPLACEMENTS
  29. ----------------------------------------------------------------
  30. function g()
  31.   turtle.turnLeft()
  32. end
  33.  
  34. function d()
  35.   turtle.turnRight()
  36. end
  37.  
  38. function a()
  39.   while turtle.detect() do
  40.     turtle.dig()
  41.   end
  42.  
  43.   moved = false
  44.   while not(moved) do
  45.     moved = turtle.forward()
  46.   end
  47. end
  48.  
  49. function h()
  50.   turtle.digUp()
  51.  
  52.   moved = false
  53.   while not(moved) do
  54.     moved = turtle.up()
  55.   end
  56. end
  57.  
  58. function b()
  59.   turtle.digDown()
  60.  
  61.   moved = false
  62.   while not(moved) do
  63.     moved = turtle.down()
  64.   end
  65. end
  66.  
  67.  
  68. -------------PROGRAM------------
  69.  
  70. ItemCount()
Advertisement
Add Comment
Please, Sign In to add comment