Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local selectedSlot = 1
- local maxCountSlots = 16
- local checkIterations = 0
- local exitFlag = false
- -- main cicle
- while (true) do
- -- check blocks in inventory
- checkIterations = 0
- while (true) do
- checkIterations = checkIterations + 1
- if (turtle.getItemDetail(selectedSlot) ~= nil) then
- break
- end
- selectedSlot = selectedSlot + 1
- if (selectedSlot >= maxCountSlots) then
- selectedSlot = 1
- end
- if (checkIterations >= maxCountSlots) then
- exitFlag = true
- end
- end
- if (exitFlag) then
- print("NO BLOCKS :(")
- break
- end
- -- place block
- turtle.select(selectedSlot)
- turtle.placeUp()
- -- move
- for i = 1, 4 do
- if (not turtle.forward()) then
- print("NO FUEL OR WALL")
- break
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment