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

help with error in coding

Started by naturedpk, 25 November 2013 - 08:22 PM
naturedpk #1
Posted 25 November 2013 - 09:22 PM
In need of some help, the 70th line in my coding seems to be messed up. I get the error StripMine:70: attempt to compare string with number expected, got string.
here is my coding with the 70th line some how messed up, please help.

local enderchest = false
	
local torch = turtle.getItemCount(1)
	
local chests = turtle.getItemCount(2)
	
local dist = 0
	
function dump()
	
if turtle.getItemCount(16)>0 then
	
  turtle.digDown()
	
  turtle.select(2)
	
  turtle.placeDown()
	
  for slot = 3,16,1 do
	
   turtle.select(slot)
	
   turtle.dropDown()
	
  end
	
  if enderchest then
	
   turtle.select(2)
	
   turtle.digDown()
	
  else
	
  local c = c - 1
	
  end
	
end
	
end
	
function digforw()
	
if turtle.detect() then
	
  turtle.dig()
	
end
	
turtle.forward()
	
dump()
	
turtle.digUp()
	
dump()
	
dist = dist + 1
	
end
	
function home()
	
turtle.turnLeft()
	
turtle.turnLeft()
	
if turtle.detectUp() then
	
  turtle.digUp()
	
end
	
turtle.up()
	
for i=1,dist,1 do
	
  turtle.forward()
	
end
	
turtle.down()
	
if torch==0 then
	
  print("Ran out of torches.")
	
elseif chests==0 then
	
  print("Ran out of chests.")
	
else
	
  print("Ran out of fuel.")
	
end
	
turtle.turnLeft()
	
turtle.turnLeft()
	
end
	
function light()
	
turtle.turnLeft()
	
turtle.turnLeft()
	
turtle.select(1)
	
turtle.place()
	
turtle.turnLeft()
	
turtle.turnLeft()
	
torch = torch - 1
	
end
	
local retdist = 0
	
local fuel = turtle.getFuelLevel()
	
function run()
	
while (torch>0) and (chests>0) and (fuel>retdist) do
	
  for i=1,12,1 do
	
   digforw()
	
  end
	
  light()
	
  retdist = dist + 14
	
  fuel = turtle.getFuelLevel()
	
end
	
home()
	
end
	
run()
Edited by
VaNnOrus #2
Posted 25 November 2013 - 10:33 PM
my coding with the 70th line some how messed up
And how do you think we need to understand what error line? -_-/>

I tested the code without any changes - no errors issues
Show that it's on 70th line in your file