259 posts
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.
8543 posts
Posted 03 November 2013 - 02:15 AM
Figure out what's actually in the table that's getting returned. Do you have OpenPeripheral installed?
259 posts
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.
8543 posts
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.
259 posts
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
259 posts
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…
49 posts
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'
259 posts
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 /