denesik

lib

Sep 26th, 2013
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.58 KB | None | 0 0
  1. -- pastebin get FqHuPkqd lib
  2. local direction = {
  3.     ["forw"]  =1;
  4.     ["right"] =2;
  5.     ["back"]  =3;
  6.     ["left"]  =4;
  7.  
  8. }
  9.  
  10. local pos = {
  11.     ["x"]=0;
  12.     ["y"]=0;
  13. }
  14.  
  15. local function inventoryEmpty(a, b)
  16.     for n=a,b do
  17.         if turtle.getItemCount(n) ~= 0 then
  18.             return false
  19.         end
  20.     end
  21.     print( "Inventory empty." )
  22.     return true
  23. end
  24.  
  25. local function getFullSlot(a, b)
  26.     for n=a,b do
  27.         if turtle.getItemCount(n) ~= 0 then
  28.             return n
  29.         end
  30.     end
  31.     return 0
  32. end
  33.  
  34. local function selectFullSlot(a, b)
  35.     while inventoryEmpty(a, b) do
  36.         os.sleep(1)
  37.     end
  38.     turtle.select(getFullSlot(a,b))
  39. end
Advertisement
Add Comment
Please, Sign In to add comment