Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Function to check if the turtle's inventory is full
- function isInventoryFull()
- for slot = 1, 16 do
- if turtle.getItemCount(slot) == 0 then
- return false -- Found an empty slot
- end
- end
- return true -- All slots are occupied
- end
- -- Main loop
- while true do
- -- Wait until there's space in the inventory
- while isInventoryFull() do
- print("Inventory full. Waiting for space...")
- os.sleep(5) -- Wait for 5 seconds before checking again
- end
- -- Attempt to dig the block in front
- turtle.dig()
- os.sleep(0.5) -- Short delay to prevent rapid mining
- end
Add Comment
Please, Sign In to add comment