Advertisement
nintendowfi

Coal refueler (Coal ammount readers)

Aug 7th, 2022 (edited)
520
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.75 KB | None | 0 0
  1. rednet.open("left")
  2. chest = peripheral.wrap("front")
  3.  
  4. while true do
  5.     print("Transfering coal...")
  6.     for i=1,16,1 do
  7.         turtle.select(i)
  8.         turtle.suck() end
  9.     print("Counting coal...")
  10.     local currently_counted
  11.         currently_counted =0
  12.     local total_counted
  13.         total_counted =0
  14.     for j=1,16,1 do
  15.         currently_counted = currently_counted + turtle.getItemCount(j)
  16.         total_counted = total_counted + turtle.getItemCount(j) end
  17.     print("Counted", total_counted, "coal")
  18.     print("Returning coal...")
  19.     for i=1,16,1 do
  20.         turtle.select(i)
  21.         turtle.drop() end
  22.    
  23.     if currently_counted < 192 then
  24.         rednet.send(14, "Send more coal!")
  25.         print("requesting more coal!")
  26.              end
  27.     sleep(1200)
  28.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement