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

Simple Chat Program

Started by DSlink2010, 28 September 2012 - 09:25 PM
DSlink2010 #1
Posted 28 September 2012 - 11:25 PM
Hi guys!I just made a really simple chat program!

Sender:

write "Username: "
user = io.read()
while true do
write "Message: "
mess = io.read()
rednet.broadcast(user, ": ", mess)
end
Reciever:

while true do
senderId, message, distance = rednet.receive()
print(message)
end

Its really simple…I will make it much better later!
Any suggestions?Post it!
Bye!
DSlink2010 #2
Posted 28 September 2012 - 11:26 PM
You can post…
Cranium #3
Posted 29 September 2012 - 12:15 AM
It looks good, but don't bump your own thread. Lotta people not on yet to see this stuff. Wait till the weekend, you'll get some more posts.
But again, good job, and welcome to the forums!
DSlink2010 #4
Posted 29 September 2012 - 03:04 AM
It looks good, but don't bump your own thread. Lotta people not on yet to see this stuff. Wait till the weekend, you'll get some more posts.
But again, good job, and welcome to the forums!
Ok, thanks!
DSlink2010 #5
Posted 29 September 2012 - 01:33 PM
It looks good, but don't bump your own thread. Lotta people not on yet to see this stuff. Wait till the weekend, you'll get some more posts.
But again, good job, and welcome to the forums!
Oh yeah, I like the code in you're signature!Its funny!
DSlink2010 #6
Posted 04 October 2012 - 09:12 PM
Guys, when are you gonna post…
Cranium #7
Posted 04 October 2012 - 10:22 PM
Post some challenging code, man. Make an email system with total security.
DSlink2010 #8
Posted 05 October 2012 - 02:08 AM
Post some challenging code, man. Make an email system with total security.
Seems too hard.
If you can give me a way to hold the message if the computer is shutdown then I'll do it.
sjonky #9
Posted 05 October 2012 - 02:12 AM
Check out the Fs API Then you can save the messages to a file, then you woun't loose the messages when you shutdown.
DSlink2010 #10
Posted 06 October 2012 - 03:59 PM
Check out the Fs API Then you can save the messages to a file, then you woun't loose the messages when you shutdown.
You don't get it.The prob is when you send to a computer thats off.
bbqroast #11
Posted 08 October 2012 - 10:01 AM
Check out the Fs API Then you can save the messages to a file, then you woun't loose the messages when you shutdown.
You don't get it.The prob is when you send to a computer thats off.
Then don't post to a computer that is off. Use a mail server, when a message is sent, every 5 minutes, or when the client is turned on. The client connects to the server and sends the waiting messages, and asks the server to send it any mail. That way you can send mail to offline computers, and if the server is off the client just waits for it to come on before sending/receiving.
Cranium #12
Posted 08 October 2012 - 03:33 PM
I am setting up my mail system with a centralized server for handling of messages. The client sends an "ident" request, and if it receives one, then that computer ID it received from becomes the host. If it does not receive a specific response, the computer will stop pinging the host.
brett122798 #13
Posted 08 October 2012 - 10:59 PM
Very nice, that's the very basic chat program, then you make things more advanced! By the enthusiasm of this, you're probably new to lua, so read up on stuff if you want to make awesome things. For a chat program, if you don't already know, this code is useful beyond belief:


while true do
parallel.waitForAny(receiver, input)
end
DSlink2010 #14
Posted 13 October 2012 - 01:14 AM
Very nice, that's the very basic chat program, then you make things more advanced! By the enthusiasm of this, you're probably new to lua, so read up on stuff if you want to make awesome things. For a chat program, if you don't already know, this code is useful beyond belief:


while true do
parallel.waitForAny(receiver, input)
end
Dude.I do much more advanced stuff, in C#, its harder.
NOTUSEDPLEASEDELETE #15
Posted 16 August 2013 - 06:29 PM
Very nice, that's the very basic chat program, then you make things more advanced! By the enthusiasm of this, you're probably new to lua, so read up on stuff if you want to make awesome things. For a chat program, if you don't already know, this code is useful beyond belief:


while true do
parallel.waitForAny(receiver, input)
end
Dude.I do much more advanced stuff, in C#, its harder.
The parallel API lets you do 2 things at once like sending a message and receiving one. Here's some code for a chat client:

while true do
parallel.waitForAny(rednet.broadcast(user, ":", mess), print(rednet.receive))
end
1lann #16
Posted 17 August 2013 - 03:03 AM
Dude.I do much more advanced stuff, in C#, its harder.
Well then show us you can do more advanced stuff! Cause so far:

while true do
senderId, message, distance = rednet.receive()
print(message)
end
Isn't really advanced… at all…
Robotonic #17
Posted 17 August 2013 - 09:49 AM
"Posted 12 October 2012"
Yeah, this is really old guys.
ETHANATOR360 #18
Posted 17 August 2013 - 04:33 PM
we need a pop up warning that says if your about to necro a post
shun_0109_Japan #19
Posted 23 August 2013 - 01:47 AM
Google Translator:
I am Japanese, I'm sorry.
I'd made ​​the program,
Due to a change in specification?
Is no longer available.
This is a diffusion network system
Do you want to be able to use what if?

We apologize for the inconvenience as we have not yet get used to it, thank you please.



[php]rednet.open("モデムの方向")
while true do
local event, p1, p2, p3, p4, p5 = os.pullEvent("rednet_message")
id = p2
write("id:")
print(id)
local event, p1, p2, p3, p4, p5 = os.pullEvent("rednet_message")
content = p2
write("content:")
print(content)
rednet.broadcast(id)
rednet.broadcast(content)
sleep(1)
end[/php]
Mitchfizz05 #20
Posted 23 August 2013 - 08:27 AM
Google Translator:
I am Japanese, I'm sorry.
I'd made ​​the program,
Due to a change in specification?
Is no longer available.
This is a diffusion network system
Do you want to be able to use what if?

We apologize for the inconvenience as we have not yet get used to it, thank you please.



[php]rednet.open("モデムの方向")
while true do
local event, p1, p2, p3, p4, p5 = os.pullEvent("rednet_message")
id = p2
write("id:")
print(id)
local event, p1, p2, p3, p4, p5 = os.pullEvent("rednet_message")
content = p2
write("content:")
print(content)
rednet.broadcast(id)
rednet.broadcast(content)
sleep(1)
end[/php]

Does it work if you do rednet.open("モデムの方向")?
Anyways, thanks for translating your message. :)/>