Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / How to make chat

Author
Message
The Lynx
20
Years of Service
User Offline
Joined: 24th May 2004
Location: Pluto!
Posted: 20th Aug 2004 14:43
Hey,

I was wondering how I would do this; make it so the user can say messages, just like a chat room, and display their name. Would it be used using input, and then print it (so it'll store the message in the window). Any help is greatly appreciated .

Also, btw, I'm not planning on making an online chatroom or anything, I am merely wanting to know. Thanks again.

Oh no! Chrissy had used her powers to turn herself into a hideous man-eating giant!
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 20th Aug 2004 21:58
Well, you wouldnt use input because it is application-modal, meaning when you call input command all execution of your program halts until the user dismisses the input, so thats not good. You need to detect keystrokes, and build a string char by char in the main loop, as the user types - without hanging your main loop so you can also deal with receiving messages as well.
To display messages in a scrolling line by line fashion use a string array. Each client should set its own nickname, and when they send the data concatenate the nick to the front of the messages like:

SendMessage(sNick + ": " + sMessage)

hope that gets you started


DBP_NETLIB_v1.4.3 - 65 FREE Functions * Click Logo
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 21st Aug 2004 00:32
in DarkTOPIA client I use a string array to hold text messages, when a new message arrives I pass it into a BumpMessages() function that simply shifts all of the array elements up 1 position - so string in index 1 moves to 0, 2 goes to 1, 3 goes to 2 etc etc until the las element, it shifts to the second to last element, then the Newest message is placed in the last element of the array. Now just set cursor and print the elements of the array to the screen. As you type an send/rcv messages they will scroll like in a chatroom.


DBP_NETLIB_v1.4.3 - 65 FREE Functions * Click Logo
The dude guy
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: In the streets of sasatuin
Posted: 21st Aug 2004 00:39
Here's one I found to help Hell Dragonz43 Hope it helps you too!



Andrew Tamalunas
The Lynx
20
Years of Service
User Offline
Joined: 24th May 2004
Location: Pluto!
Posted: 21st Aug 2004 07:52
CattleRustler- Thanks for the help! I have studied what you were talking about, and had a chat with Eoin and I am confident I can make one myself .
Sadly I am using DBC , and a trial version of DBP until I can buy it.

Burnhard- Thank you for that! It gave me a basic idea of how to do this...

The dude guy- Thank you, but I've already looked over that, I only have the trial version of DBP though, so nothing really useful can be done except learn from it.

I'll be posting the code here when I finish (if I finish). Wish luck!

Oh no! Chrissy had used her powers to turn herself into a hideous man-eating giant!

Login to post a reply

Server time is: 2024-09-22 21:25:46
Your offset time is: 2024-09-22 21:25:46