Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Nether Traveller by VADemon
- itemCount = turtle.getItemCount(1)
- turtle.select(1)
- function addCount()
- itemCount = itemCount - 1
- if itemCount == 0 then
- for i = 2, 16 do
- if turtle.getItemCount(1)==64 then
- itemCount = 64
- turtle.select(1)
- break
- else
- turtle.select(i)
- turtle.transferTo(1, turtle.getItemSpace(1) )
- itemCount = turtle.getItemSpace(1)
- end
- end
- -- if checked all slots, but <64 in total
- print("I'm low on blocks!")
- if itemCount == 0 then
- print("No blocks left! Refill me please!")
- print("Stopping!")
- ready = true
- end
- end
- end
- function goForward()
- --sleep(1)
- turtle.dig()
- if turtle.forward() then
- if not turtle.detectDown() then
- if not turtle.placeDown() then
- print("Can't place a block, though there's nothing underneath!")
- print("Stopping!")
- ready = true
- end
- addCount()
- end
- else
- print("Something is on my way! Can't move.")
- sleep(4)
- end
- end
- print("Press \"S\" to stop!")
- local ready = false
- parallel.waitForAny(
- function()
- while not ready do
- local event, key = os.pullEvent("key")
- if key == 31 then
- ready = true
- print("Stopping...")
- end
- end
- end,
- function()
- while not ready do
- goForward()
- end
- end
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement