Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local fuelSlot = 1
- turtle.select(2) --start on first slot
- local stackCount = turtle.getItemCount()
- function updateStackCount()
- stackCount = turtle.getItemCount(turtle.getSelectedSlot())
- end
- function swapSelected()
- updateStackCount()
- if stackCount==0 then
- currSlot = turtle.getSelectedSlot()
- currSlot = currSlot + 1
- turtle.select(currSlot)
- end
- end
- function checkFuel()
- if turtle.getFuelLevel() <= 1 then
- prevSelected = turtle.getSelectedSlot()
- turtle.select(fuelSlot) --fuel goes in this slot
- turtle.refuel(1)
- turtle.select(prevSelected) --use any slot here, I default to 1, depending on the program.
- end
- end
- while turtle.back() do
- checkFuel()
- swapSelected()
- turtle.place()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement