Posted 09 April 2013 - 07:40 PM
Hi there!
with the new 1.52 version making wireless modems requiring an enderpearl and the ability to remotely control peripherals through wires I find myself using only very little wireless modems. However to communicate with any turtle you will still need wireless modems on your computer.
So I've written a small program that only serves to form a communication bridge between wired and wireless networks:
http://pastebin.com/SY8dWUnJ
By default it will forward channels 1 through 128 but you can set custom channels as arguments, as long as you state a begin and end range, (For a single channel you can make the start and end of a range the same ofc) and don't want more than 128 channels. If you really need more channels you should just use a second computer.
Hope you like it! :)/>
with the new 1.52 version making wireless modems requiring an enderpearl and the ability to remotely control peripherals through wires I find myself using only very little wireless modems. However to communicate with any turtle you will still need wireless modems on your computer.
So I've written a small program that only serves to form a communication bridge between wired and wireless networks:
http://pastebin.com/SY8dWUnJ
tArgs = {...}
local wmodemSide,lines,count,channelCount = nil,0,0,0
if #tArgs % 2 ~= 0 then error("Please state a start and end of each range") end
for i = 1,#tArgs,2 do
channelCount = channelCount + tArgs[i+1] - tArgs[i] + 1
end
if channelCount > 128 then error("To many channels: You've opened "..channelCount.." while maximum is 128") end
for _,k in pairs(rs.getSides()) do
if peripheral.getType(k) == "modem" then
m = peripheral.wrap(k)
if m.isWireless() then
wmodem = peripheral.wrap(k)
wmodemSide = k
else
modem = peripheral.wrap(k)
end
end
end
term.clear()
term.setCursorPos(1,1)
print("Currently bridging between wire and wireless on channels:")
if tArgs[1] == nil then
print("1 - 128")
lines = 1
for i = 1,128 do
modem.open(i)
wmodem.open(i)
end
else
for i = 1,#tArgs,2 do
print(tArgs[i].." - "..tArgs[i+1])
lines = lines + 1
for j = tArgs[i],tArgs[i+1] do
modem.open(j)
wmodem.open(j)
end
end
end
print("Press Q to quit")
while true do
local event, mSide, sChannel, rChannel, msg, d = os.pullEvent()
if event == "modem_message" then
if mSide == wmodemSide then
modem.transmit(sChannel,rChannel,msg)
else
wmodem.transmit(sChannel,rChannel,msg)
end
term.setCursorPos(1,lines+4)
count = count + 1
print(count.." messages so far")
elseif event == "char" and mSide == "q" then
modem.closeAll()
wmodem.closeAll()
break
end
end
By default it will forward channels 1 through 128 but you can set custom channels as arguments, as long as you state a begin and end range, (For a single channel you can make the start and end of a range the same ofc) and don't want more than 128 channels. If you really need more channels you should just use a second computer.
Hope you like it! :)/>