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

CommandBlock API don't working?

Started by Konlab, 27 May 2014 - 11:28 AM
Konlab #1
Posted 27 May 2014 - 01:28 PM
Hi!
I created a program, that changes the commandBlock's command.
I enabled CommandBlock in config file, and this is the code:
comm = peripheral.wrap("right")
comm.setCommand("/give Konlab 1 64")
the error is: test:2:attempt to call index
theoriginalbit #2
Posted 27 May 2014 - 03:37 PM
that seems to me like there isn't a command block on the right of the computer when you're looking at the front of the computer… open up the Lua prompt and tell us what this code outputs?

peripheral.getType("right")
Konlab #3
Posted 27 May 2014 - 03:45 PM
The error is in the 2. Line
Lyqyd #4
Posted 27 May 2014 - 05:30 PM
Did you try what he said? He's right about what the problem looks like, so it would be helpful for you to follow the advice given and report back with the results. You asked for help, help is being given. Don't dismiss it because you think he's wrong; if you knew what the problem was, you wouldn't need help.
valithor #5
Posted 27 May 2014 - 05:42 PM
It gives the same error if command blocks are not enabled in the computercraft.config to be used as a peripheral in a server, which is where i expect he is attempting to do this.
vifino #6
Posted 27 May 2014 - 06:01 PM
Just do what he said…
It should work, make sure you got the sides right.
Konlab #7
Posted 28 May 2014 - 11:28 AM
that seems to me like there isn't a command block on the right of the computer when you're looking at the front of the computer… open up the Lua prompt and tell us what this code outputs?

peripheral.getType("right")
Its 'command'