Difference between revisions of "Turtle.getFuelLevel"

From ComputerCraft Wiki
Jump to: navigation, search
(Created page with "<table style="width: 70%; border: solid 2px black; margin: 2px; padding: .3em; border-spacing: 0px;"> <tr><td colspan="2" style="font-weight: bold; font-size: large; padding-b...")
 
Line 32: Line 32:
 
</tr>
 
</tr>
 
</table>
 
</table>
 
 
== Uses ==
 
 
Turtle.getFuelLevel is usefull for [http://computercraft.info/wiki/index.php?title=Turtle_Lumberjack_(tutorial) Turtle Lumberjacks]
 
Lets say you don't want to use more fuel than you need.
 
if turtle.getFuelLevel < 1
 
  turtle.refuel(1)
 
end
 
 
'''Output'''
 
 
if the fuel tank is empty, i will give myself new fuel.
 
 
a verry simple code.
 
 
there are plenty kinds of uses.
 
try it yourself!
 

Revision as of 19:42, 5 September 2012

Function turtle.getFuelLevel
Syntax turtle.getFuelLevel()
Returns "unlimited" if disabled fuel, else the fuel level.
Part of ComputerCraft
API turtle
Description Returns the fuel level.

Examples

Description Fills the turtle with fuel if the fuel tank is empty
Code
if turtle.getFuelLevel() < 1
 turtle.refuel()
end
Output Checks if the fuel tank is empty, if it is, it will fill the tank, else it wont do anything.