Posted 28 December 2013 - 09:30 AM
I know about the basic range of wireless modems, but what about up and down? Could a max-alt computer still communicate with one on the ground in a thunderstorm and vice-versa?
function getChannels(side, startChan, endChan)
openChannels = {}
if startChan == nil and endChan == nil then
startChan = 1
endChan = 128
elseif startChan ~= nil and endChan == nil then
endChan = startChan-127
elseif endChan-startChan > 127 then
error("Not possible to have more than 128 channels open at once", 2)
end
elseif side == nil then
(find peripherals and check if they are modems)
elseif type(side) == "string" then
modem = peripheral.wrap(side)
elseif type(side) == "table" then
modem = side
end
for i = startChan, endChan do
chanOpen = modem.isOpen(i)
if chanOpen ~= nil then
openChannelCurNumber = #openChannels
openChannelSetNumber = openChannelCurNumber+1
openChannels[openChannelSetNumber] = i
chanOpen = nil
end
end
end
I think this may solve my problem, but I am going to make sure…
function modem.getChannels(side, startChan, endChan)
side.isOpen()
or would I have to do this:
function modem.getChannels(self, startChan, endChan)
modem.isOpen()
or this:
function modem.getChannels(self, startChan, endChan)
self.isOpen()
or is it some other way?