Viktor_Berg Posted September 25, 2013 Posted September 25, 2013 No, not really. CC rednet requires unique code, with rednet broadcasting/sending/receiving or listening. In your case, I'd probably stick with what you have right now. Quote
KiwiUSA Posted September 25, 2013 Posted September 25, 2013 So in short I don't have to change anything about these codes. So here they are. I went over them, and I can't see anything wrong. It looks fine to me. But here they are, maybe you or someone can find the issue. Sender Code: (computer attached to engines) rednet.open("left") while true do shell.run("clear") if rs.getInput ("back") then rednet.send(21,"engines on") else rednet.send(21,"engines off") end os.pullEvent("redstone") end Receiver code: (main computer with monitor) rednet.open("top") local engine_state = false mon = peripheral.wrap("back") while true do id, message = os.pullEvent("rednet_message") if id == 17 then if message == "engines on" then engine_state = true elseif message == "engines off" then engine_state = false end end mon.clear() mon.setCursorPos(5,5) if engine_state == true then mon.write("Engines: On") else mon.write("Engines: Off") end end I can't test this at the moment, but I think the syntax of os.pullEvent returns the Event as the first parameter: Common syntax event, param1, param2, param3 = os.pullEvent() So I would try: event, id, message = os.pullEvent("rednet_message") Quote
Reece C. Posted September 25, 2013 Author Posted September 25, 2013 I can't test this at the moment, but I think the syntax of os.pullEvent returns the Event as the first parameter: So I would try: event, id, message = os.pullEvent("rednet_message") This looks almost identical to the code I used. I don't see much, if any difference between the two. Quote
Reece C. Posted September 25, 2013 Author Posted September 25, 2013 Well, I just switched out my networking cables for a wireless modem, and the code still works. So yeah. Quote
phazeonphoenix Posted September 25, 2013 Posted September 25, 2013 The naming is confusing. rednet as Reece is using is strictly about inter-computer communication over (it seems) multiple transmission mediums, wired and wireless. It's not the same as using RedNet Cables with their 16 colors. Yes one could have implemented this with RedNet Cable and that would have been a bit more straight forward to figure the coding portion out since you're testing physical lines for on or off state. This is simply a different way to implement the same thing. It's more powerful than using RedNet cables because you could very easily code something that might have more than on or off states, eg auto, manual, off. Also you would not be limited to running physical lines between all of your outposts. It just requires more know-how to implement. Quote
phazeonphoenix Posted September 27, 2013 Posted September 27, 2013 Oh Reece, I simply meant that since this topic mostly turned into a discussion between the two of us that technically could have taken place in PMs, could you post the basic code that finally worked with engine_state and buffer_state so that everyone could benefit. :) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.