SysoevDV 0 Posted November 4, 2015 Share Posted November 4, 2015 Hi.Please tell me why when I use the command block (via the adapter) for some reason it is not allowed to set its value.Example (from Wiki): local component = require("component") local cb = component.command_block local ticks = math.floor(1000/60/60 * os.time() - 6000) print(os.date()) cb.setValue("time set " .. (ticks + 24000)) cb.run() print(os.date()) And I get an error: /command:8: attempt to call field 'setValue' (a nil value) stack traceback: /command:8: in main chunk (..tail calls..) So how do I get a command block to execute commands through OC?Thank you in advance for your answers! Quote Link to post Share on other sites
0 Gangsir 14 Posted November 4, 2015 Share Posted November 4, 2015 It's possible that this functionality was removed, since you're looking at the old wiki and I can't find anything about it on the new one, which is at: http://ocdoc.cil.li If you need to execute commands via computers, you could take a look at (and likely use) the debug card's component: http://ocdoc.cil.li/component:debug Quote Link to post Share on other sites
0 dgelessus 26 Posted November 10, 2015 Share Posted November 10, 2015 The command block component interaction is disabled by default in the config, you need to enable it manually. Though as far as I know it does nothing that the debug card can't do, so you could just use that instead. Quote Link to post Share on other sites
0 Fingercomp 37 Posted November 16, 2015 Share Posted November 16, 2015 Command blocks has three methods: cb.setCommand(command) cb.getCommand() cb.executeCommand() So your code must look like this: local component = require("component") local cb = component.command_block local ticks = math.floor(1000/60/60 * os.time() - 6000) print(os.date()) cb.setCommand("time set " .. (ticks + 24000)) cb.executeCommand() print(os.date()) If command block driver was disabled in the config, this program would crash with error "no such component". P. S. This wiki is outdated, use ocdoc.cil.li. Quote Link to post Share on other sites
Hi.
Please tell me why when I use the command block (via the adapter) for some reason it is not allowed to set its value.
Example (from Wiki):
And I get an error:
So how do I get a command block to execute commands through OC?
Thank you in advance for your answers!
Link to post
Share on other sites