Jump to content




help with error in coding


1 reply to this topic

#1 naturedpk

  • New Members
  • 1 posts

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 Bubba, 25 November 2013 - 09:54 PM.
Replaced bullet points with code tags: DON'T USE BULLET POINTS FOR CODE PEOPLE!


#2 VaNnOrus

  • Members
  • 13 posts

Posted 25 November 2013 - 10:33 PM

View Postnaturedpk, on 25 November 2013 - 09:22 PM, said:

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





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users