13 posts
Posted 12 July 2014 - 05:06 AM
I have been trying to control my stargate in the modpack Icehenge by TheMindCrafters for the Technic Launcher and was having issues with following the startup program:
sg = peripheral.wrap("Home Gate")
print("Please Enter An Address:")
address = read()
sg.dial(address)
I reboot the computer and everything seems normal, but then the following error pops up after I enter the stargate address:
startup:4: attempt to index ? (a nil value)
What could be the issue?
Thanks!
Edited on 14 July 2014 - 07:29 PM
31 posts
Location
Bodafors, Sweden
Posted 12 July 2014 - 09:42 AM
You can't put "Home Gate" as an argument in the peripheral.wrap function.
Type in wich side wich it's placed on according to the computer, ex: left, right, front, back, top, bottom. (Make sure it touches the computer)
Example:
sg = peripheral.wrap("left")
13 posts
Posted 13 July 2014 - 03:26 AM
I tried fixing the 'problem', but the same error shows up. i'm a noob at this, but doesn't startup:4: mean line four? and besides, i'm using a wired modem/cabling considering i'm making one computer for four stargates.
7508 posts
Location
Australia
Posted 13 July 2014 - 03:40 AM
Yes, startup:4 means line 4. however the attempt to index ? (a nil value) error occurs because on line 1 the peripheral wrapping is not returning a wrapped peripheral. this is because you've got the name wrong. once you attach your modem to the Stargate make sure you right click it to turn it on. once you've turned it on, there will be a name appear in the chat, something probably along the lines of stargate_0 this is the name that you must use in the peripheral.wrap call.
13 posts
Posted 14 July 2014 - 02:47 AM
I connected both modems to where in chat is says:
computer_(#) connected
startgate_(#) connected
The new issue is that now it says 'startup:4: attempt to call nil'
I'm getting better at understanding computercraft, but I knew already that this error only occurs when you are trying to use a non-existent function. :huh:/> What now?
7508 posts
Location
Australia
Posted 14 July 2014 - 02:59 AM
check what functions exist on the peripheral
local methods = peripheral.getMethods("startgate_#") --# replace the # with the number
print(table.concat(methods, ", "))
8543 posts
Posted 14 July 2014 - 07:13 AM
More concisely and with better formatting:
textutils.pagedTabulate(peripheral.getMethods("stargate_0"))
13 posts
Posted 14 July 2014 - 09:13 PM
<_</> I'm a blind idiot… sg.dial is not used as 'sg.dial(address)', but instead 'sg.dial("address")'. but thank you guys for helping me get through this quite frustrating, but simple, issue though! really helped :D/>