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

help with command list program

Started by chowder64, 10 April 2012 - 09:27 AM
chowder64 #1
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.
Luanub #2
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"
chowder64 #3
Posted 10 April 2012 - 11:51 AM
thanks i thought that End ended the program
Luanub #4
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.
chowder64 #5
Posted 10 April 2012 - 11:57 AM
oh right. thanks for helping me now i can wright a bunch of programs now.
chowder64 #6
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)
Luanub #7
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
chowder64 #8
Posted 10 April 2012 - 01:42 PM
thanks i did not know it's case sensitive
chowder64 #9
Posted 10 April 2012 - 01:45 PM
it still says:
out:1: attempt to call nil
(i do not know what this means)
djblocksaway #10
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/>/>
oreillynz #11
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
dylan #12
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.
Luanub #13
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.