TehNoiseBomb_

ComputerCraft 1.75 - 9x9 Farming - getSeed

Apr 13th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.97 KB | None | 0 0
  1. --@Author: Zach Combs aka TehNoiseBomb
  2. --@Version: 1.5
  3.  
  4. local inputs = {...}
  5. local seed = ... --variable passed in (inputs)
  6.  
  7. --Check the first 15 slots in the turtle's inventory:
  8. -- Create a variable to store the table returned when getting the details of the item in the selected slot
  9. -- If the item's unlocalized name is equal to the seed's:
  10. --  Create an entry in the table named slot and set it to the current slot
  11. --  Create an entry in the table named count and set it to the number of items in the slot
  12. --  Create an entry in the table named name and set it to the name of the item in the slot
  13. --  Create an entry in the table named damage and set it to the damage value of the item in the slot
  14. --  Return the table
  15. for i = 1, 15 do
  16.  local seeds = turtle.getItemDetail(i)
  17.  if seeds and seeds.name == seed then
  18.   seeds.slot = i
  19.   return seeds
  20.  end
  21. end
  22.  
  23. --Default route, the code will not reach this point when it finds the slot containing the seeds
  24. return seeds
Add Comment
Please, Sign In to add comment