Thursday, December 13, 2012

Computercraft Turtle Program

Just figured I'd share my turtle programs with you as I get them made. This first one is just a simple loop that you can use when the turtle is stationary and hooked up to a pipe or something feeding him with fuel. I use it as my startup script and have him hooked up to a cactus farm. It refuels him and when his fuel level goes up, he prints his current amount of fuel.

while true do                                                                   
  local current = turtle.getFuelLevel()                                         
  turtle.refuel()                                                               
  if current ~= turtle.getFuelLevel() then                                      
    print(turtle.getFuelLevel())                                                
  end                                                                           
end   

No comments:

Post a Comment