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

[Resolved] [Lua][Error] Problem Code? (Line 55; = expected ) [Resolved]

Started by Archimedes, 24 December 2012 - 08:21 AM
Archimedes #1
Posted 24 December 2012 - 09:21 AM
When I attempt to run this code it does not respond and my turtle just sits there, does anyone see a problem which may cause that?



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

local function column()
  while turtle.digUp() do
	turtle.dig()
	checkFuel()
	turtle.up()
  end
  turtle.dig()

  checkFuel()
  while turtle.down() do
	checkFuel()
  end
end

local function digmove()
  checkFuel()
  turtle.dig()
  turtle.forward()
end

local function fell()
  digmove()
  column()
  turtle.turnRight()
  digmove()
  turtle.turnLeft()
  column()
end

local function replant()
  turtle.select(15)
  turtle.suck()
  turtle.place()
  turtle.turnLeft()
  turtle.suck()
  turtle.forward()
  turtle.suck()
  turtle.turnRight()
  turtle.suck()
  turtle.place()
  turtle.turnRight()
  turtle.suck()
  turtle.place()
  turtle.turnRight()
  turtle.suck()
  turtle.forward()
  turtle.suck()
  for slot=3,7 do
	turtle.select(slot)
	turtle.drop()
  end
  turtle.turnLeft()
  turtle.turnLeft()
  turtle.select(15)
  turtle.place()
  turtle.select(2)
  while not turtle.compare() do
	turtle.select(16)
	turtle.place()
	turtle.select(2)
  end
end

while true do
  fell()
  replant()
end


I believe it might be this part of the code, but I am unaware what I should do to fix it.

for slot=3,7 do
	turtle.select(slot)
	turtle.drop()
  end
Orwell #2
Posted 24 December 2012 - 09:29 AM
Do you have coal in the first slot?
Archimedes #3
Posted 24 December 2012 - 09:30 AM
Do you have coal in the first slot?

I have
Coal in 1st slot,
Wood in 2nd slot,
Saplings in 15th slot,
Bone meal in 16th slot.
PixelToast #4
Posted 24 December 2012 - 09:47 AM
are you sure thats the WHOLE code?
i dont see any syntax errors
Archimedes #5
Posted 24 December 2012 - 09:52 AM
are you sure thats the WHOLE code?
i dont see any syntax errors

It is the whole code, the error I am getting is
bios:338: [string "wood"]:55: '=' expected
PixelToast #6
Posted 24 December 2012 - 10:14 AM
um
whut
bios:338
are you….
loading it as an api?
.-.

EDIT:

THAT IS NOT THE CODE YOU ARE USING :rage:
i tested the code you posted in game
no error

this is what it does:
http://puu.sh/1EsEF
Archimedes #7
Posted 24 December 2012 - 11:12 AM
um
whut
bios:338
are you….
loading it as an api?
.-.

EDIT:

THAT IS NOT THE CODE YOU ARE USING :rage:
i tested the code you posted in game
no error

this is what it does:
http://puu.sh/1EsEF

That is really wierd, because I assure you it is, but let me just start from scratch. Sorry for making you rage.

EDIT:

I found the two issues "turtle.suck() on line 54" and "while ture do on line 71" I am really sorry, when I transferred the code I did not notice those two mistakes and when I typed it on here I fixed it without knowing; really didn't mean to confuse you people.
ChunLing #8
Posted 24 December 2012 - 06:48 PM
We need to add something in the stickies about ensuring that your posted code is identical to the code that isn't working.

Because this is just all too common, typos in perfectly good code causing errors that nobody else can find because the typo isn't posted here (conversely, typos in code that's posted here for fixing, though that is a less profound concern).