turtle.getFuelLevel

From ComputerCraft
Jump to: navigation, search

turtle.getFuelLevel
Function
Syntax
turtle.getFuelLevel()
Returns number fuel
API turtle
Source CC:Tweaked

Returns a number representing the current amount of fuel (block moves) the turtle currently holds.

ExampleExampleGet fuel level
Get the amount of blocks a turtle can still move.
Code
print("We can still move", turtle.getFuelLevel(), "blocks before we run out of fuel!")
Output
We can still move 9802 blocks before we run out of fuel!
ExampleExampleGet fuel level in percentage
Get the fuel level of a turtle in percentage of the max fuel holding capability, using turtle.getFuelLimit().
Code
print("Fuel level is: ", ( turtle.getFuelLevel() / turtle.getFuelLimit() ) * 100, "%")
Output
Fuel level is: 9.802 %