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

Command Block Isn't Working Anymore.

Started by CCJJSax, 03 November 2013 - 12:56 AM
CCJJSax #1
Posted 03 November 2013 - 01:56 AM
I had this working just fine, now I cant seem to figure out what is returning nil.


commandBlock = peripheral.wrap("top")
commandBlock.setCommand("/give @p 1 64")

Now it errors on line 2 saying "lua:52: attempt to call nil" Is it just failing to wrap the peripheral?

Berfore you ask, YES. command block support is enabled in the config.
Lyqyd #2
Posted 03 November 2013 - 02:15 AM
Figure out what's actually in the table that's getting returned. Do you have OpenPeripheral installed?
CCJJSax #3
Posted 03 November 2013 - 12:52 PM
Figure out what's actually in the table that's getting returned. Do you have OpenPeripheral installed?

Yes I do. I'm not sure what the table would be tbh.

Edit: I had it print out commandBlock and that returned a table and a 1.
Lyqyd #4
Posted 03 November 2013 - 02:19 PM
Run this and paste the resulting output here:


local cb = peripheral.wrap("top") --# assuming your command block is still on top.
for k, v in pairs(cb) do
  print(k)
end

Did you install OpenPeripheral around the time that function stopped working? I have the feeling that that table is going to only show "listMethods". If that's the case, you'll need to uninstall OpenPeripheral, or install a more recent version. I think they've fixed that by now.
CCJJSax #5
Posted 03 November 2013 - 07:53 PM
Run this and paste the resulting output here:


local cb = peripheral.wrap("top") --# assuming your command block is still on top.
for k, v in pairs(cb) do
  print(k)
end

Did you install OpenPeripheral around the time that function stopped working? I have the feeling that that table is going to only show "listMethods". If that's the case, you'll need to uninstall OpenPeripheral, or install a more recent version. I think they've fixed that by now.

All the mods I have installed were installed at once awhile back. (direwolf20 1.5 v2). The error started happening after my game crashed for a "ticking memory exception" or something like that.

running that code you gave me it returned as this


getCommand
runCommand
setCommand
CCJJSax #6
Posted 03 November 2013 - 07:55 PM
Wait… Now that I broke and replaced the command block, it seems to be working… That was unexpected actually…
spdkils #7
Posted 04 November 2013 - 06:39 PM
You don't need / in the command block…

That may have been the problem the whole time.

'time set day'
CCJJSax #8
Posted 04 November 2013 - 07:17 PM
You don't need / in the command block…

That may have been the problem the whole time.

'time set day'

If that's true then it works either way. Breaking the command block and replacing it made the code work just fine. even with the /