Here is the code I have for the receiving computer:
rednet.open('top') main=311 side='bottom' function printState() --term.clear() --term.setCursorPos(0,0) print('') print('Boreing 2.0') if getState() then print('Batteries: active') else print('Batteries: inactive') end end function createFile() if not fs.exists('config') then f=fs.open('config','w') f.writeLine('false') f.close() end end function getState() f=fs.open('config', 'r') local state=f.readLine() f.close() return state end function saveState(state) f=fs.open('config', 'w') f.writeLine(state) f.close() end function setOutput(state, side) if getState() then rs.setOutput(side, false) printState() elseif not getState() then rs.setOutput(side, true) printState() end end function command() --setOutput(not getState(), side) rs.setOutput(side, not getState()) while true do a, id, msg, dist=os.pullEvent('rednet_message') if id==main then write(id..' says ') print(msg) saveState(not getState()) rednet.send(main, state, true) end end end printState() createFile() command()And this is the code for the sending computer:
args={...} rednet.open('top') print(args[1]) rednet.send(309, args[1], true) a, id, msg, d=os.pullEvent('rednet_message') print(msg) rednet.close('top')Whenever I have the acting computer running, no matter what the config file says the state is, it is always active.
And when the sending computer sends, the receiving gets the correct msg and prints it, but instead of printing what the receiving computer told it to, the msg is just blank. Any suggestions?
Edited by Himself12794, 08 November 2013 - 01:03 PM.