This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
StevenW129's profile picture

Rednet System

Started by StevenW129, 26 August 2012 - 11:09 PM
StevenW129 #1
Posted 27 August 2012 - 01:09 AM
Hello

So ive been playing with this amazing mod and I would love to learn more about the rednet system. Theres one thing I really want to do and thats to program many monitors but have it all running from one computer so lets say I have 4 2x1 monitors and I want to have text on all of them but I want it to be different for each one but have all the code on one computer how would I do this?

I have a slight idea of what to do but can you give me some example code to help me?

Thanks so much and I love this mod!

-Steven
funkey100 #2
Posted 27 August 2012 - 01:16 AM
I think this might work but I'm not sure…

lMon = peripheral.wrap("left")
rMon = peripheral.wrap("right")
uMon = peripheral.wrap("up")
lMon.write("A")
rMon.write("B")
uMon.write("C")

Tell me if I helped you!
StevenW129 #3
Posted 27 August 2012 - 01:19 AM
No I mean i have 1 computer somewhere with a modem attached and monitors in different locations away from the computer all with modems attached so I want to be able to send the data to those monitors from 1 computer
funkey100 #4
Posted 27 August 2012 - 01:54 AM
Ohhhh. Well, the only way to do that is to have 4 computers, 3 of them listen and do whatever the master computer does. So assuming the master computer's ID is 0 and the slave computer's ID's are 1,2, and 3, this is the program:

Master Computer:

side = "top" --Modem side here
function main()
while true do
write("Computer ID: ")
CID = read()
write("nCode to send: ")
data = read()
rednet.open(side)
rednet.send(CID,data)
rednet.close(side)
end
end

main()



Slave Computer:

side = "top" --Modem side here

function main()
term.redirect(peripheral.wrap("top")) --Side of monitor
while true do
rednet.open(side)
id, msg = rednet.receive()
rednet.close(side)
file = io.open("data", "w")
file:write(msg)
file:close()
shell.run("data")
fs.delete("data")
end
end

main()

Tell me if it works!
DisFunqTional #5
Posted 27 August 2012 - 06:21 AM
i have an abandoned internet system that uses rednet, it all runs from a server, and ther server has a database, kinda..

if you want the code you could make it suit what you want?
funkey100 #6
Posted 27 August 2012 - 08:31 PM
Did you try out my code and did it work?
Sammich Lord #7
Posted 27 August 2012 - 09:19 PM
I was making a example program for you, I was coding on pastebin but it deleted the paste and gave a error when I submitted it.
So I won't rewrite it.
@funkey100 Your code will not work it will give a error since you didn't tonumber the ID input.
funkey100 #8
Posted 27 August 2012 - 09:39 PM
Your right i'm so stupid! So you just have to put this:
rednet.send(tonumber(CID),data)
instead of this:
rednet.send(CID,data)