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

New drillDown program will not run

Started by TyCamden, 10 October 2012 - 04:51 PM
TyCamden #1
Posted 10 October 2012 - 06:51 PM
Just created this program and it will not run.

When I try to run it it says…

Bios : 206 : [string "drillDown"] : 48 : ' do ' expected

If you see the problem, please let me know how to fix. Thanks!

code…


--[[ Program name : drillDown
	  This program moves 1 forward then drills down to
	  bedrock, looking for ores on all sides, then
	  fills any holes it leaves, including the
	  hole it made going down--]]
--[[ Use a MINING TURTLE for this program and
	  make sure the following slots
	  have correct items
slots 1-12 clear
slot 13 has 64 coal/charcoal
slot 14 has 64 cobblestone
slot 15 has 01 stone
slot 16 has 64 dirt
--]]
--[[ set numeric var's --]]
fuellvl = 0
amtchar = 0
downMoves = 0
mineProceed = 1
X = 0
T = 0
flagDud = 0
--[[ refuel section --]]
fuellvl = turtle.getFuelLevel()
if fuellvl<100 then
  amtchar = turtle.getItemCount(13)
  if amtchar > 1 then
    turtle.select(13)
    turtle.refuel(2)
    turtle.select(1)
  else
    if amtchar > 0 then
	  turtle.select(13)
	  turtle.refuel(1)
	  turtle.select(1)
    end
  end
end
--[[ move forward one --]]
turtle.forward()
--[[ moving and mining --]]
while mineProceed = 1 do
  if turtle.detectDown() == true then
    turtle.digDown()
  end
  if turtle.down() == true then
    turtle.down()
    downMoves = downMoves + 1
  else
    mineProceed = 0
  end
  for T = 1,4 do
    if turtle.detect() == true then
	  flagDud = 0
	  for X = 14,16 do
	    turtle.select(X)
	    if turtle.compare() == true then
		  flagDud = 1
	    end
	  end
	  if flagDud == 0 then
	    turtle.dig()
	    if turtle.getItemCount(14) > 1 then
		  turtle.select(14)
	    else
		  turtle.select(16)
	    end
	    turtle.place()
	  end
    end
    turtle.turnRight()
  end
end
--[[ finished mining, move up and fill --]]
while downMoves > 0 do
  turtle.up()
	  if turtle.getItemCount(14) > 1 then
	    turtle.select(14)
	  else
	    turtle.select(16)
	  end
	  turtle.place()
  downMoves = downMoves - 1
end
MetalMiner #2
Posted 10 October 2012 - 07:15 PM
while mineProceed = 1 do
is wrong.
Use
while mineProceed == 1 do

Hint:
Just use
if turtle.detect() then
You don't ned '== true', because the api already returns true or false.
Cozzimoto #3
Posted 10 October 2012 - 08:22 PM
on all your if statements you dont need to have "== true" because it will already return true. there are about 4 if statements you have with the incorrect "== true" tagged at the end of it

and use "=" for math algorithmic situations
if you are comparing one object to another in a if statement or while loop use "==" or "~="

hopw this helps! =)
TyCamden #4
Posted 11 October 2012 - 12:48 PM
Thanks guys for the find, and the advice. That did the trick !