Jump to content




Aaaaand... What did I do wrong here?


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

#1 Tjakka5

  • Members
  • 256 posts

Posted 21 October 2012 - 07:05 AM

function f
  turtle.forward()	   --this is line 65 Btw
end
f
f
f

Error:
bios: 328 : [string "sort" ]:65: '(' expected

Edit: My rank realy fits with this question.

#2 sjele

  • Members
  • 334 posts
  • LocationSomewhere on the planet called earth

Posted 21 October 2012 - 07:07 AM

You name a function like this,
function funcName()
--Code to do
end
funcName()


#3 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 21 October 2012 - 07:07 AM

The first thing you did wrong was not posting the whole code. The second thing you did wrong was not using parentheses in your function declaration, or your function calls.

function f()
  turtle.forward()
end
f()
f()
f()


#4 elcid534

  • Members
  • 16 posts

Posted 21 October 2012 - 07:08 AM

View PostTjakka5, on 21 October 2012 - 07:05 AM, said:

function f
  turtle.forward()	   --this is line 65 Btw
end
f
f
f

Error:
bios: 328 : [string "sort" ]:65: '(' expected

Edit: My rank realy fits with this question.
this is easy and hard
in function f() u forgot to add brackets and the variable to count how far forwards
the f needs bracks f()

function f(distance_var)
  turtle.forward(distance_var)
end
f(2) -- 2 blocks
f(6) -- 6 blocks

lyqyd is a better answer

#5 Tjakka5

  • Members
  • 256 posts

Posted 21 October 2012 - 07:10 AM

And that is why I never use functions.

Thanks guys!

#6 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 21 October 2012 - 07:11 AM

View Postelcid534, on 21 October 2012 - 07:08 AM, said:

function f(distance_var)
  turtle.forward(distance_var)
end
f(2) -- 2 blocks
f(6) -- 6 blocks

This is incorrect. turtle.forward() does not accept arguments.

#7 Tjakka5

  • Members
  • 256 posts

Posted 21 October 2012 - 07:18 AM

View PostLyqyd, on 21 October 2012 - 07:11 AM, said:

View Postelcid534, on 21 October 2012 - 07:08 AM, said:

function f(distance_var)
  turtle.forward(distance_var)
end
f(2) -- 2 blocks
f(6) -- 6 blocks

This is incorrect. turtle.forward() does not accept arguments.

Yes, when I tried that, it didnt work.
Btw, my giant system is coming along nicely.

Currently working on turtle 1 of 17, and 87 lines of code on him...

#8 sjele

  • Members
  • 334 posts
  • LocationSomewhere on the planet called earth

Posted 21 October 2012 - 07:20 AM

Juste use a disk, to transfer code

#9 elcid534

  • Members
  • 16 posts

Posted 21 October 2012 - 07:25 AM

doesnt it accept arguments? oh well i rarely use turtles anyway thx for correcting me

#10 Tjakka5

  • Members
  • 256 posts

Posted 21 October 2012 - 07:31 AM

View Postsjele, on 21 October 2012 - 07:20 AM, said:

Juste use a disk, to transfer code

That wouldnt work because all the turtles do something different.

#11 sjele

  • Members
  • 334 posts
  • LocationSomewhere on the planet called earth

Posted 21 October 2012 - 07:34 AM

Ohh. I guess you have to make it then.
Good luck

#12 ChunLing

  • Members
  • 2,027 posts

Posted 21 October 2012 - 11:00 AM

Use a disk to open the turtle to accept a file over rednet, and then have the central controller send it.

#13 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 21 October 2012 - 11:03 AM

Would this work?

function f(distance_var)
  for i = 1,distance_var do
    turtle.forward()
  end
end
f(2) -- 2 blocks
f(6) -- 6 blocks


#14 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 21 October 2012 - 04:46 PM

View PostsIdEkIcK_, on 21 October 2012 - 11:03 AM, said:

Would this work?

function f(distance_var)
  for i = 1,distance_var do
    turtle.forward()
  end
end
f(2) -- 2 blocks
f(6) -- 6 blocks

Yes, that would work, providing the turtle had fuel to move eight spaces.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users