This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
NerdLab's profile picture

Fuel Level as variable?

Started by NerdLab, 15 April 2014 - 06:30 PM
NerdLab #1
Posted 15 April 2014 - 08:30 PM
Hello fellow guys,
as the title says, I want to know how I can save the fuel level of a mining turtle as a variable (if this is possible).

I'm using "TurtleOS 1.5" in Tekkit Lite.

Thanks for all answers
CometWolf #2
Posted 15 April 2014 - 09:36 PM

turtle.getFuelLevel()
returns the current amount of fuel.
Bomb Bloke #3
Posted 15 April 2014 - 11:23 PM
And this:

local fuelLevel = turtle.getFuelLevel()

… stores it in a variable.

Note that what's stored is a number representing the amount of fuel the turtle has at the time turtle.getFuelLevel() was called. That variable won't automatically update, so you'll need to check it again every once and a while if you want to keep track of it.
NerdLab #4
Posted 16 April 2014 - 11:16 AM
And this:

local fuelLevel = turtle.getFuelLevel()

… stores it in a variable.

Note that what's stored is a number representing the amount of fuel the turtle has at the time turtle.getFuelLevel() was called. That variable won't automatically update, so you'll need to check it again every once and a while if you want to keep track of it.

Ok thanks. That's it what I've been looking for ^^