16 posts
Posted 10 April 2012 - 11:27 AM
i am trying to run a program which open all the different sides ,of my mining turtle, to allow rednet signals to it but i am having difficultly with this.
what i have so far:
rednet.open ("front")
rednet.open ("back")
rednet.open ("left")
rednet.open ("right")
rednet.open ("top")
rednet.open ("bottom")
rednet.broadcast ("testing")
end
when i run this i get:
bios:206: [string "rednet"]:8: '='
expected
but i do not know what this mean. please help.
1111 posts
Location
Portland OR
Posted 10 April 2012 - 11:34 AM
its due to the end, there is nothing for it to end.
Also turtles only have a modem on their right side so the only valid option to open is "right"
16 posts
Posted 10 April 2012 - 11:51 AM
thanks i thought that End ended the program
1111 posts
Location
Portland OR
Posted 10 April 2012 - 11:53 AM
In Lua it will run to the end of the script and then end, there is no way to end a program with a statement. End is used to for if statements, functions, while and for loops, etc.
16 posts
Posted 10 April 2012 - 11:57 AM
oh right. thanks for helping me now i can wright a bunch of programs now.
16 posts
Posted 10 April 2012 - 12:05 PM
i am trying to get my bot to run a program (command list) but it say
out:1: attempt to call nil
program:
Print ("going out")
turtle.turnLeft()
turtle.forward (2)
1111 posts
Location
Portland OR
Posted 10 April 2012 - 12:08 PM
Lua is case sensitive. Print should be print. Also turtle.forward() does not accept arguments. You will need to do either
turtle.forward()
turtle.forward()
or better a for loop
for x=1, 2 do
turtle.forward()
end
16 posts
Posted 10 April 2012 - 01:42 PM
thanks i did not know it's case sensitive
16 posts
Posted 10 April 2012 - 01:45 PM
it still says:
out:1: attempt to call nil
(i do not know what this means)
259 posts
Location
Australia
Posted 10 April 2012 - 03:07 PM
it still says:
out:1: attempt to call nil
(i do not know what this means)
i think it means that you added something that doesnt exist into your code :P/>/>
13 posts
Posted 10 April 2012 - 04:31 PM
You seem to be typing with a space between your command and the brackets for the arguments.
Rather then 'print ("something")', check over your code and make sure it looks like 'print("something")' with no spaces between 'print' (or any other command) and the brackets with the data inside
9 posts
Posted 10 April 2012 - 04:46 PM
You seem to be typing with a space between your command and the brackets for the arguments.
Rather then 'print ("something")', check over your code and make sure it looks like 'print("something")' with no spaces between 'print' (or any other command) and the brackets with the data inside
This has never gave me a issue. It's like assigning a variable. x=1 or x = 1 still works the same way.
1111 posts
Location
Portland OR
Posted 10 April 2012 - 09:28 PM
Ya Lua is not to picky about that i do print ("stuff") print "stuff" and print("stuff") and they all work.