This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Cheesety210's profile picture

[help] Print Error

Started by Cheesety210, 01 April 2013 - 04:21 AM
Cheesety210 #1
Posted 01 April 2013 - 06:21 AM
I must be doing something really stupid, because on line 32 it is a print line, and i'm getting the error " '=' expected " (Line 32 is "
 print("I should be placed at the bottom of a tree next to it")

local up = 0
function mineup()
repeat
turtle.digUp()
turtle.up()
until turtle.detectUp() == false
repeat
turtle.down()
until turtle.detectDown() == true
end
function ddf()
if turtle.detect() == true then
turtle.dig()
turtle.forward()
else
turtle.forward()
end
end
function checkfuel()
if turtle.getFuelLevel <= 10 then
turtle.select(1)
turtle.refuel()
end
end
print("Hello. Welcome to the Cheesety210 Tree cutting program")
print("Please put your fuel in the first slot.")
turtle.turnRight()
turtle.turnRight()
turtle.turnRight()
turtle.turnRight()
clear
print("I should be placed at the bottom of a tree next to it")
print("right next to the tree. A diagram is below.")
print(" [ ] = A log, and T is the turtle")
print("[ ] [ ] ")
print("[ ] [ ] ")
print(" T	  ")
print(" What is the width/length of the tree? In the example above it's 2.")
local length = read()
if length == 1 then
checkfuel()
ddf()
mineup()
end
if length == 2 then
checkfuel()
ddf()
mineup()
checkfuel()
ddf()
mineup()
checkfuel()
turtle.turnRight()
ddf()
mineup()
checkfuel()
turtle.turnRight()
ddf()
mineup()
checkfuel()
turtle.forward()
end
if length == 3 then
ddf()
mineup()
checkfuel()
ddf()
mineup()
checkfuel()
ddf()
mineup()
checkfuel()
turtle.turnRight()
ddf()
mineup()
checkfuel()
turtle.turnRight()
ddf()
mineup()
checkfuel()
ddf()
mineup()
checkfuel()
turtle.turnLeft()
ddf()
mineup()
checkfuel()
turtle.turnLeft()
ddf()
mineup()
checkfuel()
ddf()
mineup()
end
print("I am done with this tree!")
LBPHacker #2
Posted 01 April 2013 - 06:23 AM
term.clear()
instead of
clear
(line 31)

EDIT: Whatever you want to do with clear, you either have to call it or assign something to it.
sjele #3
Posted 01 April 2013 - 06:24 AM
You forgot your () after clear on line 31, allso i changed clear to term.clear()


local up = 0
function mineup()
repeat
turtle.digUp()
turtle.up()
until turtle.detectUp() == false
repeat
turtle.down()
until turtle.detectDown() == true
end
function ddf()
if turtle.detect() == true then
turtle.dig()
turtle.forward()
else
turtle.forward()
end
end
function checkfuel()
if turtle.getFuelLevel <= 10 then
turtle.select(1)
turtle.refuel()
end
end
print("Hello. Welcome to the Cheesety210 Tree cutting program")
print("Please put your fuel in the first slot.")
turtle.turnRight()
turtle.turnRight()
turtle.turnRight()
turtle.turnRight()
term.clear() --In this line you made the error
print("I should be placed at the bottom of a tree next to it")
print("right next to the tree. A diagram is below.")
print(" [ ] = A log, and T is the turtle")
print("[ ] [ ] ")
print("[ ] [ ] ")
print(" T		 ")
print(" What is the width/length of the tree? In the example above it's 2.")
local length = read()
if length == 1 then
checkfuel()
ddf()
mineup()
end
if length == 2 then
checkfuel()
ddf()
mineup()
checkfuel()
ddf()
mineup()
checkfuel()
turtle.turnRight()
ddf()
mineup()
checkfuel()
turtle.turnRight()
ddf()
mineup()
checkfuel()
turtle.forward()
end
if length == 3 then
ddf()
mineup()
checkfuel()
ddf()
mineup()
checkfuel()
ddf()
mineup()
checkfuel()
turtle.turnRight()
ddf()
mineup()
checkfuel()
turtle.turnRight()
ddf()
mineup()
checkfuel()
ddf()
mineup()
checkfuel()
turtle.turnLeft()
ddf()
mineup()
checkfuel()
turtle.turnLeft()
ddf()
mineup()
checkfuel()
ddf()
mineup()
end
print("I am done with this tree!")