Posted 07 February 2013 - 06:57 AM
I have an unexpected symbol error on line 131 the line is actually; if rStart == 1 or == 2 or == 3 or == 4 or == 5 then. By the way not sure why the line encoding looks so messed up.
print "Put a sapling in slot 1 and 15."
print("")
print("")
print("")
print("")
print "Press any key to continue"
os.pullEvent("key")
print("")
print("")
print("")
print("")
print("")
print "Put a log in slot 14 note: this has to be the same as the sapling."
print("")
print("")
print("")
print("")
print "Press any key to continue"
os.pullEvent("key")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print "Put bonemeal into slot 2 and 16."
print("")
print("")
print("")
print("")
print("Please make sure the turtle has at least 50 fuel or it will not be able to run!")
print("")
print("")
print("")
print("")
print "Start the program? Make sure that all of the items are in the correct places!"
os.pullEvent("key")
-- END OF THE INSTRUCTIONS!
-- Varibles
local bExit = false -- For the ending of the program in the the checkSaplings and checkMeal statements. Also used in the while statement at the end.
local numCut = 1 -- This i
local wood = 1
-- Functions with if statements
local function turtleRefuel()
turtle.select(14) --This selects wood
if turtle.getFuelLevel() <= 50 then
if turtle.compareTo(3) == true then
turtle.select(3)
turtle.getItemCount(3)
wood = turtle.getItemCount(3)
turtle.refuel(wood)
else
print("Could not refuel")
bExit = true
end
end
end
local function checkSaplings()
turtle.select(1)
if turtle.compareTo(15) == false then --Slot 15 is saplings
print("Check the saplings. Either could not check saplings are none or there are none left.")
bExit = true
else
end
end
local function checkMeal()
turtle.select(2)
if turtle.compareTo(16) == false then --Slot 16 is bonemeal
print("Check the bone meal. Either could not check bone meal or there none is left.")
bExit = true
else
end
end
-- Normal Functions
local function plantTree()
turtle.select(1)
turtle.place()
sleep(.75)
turtle.select(2)
turtle.place()
end
local function cutTree()
turtle.dig()
turtle.forward()
turtle.suck()
turtle.digUp()
turtle.suck()
turtle.up()
turtle.digUp()
turtle.suck()
turtle.up()
turtle.digUp()
turtle.suck()
turtle.up()
turtle.digUp()
turtle.suck()
turtle.up()
turtle.digUp()
turtle.suck()
turtle.up()
turtle.digUp()
turtle.suck()
turtle.up()
turtle.digUp()
turtle.suck()
turtle.up()
turtle.digUp()
turtle.suck()
turtle.up()
end
local function returnToStart()
for rStart = 1,5 do
print(rStart)
if rStart == 1 or == 2 or == 3 or == 4 or == 5 then
while turtle.down() == false do
turtle.down()
if rStart == 5 then
turtle.back()
rStart = 6
if rStart == 6 then
turtle.back()
if rStart == 6 then
end
end
end
end
end
end
end
-- While statement (actual program that is executed)
while bExit == false do
checkSaplings()
checkMeal()
turtleRefuel()
plantTree()
cutTree()
returnToStart()
end