Posted 06 February 2013 - 12:33 PM
I want to get some help with debugging a turtle program i got from direwolf20 (if you saw season 5 episode 24 of his series). Here is the program:
local location = ""
function teleport()
tp = peripheral.wrap("bottom")
tp.teleport()
end
function checkFull()
greader = peripheral.wrap("right")
data = greader.get()
while not data["Full Energt"] do
sleep(2)
data=greader.get()
end
turtle.dig()
end
function checkEmpty()
greader=peripheral.wrap("right")
data = greader.get()
while not data["No Energy"] do
sleep(2)
data = greader.get()
end
turtle.dig()
end
function checkLoc()
loc = turtle.detectUp()
if loc == true then
print("I am at the quarry")
location = "Quarry"
else
print("I am at the charge station")
location = "Charging"
end
end
function getFuel()
turtle.turnRight()
for i = 1, 9 do turtle.forward() end
turtle.turnLeft()
for i = 1, 6 do turtle.forward() end
turtle.suck()
turtle.refuel()
turtle.turnLeft()
turtle.turnLeft()
for i = 1, 6 do turtle.forward() end
turtle.turnRight()
for i = 1, 9 do turtle.forward() end
turtle.turnRight()
end
function checkFuel()
fuel = turtle.getFuelLevel()
print("My fuel level:"..tostring(fuel))
if fuel < 2500 then
print("I need fuel")
getFuel()
print("My fuel level:"..tostring(turtle.getFuelLevel()))
end
end
checkLoc()
if location == "Quarry" then
turtle.turnRight()
turtle.place()
checkEmpty()
teleport()
else
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.place()
checkFuel()
checkFull()
turtle.turnLeft()
turtle.turnLeft()
turtle.forward()
turtle.forward()
teleport()
end
On the line that says "function getFuel()" it says im missing an =. Any help would be great :)/>