SHARE
TWEET

inventory.lua

neo34rd Mar 24th, 2019 (edited) 164 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --- Selects any item in inventory
  2. --- Returns true if an item is selected, false otherwise
  3. function trySelectAnyFirst()
  4.     for i = 1, 16 do
  5.         local c = turtle.getItemCount(i)
  6.         if c >= 1 then
  7.             turtle.select(i)
  8.             print("Selected:")
  9.             print(i)
  10.             return true;
  11.         end
  12.     end
  13.     print("No items for selection!")
  14.     return false;
  15. end
  16.  
  17.  
  18. function sort()
  19.     for i = 1, 16 do
  20.         count = 0
  21.         for j = i, 16 do
  22.             turtle.select(j)
  23.             b = turtle.transferTo(i)
  24.             if b == true then
  25.                 count = count + 1
  26.             end
  27.         end
  28.         lim = 17 - i
  29.         print(count, " / ", lim)
  30.  
  31.         if count == lim then
  32.             return
  33.         end
  34.     end
  35. end
  36.  
  37.  
  38. function inspect()
  39.     for i = 1, 16 do
  40.         d = turtle.getItemDetail(i)
  41.         if d ~= nil then
  42.             print(d.name)
  43.             print(d.damage)
  44.             print(d.count)
  45.         end
  46.     end
  47. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top