JoePwnz, on 06 April 2014 - 11:08 PM, said:
lets get through your function for refuelling
local function checkFuel()
if turtle.getFuelLevel() < 10 then -- if you are low on fuel then select slot 1 and refuel. this does work if you would have valid fuel there.
turtle.select(1)
turtle.refuel(1)
else -- if ou are not low on fuel then select slot 15, place an enderchest up, suck any item from the front and then dig up the enderchest, placing it back in slot 15.
turtle.select(15)
turtle.placeUp()
turtle.suck(5)
turtle.digUp()
end
end
you might want to try this.
function checkFuel() --checks if there is enough fuel and refuels when neded.
if turtle.getFuelLevel()<10 then --if you are low on fuel
print("refueling")
turtle.select(15) --select the enderchest
turtle.placeUp() --place the enderchest above you
turtle.suckUp() --suck some fuel from the above enderchest into the current selected slot. (you cannot specify any amounth or from which slot.)
turtle.refuell(1) --refuel with one piece of fuel
turtle.dropUp(63) --dump the rest of the fuel back in the enderchest. (can be left out of the code.)
turtle.digUp() --digs up the enderchest above you and places it in your current selected iventory.
else --if you are not low on fuel.
print("not low on fuel, carrying on with business. mining lasers n stuff.")
end
end
You would need a mining turtle for this, because an enderchest is not a farming item. So it can't be picked up with a hoe. It might be better to have a chest with fuel on a set spot where the turtle will be a lot of time, and have him refuell over there.
Also, if you didn't know. Computercraft has an own Wiki which can be verry helpfull with build in functions.
http://computercraft...i/Category:APIs
especcially this one,
http://computercraft...ki/Turtle_(API)
Edited by blipman17, 07 April 2014 - 06:45 PM.