so i always get this: bios:14:[ string "autohouse"]:3: '<name>' expeced
P = read()
B = read()
function ("rogi")
turtle.select(1)
turtle.place()
turtle.up()
turtle.place()
turtle.up()
turtle.place()
turtle.down()
turtle.down()
turtle.down())
end
function ("normalna sciana")
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
turtle.select(2)
turtle.place()
turtle.up()
turtle.select(3)
turtle.place()
turtle.up()
turtle.place()
turtle.down()
turtle.down())
end
function ("obrot")
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
turtle.forward()
turtle.turnLeft())
end
rogi
B = B-2
for i=1,B do
normalna sciana
0
2 replies to this topic
#1
Posted 26 February 2017 - 01:12 PM
#2
Posted 26 February 2017 - 10:45 PM
Try this:
You need the brackets '()' to show that it is a function and not a string/other type. Also, you don't need "rogi" as it defines it as a string and not a function. That would break it
Do the same for your other functions as well.
Or whatever you want to name them. Remember that you cannot have spaces in the names of functions. It doesn't like it
Also, when you initialize B do it like this:
Ignore the />'s, they are automatically put there. Don't put them in your code.
When you put a number into read() it still keeps it as a string, like so:
But you want it to be:
Otherwise it won't see it as a number but a string.
Another thing, with the for loop, it needs to be set out like this:
function rogi() -- rogi() is the name of the function -- Your Rogi function code here end -- ... rogi() -- Calls the function you created earlier
You need the brackets '()' to show that it is a function and not a string/other type. Also, you don't need "rogi" as it defines it as a string and not a function. That would break it
Do the same for your other functions as well.
function obrot() -- Your code end function normlna_sciana() -- Your code end
Or whatever you want to name them. Remember that you cannot have spaces in the names of functions. It doesn't like it
Also, when you initialize B do it like this:
local B = read() B = tonumber(B)/>
Ignore the />'s, they are automatically put there. Don't put them in your code.
When you put a number into read() it still keeps it as a string, like so:
"0" -- Example
But you want it to be:
0 -- Example
Otherwise it won't see it as a number but a string.
Another thing, with the for loop, it needs to be set out like this:
for i=1,B do -- Starts at 1, goes until it hits the value of B e.g. 6 normalna_sciana() end -- Remember to end it as well
Edited by Dave-ee Jones, 26 February 2017 - 10:46 PM.
#3
Posted 28 February 2017 - 08:52 AM
For more on correctly defining functions, try this tutorial.
Try disabling emoticons within the full post editor.
Dave-ee Jones, on 26 February 2017 - 10:45 PM, said:
Ignore the />'s, they are automatically put there.
Try disabling emoticons within the full post editor.
Edited by Bomb Bloke, 28 February 2017 - 08:53 AM.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users