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

Aaaaand... What did I do wrong here?

Started by Tjakka5, 21 October 2012 - 06:05 AM
Tjakka5 #1
Posted 21 October 2012 - 08: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.
sjele #2
Posted 21 October 2012 - 08:07 AM
You name a function like this,

function funcName()
--Code to do
end
funcName()
Lyqyd #3
Posted 21 October 2012 - 08: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()
elcid534 #4
Posted 21 October 2012 - 08:08 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.
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
Tjakka5 #5
Posted 21 October 2012 - 08:10 AM
And that is why I never use functions.

Thanks guys!
Lyqyd #6
Posted 21 October 2012 - 08:11 AM

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.
Tjakka5 #7
Posted 21 October 2012 - 08:18 AM

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…
sjele #8
Posted 21 October 2012 - 08:20 AM
Juste use a disk, to transfer code
elcid534 #9
Posted 21 October 2012 - 08:25 AM
doesnt it accept arguments? oh well i rarely use turtles anyway thx for correcting me
Tjakka5 #10
Posted 21 October 2012 - 08:31 AM
Juste use a disk, to transfer code

That wouldnt work because all the turtles do something different.
sjele #11
Posted 21 October 2012 - 08:34 AM
Ohh. I guess you have to make it then.
Good luck
ChunLing #12
Posted 21 October 2012 - 12:00 PM
Use a disk to open the turtle to accept a file over rednet, and then have the central controller send it.
remiX #13
Posted 21 October 2012 - 12:03 PM
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
Lyqyd #14
Posted 21 October 2012 - 05:46 PM
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.