3790 posts
Location
Lincoln, Nebraska
Posted 20 December 2012 - 06:15 PM
Different from this post:
http://www.computercraft.info/forums2/index.php?/topic/7323-addition-advance-modem/My suggestion was in concurrence with adding frequencies to ComputerCraft.
Make an advanced modem the same way, but instead of Stone, you use Gold. This would allow existing programs to be able to use the old functions through rednet, and open frequencies to Advanced Modems only.
By default, the normal modems would send an listen on frequency 0. Advanced modems would have a frequency range. I think somewhere around 256. (binary, lol)
Let me know if you think this is a good idea!
7508 posts
Location
Australia
Posted 20 December 2012 - 06:26 PM
So do you kinda mean like how we currently have routers in real life that broadcast on 2.4GHz and 5GHz?
3790 posts
Location
Lincoln, Nebraska
Posted 20 December 2012 - 06:35 PM
Yeah. Kinda like that. More like walkie-talkies though.
The low end models (non-advanced) would have the same frequency that you could not change, and the high end models would enable further customization.
A function like isModemAdvanced() or something could be added to check if a modem is advanced so that coders could write around the limitations.
724 posts
Posted 21 December 2012 - 04:12 AM
Not a bad idea, but not a very good really.
1. Please thinking about Rednet, think about "some communication mean", not about Modems only.
2. I think word "frequency" is bad here. Use "channel" instead. Just a word ;)/> but without that physical tie.
3. I like you leave old Modems without change. But new ones would barely change anything.
4. No need for "isModemAdvanced()". Just try to set channel any be ready for failure response.
3790 posts
Location
Lincoln, Nebraska
Posted 21 December 2012 - 06:02 AM
That could work. If you try to change the channel on a non advanced modem, it would return a failure event, or perhaps channel would just be nil, like when http is disabled. So it would read
if not channel then
print("No channel selection available")
return
else
--set channel
end
7508 posts
Location
Australia
Posted 21 December 2012 - 11:40 AM
actually i would expect some more like
if not modem.setChannel then
print("No channel selection available")
return
else
modem.setChannel(45)
end
724 posts
Posted 22 December 2012 - 08:23 AM
Normally you do not have "modem" variable. It's more like "rednet.open("right")".
But rednet can be able to translate rednet.setChannel(sPort, … ) to tPortPeripheral[sPort].setChannel( … )
3790 posts
Location
Lincoln, Nebraska
Posted 22 December 2012 - 08:28 AM
Hmmm, rednet.setChannel() would make more sense. It could return nil if there is either no modem attached, or no advanced modem attached.
You could have a computer broadcast on at least 6 separate channels separately at the same time.
724 posts
Posted 22 December 2012 - 08:36 AM
It could return nil (or false) if no Peripheral on that side. Else rednet should return what Peripheral return. And imho Peripheral should return success boolean and previous settings.
You could have rednet to use any Peripheral with all methods needed.