Posted 28 April 2012 - 03:41 PM
This is an IRC style chat program using the rednet.
I welcome any ideas for improvements/ constructive criticism.
And also the broadcasting tower code that I use:
I welcome any ideas for improvements/ constructive criticism.
tower = 28 --The id of the broadcasting tower that you want to use
rednetside = "top" -- the side that the router is on.
term.clear()
term.setCursorPos(1,1)
print("Kylergs's IRC Program")
count = 2
line = 2
rednet.open(rednetside)
input = ""
x,y=term.getSize()
my = y-3
while true do
event, id, mess = os.pullEventRaw()
if event == "rednet_message" and id==tower then
if count > my then
term.scroll(1)
else
line = line+1
end
term.setCursorPos(1, line)
write(id.." :"..mess)
count = count+1
elseif event =="char" then
term.setCursorPos(1, y)
input = input..id
write(input)
elseif event=="key" and id ==28 then
rednet.send(tower,input)
term.setCursorPos(1,y)
term.clearLine()
input=""
end
end
And also the broadcasting tower code that I use:
rednet.open("top")
while true do
event,id,msg= os.pullEvent("rednet_message")
rednet.broadcast(msg)
print(id.." : "..msg)
sleep(0.1) -- This is to get rid of feedback loops that I was getting between towers.
end