Posted 03 March 2018 - 09:14 AM
I have been working for at least 5 or 6 hours now on an overall missile control system with ICBM. I did everything right except for the slave computers that connect to the silos. I have been trying to fix my code for the slave computer over and over again for about 30 minutes even looking online for help. I am trying to make a slave computer that continuously checks to see if the master computer, id 28, sends a serialised message to it. I then is supposed to unserialise it and then use the two variables that were serialised to set the target of the missile and then launch it. Everything it comes back with Failed to call a nil value. Please help me! I'm stuck! Thank you in advance.
rednet.open("left")
local csx = 0 --X co-ordinate
local csz = 0 --Z co-ordinate
local icbm = peripheral.wrap("right") --Link to the silo controller
while true do
id, msg = rednet.receive(id, msg) --Receive command from master
table = textutils.unserialise(msg) --Analyze msg
csx = table[1] --change x co-ordinate to the one sent
csz = table[2] --change z co-ordinate to the one sent
icbm.setTarget(csx,0,csz) --Set Target
sleep(1) --yield time
icbm.launch() --launch missile to set target
os.reboot()
end