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

[Sloved] Why doesn't my code work?

Started by PixelBlocker, 31 August 2012 - 03:11 PM
PixelBlocker #1
Posted 31 August 2012 - 05:11 PM
Hi guys,

I'm trying to code a little sorting turtle but it doesn't work.

Here is my code:

Spoiler

function Compare()
  turtle.select(16)
  turtle.suck()

  for i=1,15,1 do
	turtle.select(i)
	if turtle.compareTo(16) == true then
	  turtle.drop()
	end
  end
  turtle.select(16)
  turtle.drop()
end

function Next()
  turtle.turnLeft()
  for w=1,1,3 do
	turtle.forward()
  end

  turtle.turnRight()
end





turtle.select(1)

for s=1,15,1 do
  turtle.suck()
end

turtle.turnRight()
trutle.turnRight()

for w=1,4,1 do
  turtle.forward()
end

Compare()

Next()

Compare()

Next()

Compare()

turtle.turnRight()
for w=1,6,1 do
  turtle.forward()
end

turtle.turnRight

for w=1,4,1 do   <--(line 58)
  turtle.forward()
end


It gives me the error: bios:206: [string "Sort"]:58: '=' expected
But at line 58 I already have a = (for w=1,4,1 do)

Whats wrong with the code?
Also do you know a more compact way to do this?

Thanks in advance
Magus #2
Posted 31 August 2012 - 05:44 PM
change turtle.turnRight to turtle.turnRight() on line 56
BigSHinyToys #3
Posted 31 August 2012 - 05:46 PM
line 56 needs () at its end
currently

turtle.turnRight
should be

turtle.turnRight()
[EDIT]
I was too slow ow well
[/EDIT]
PixelBlocker #4
Posted 31 August 2012 - 06:18 PM
Aw.. ofcourse.
Thanks guys!