Advertisement
GooGoo

dropSapCoa - ComputerCraft Turtle Progam

Feb 9th, 2015
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.47 KB | None | 0 0
  1. -- this program should be used with Pipes piping into turtle.(Tested with Ender IO Item Conduits.)
  2.  
  3. local count = 12 -- amount to drop
  4.  
  5. local sapling = 15 --Uses this to determine sleep time for slot 15 item.
  6. local sapSleepTime = 3 -- time to wait before dropping saplings again
  7.  
  8. local coal = 16 -- coal or charcoal. uses this to determine sleep time for slot 16 item.
  9. local coSleepTime = 41 -- time to wait before dropping coal again
  10.  
  11. local empSleepTime = 30 -- time to wait for more items to arrive.
  12.  
  13. function dropCoal()
  14.     while turtle.getItemCount(1) < count do
  15.         print("Sleeping for "..empSleepTime.." seconds.")
  16.         sleep(empSleepTime)
  17.     end
  18.         if turtle.getItemCount(1) >= count then
  19.             turtle.dropUp(count)
  20.             print("Sleeping for "..coSleepTime.." seconds.")
  21.             sleep(coSleepTime)
  22.         end
  23.    
  24. end
  25.  
  26. function dropSapling()
  27.     while turtle.getItemCount(1) < count do
  28.         print("Sleeping for "..empSleepTime.." seconds.")
  29.         sleep(empSleepTime)
  30.     end
  31.         if turtle.getItemCount(1) >= count then
  32.             turtle.dropUp(count)
  33.             print("Sleeping for "..sapSleepTime.." seconds.")
  34.             sleep(sapSleepTime)    
  35.         end
  36. end
  37.  
  38. function checkItem()
  39.     if turtle.compareTo(coal) then
  40.     dropCoal()
  41.     elseif turtle.compareTo(sapling) then
  42.     dropSapling()
  43.     elseif not turtle.compareTo(sapling) then
  44.         print("Please put a sapling in slot 15.")
  45.         sleep(10)
  46.     elseif not turtle.compareTo(coal) then
  47.         print("Please put a piece of coal in slot 16.")
  48.         sleep(10)
  49.     end
  50. end
  51.  
  52. while true do
  53.     checkItem()
  54. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement