Posted 25 March 2012 - 08:45 PM
Sender Code:
http://pastebin.com/VP34mJJe
Receiver Code:
http://pastebin.com/yMPyvvNu
Need Wireless Redstone mod but too lazy to install? Use this code.
First argument of the programs = Frequency
http://pastebin.com/VP34mJJe
Spoiler
local tArgs = { ... }
if #tArgs == 0 then
print( "Usage: WRB <frequency>" )
return
end
local input = shell.resolve( tArgs[1] )
local lol = {"front","back","top","bottom","left","right"}
for i = 1,6 do
rednet.open(lol[i])
end
while true do
event, p1 = os.pullEvent()
if event == "redstone" then
if rs.getInput("right") or rs.getInput("left") or rs.getInput("top") or rs.getInput("bottom") or rs.getInput("back") or rs.getInput("front") == true then
rednet.broadcast("WirelessRS"..tostring(input))
end
if rs.getInput("front") ~= true then if rs.getInput("back") ~= true then if rs.getInput("right") ~= true then if rs.getInput("left") ~= true then if rs.getInput("top") ~= true then if rs.getInput("bottom") ~= true then
rednet.broadcast("WirelessRS0")
rednet.broadcast("WirelessRS"..input)
end end end end end end
end
end
Receiver Code:
http://pastebin.com/yMPyvvNu
Spoiler
local tArgs = { ... }
if #tArgs == 0 then
print( "Usage: WRR <frequency>" )
return
end
local input = tonumber(shell.resolve( tArgs[1] ))
local lol = {"front","back","left","right","top","bottom"}
for i = 1,6 do
rednet.open(lol[i])
end
while true do
local id, msg = rednet.receive()
if string.sub(msg,1,10) == "WirelessRS" then
if tonumber(string.sub(msg,11)) == input then
for i = 1,6 do
rs.setOutput(lol[i], true)
end
end
end
if string.sub(msg,1,11) == "WirelessRS0" then
local hmm, hmmw = rednet.receive()
if tonumber(string.sub(hmmw,11)) == input then
for i = 1,6 do
rs.setOutput(lol[i], false)
end
end
end
end
Need Wireless Redstone mod but too lazy to install? Use this code.
First argument of the programs = Frequency