Jump to content




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


  • You cannot reply to this topic
7 replies to this topic

#1 Archimedes

  • Members
  • 15 posts

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


#2 Orwell

    Self-Destructive

  • Members
  • 1,091 posts

Posted 24 December 2012 - 09:29 AM

Do you have coal in the first slot?

#3 Archimedes

  • Members
  • 15 posts

Posted 24 December 2012 - 09:30 AM

View PostOrwell, on 24 December 2012 - 09:29 AM, said:

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.

#4 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 24 December 2012 - 09:47 AM

are you sure thats the WHOLE code?
i dont see any syntax errors

#5 Archimedes

  • Members
  • 15 posts

Posted 24 December 2012 - 09:52 AM

View PostPixelToast, on 24 December 2012 - 09:47 AM, said:

are you sure thats the WHOLE code?
i dont see any syntax errors

It is the whole code, the error I am getting is

Quote

bios:338: [string "wood"]:55: '=' expected


#6 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

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

#7 Archimedes

  • Members
  • 15 posts

Posted 24 December 2012 - 11:12 AM

View PostPixelToast, on 24 December 2012 - 10:14 AM, said:

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.

#8 ChunLing

  • Members
  • 2,027 posts

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).





3 user(s) are reading this topic

0 members, 3 guests, 0 anonymous users