Advertisement
fat3

Refuel(startup)

Aug 20th, 2014
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.52 KB | None | 0 0
  1. term.clear()
  2. term.setCursorPos(1,1)
  3.  
  4. print ("Fuel: "..turtle.getFuelLevel())
  5. while turtle.getFuelLevel() < 10000 do
  6.     for i = 1, 16 do -- loop through the slots
  7.       turtle.select(i) -- change to the slot
  8.       if turtle.refuel(0) then -- if it's valid fuel
  9.         local halfStack = math.ceil(turtle.getItemCount(i)/2) -- work out half of the amount of fuel in the slot
  10.         turtle.refuel(halfStack) -- consume half the stack as fuel
  11.  term.clear()
  12.  term.setCursorPos(1,1)
  13.     print ("Fuel: "..turtle.getFuelLevel())
  14.       end
  15.     end
  16. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement