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

Bios Error In Lumberjack Program

Started by JaydenLoon3y, 31 December 2012 - 01:49 PM
JaydenLoon3y #1
Posted 31 December 2012 - 02:49 PM
Hi, I'm making a lumberjack program that,

Cuts down a tree, puts wood into a chest then replants sapling and bone meals it.

I am having this error

line 11 'do' expected

and i have no idea whats causing it

Please Post Fixes

And here is my code


H = 8
Error = 0


local function checkFuel()
  if turtle.getFuelLevel() < 20 then
    turtle.select(16)
    turtle.refuel(1)
  end
end

  while turtle.compare(15) = true and H == 8 do
    checkFuel()
    turtle.dig()
    turtle.forward()
    H = H - 1
    print("Starting To Chop Tree")
  end
 
  while turtle.compare(15) = false and H == 8 and Error ~= 3 do
    turtle.select(2)
    turtle.place()
    turtle.select(3)
    turtle.place()
    Error = Error + 1
  end
 
  while H == 7 do
    checkFuel()
    turtle.digUp()
    turtle.up()
    H = H - 1
  end
  while H == 6 do
    checkFuel()
    turtle.digUp()
    turtle.up()
    H = H - 1
  end
  while H == 5 do
    checkFuel()
    turtle.digUp()
    turtle.up()
    H = H - 1
  end
  while H == 4 do
    checkFuel()
    turtle.digUp()
    turtle.up()
    H = H - 1
  end
  while H == 3 do
    checkFuel()
    turtle.digUp()
    turtle.up()
    H = H - 1
  end
  while H == 2 do
    checkFuel()
    turtle.digUp()
    turtle.up()
    H = H - 1
  end
  while H == 1 do
    checkFuel()
    turtle.down()
    turtle.down()
    turtle.down()
    turtle.down()
    turtle.down()
    turtle.down()
    H = H - 1
    print("Tree Chopped Successfully")
  end

  while H == 0 do
    checkFuel()
    turtle.turnRight()
    turtle.turnRight()
    turtle.forward()
    turtle.select(1)
    turtle.drop()
    checkFuel()
    turtle.turnRight()
    turtle.turnRight()
    turtle.select(2)
    turtle.place()
    turtle.select(3)
    turtle.place()
    H == 8
  end
 
  while Error == 3 do
    print("	    !!!!!Error Detected!!!!!")
    print("		  Please Check Supplies")
    print("		   And Click The Mouse")
    local event, param1 = os.pullEvent ("mouse_click")
    if param1 == true then
	  os.reboot()
  end

Thanks in Advance
Lyqyd #2
Posted 31 December 2012 - 03:11 PM
Your second while loop uses = false when it should use == false.
JaydenLoon3y #3
Posted 31 December 2012 - 03:17 PM
is that the same with the true loop?
Lyqyd #4
Posted 31 December 2012 - 03:18 PM
Ah, yes. For whatever reason, I had misread it as having the correct syntax when I posted.