Custom chat box
-
- Posts: 52
- Joined: Sun Jul 04, 2010 4:53 am
Custom chat box
Hey guys, I don't know if this is possible, but I want to create a custom IRC style chat box for my website. One where you can have private conversations with people, and I want a special function, where lets says if someone typed /rolld20 it would activate a function that chose a random number between 1 and 20 and it would then print "Username" rolled a "#". If anyone thinks that this is possible, or knows how to script it. Shoot me a private message and we can talk.
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Custom chat box
There are literally thousands of applications available for javascript-based chat (it is one of the most common uses of AJAX out there today). Here is a good one that is used on MMORPGMaker.com, and it is free and open source.
I suggest to simply use an existing open source application for your chat, and code any unusual functionality you may need into the existing codebase. To get advanced features in a from-scratch chat program is truly more complex than it seems. If you really, really want to make it yourself from scratch (and there is almost no reason for doing so) then try downloading a few of the free, open source programs and study how they work. If you just want the practice at making a small, no-frills chat program that you can build on yourself, check out the tutorial I linked in the Tutorials forum.
I suggest to simply use an existing open source application for your chat, and code any unusual functionality you may need into the existing codebase. To get advanced features in a from-scratch chat program is truly more complex than it seems. If you really, really want to make it yourself from scratch (and there is almost no reason for doing so) then try downloading a few of the free, open source programs and study how they work. If you just want the practice at making a small, no-frills chat program that you can build on yourself, check out the tutorial I linked in the Tutorials forum.
The indelible lord of tl;dr
-
- Posts: 52
- Joined: Sun Jul 04, 2010 4:53 am
Re: Custom chat box
Ok Jack thanks, so with this AJAX chat I can easily implement a function where the player merely has to type like /rolld20 and it can pull a script that picks a random number between 1-20 and prints it out?
-
- Posts: 52
- Joined: Sun Jul 04, 2010 4:53 am
Re: Custom chat box
Ok looking at some of the screenshots on the page, it looks like it is already implemented.
-
- Posts: 52
- Joined: Sun Jul 04, 2010 4:53 am
Re: Custom chat box
Is there any way to do this that doesnt require a server?
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Custom chat box
What do you mean "a server"? Of course it will require a web server, but does that application require an actual executable server? If so, I was not aware of that, but come to think of it, it may actually require one since it seemed to be real-time and not done through "polling". If it does actually require server software to be installed, just Google "AJAX chat" and you will find hundreds of other options, some of which are 100% PHP on the server end and could be hosted through a standard web host. However, you will have to accept a certain amount of lag and high bandwidth usage for AJAX/PHP chat since AJAX polling is a very inefficient way to handle it (the server has no way to "push" data to the client in this setup, so the client must ask the server for updates through AJAX on a set interval, meaning that connections to the server are occurring constantly, even when no one is chatting). All other options, including Comet, WebSockets, Flash, Silverlight, etc. all require dedicated server software that cannot be run on a standard web host.
EDIT: I looked at the chat program I linked, and it just seems to mention that you can use Flash and Ruby to boost performance if you want to, in which case you would need a dedicated server. However, the way I read it, it doesn't seem like you have to use those components, and can run it in standard AJAX/PHP mode.
EDIT: I looked at the chat program I linked, and it just seems to mention that you can use Flash and Ruby to boost performance if you want to, in which case you would need a dedicated server. However, the way I read it, it doesn't seem like you have to use those components, and can run it in standard AJAX/PHP mode.
The indelible lord of tl;dr
- PaxBritannia
- Posts: 680
- Joined: Sun Apr 18, 2010 1:54 pm
Re: Custom chat box
What about a P2P solution?Jackolantern wrote:Of course it will require a web server,

pax.
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Custom chat box
I have to say I have no idea. I have not looked into any P2P options for really anything like that. Do you know of anything out there?PaxBritannia wrote:What about a P2P solution?Jackolantern wrote:Of course it will require a web server,![]()
pax.
The indelible lord of tl;dr
- PaxBritannia
- Posts: 680
- Joined: Sun Apr 18, 2010 1:54 pm
Re: Custom chat box
Well, I've looked around before but there I haven't found one pure P2P solution.
Most rely on a web-server to establish the connection (relay ip addresses, etc.) But since the game will be hosted on a server, you could still implement these centralised P2P chat boxes and greatly reduce the load on the server.
pax.
Most rely on a web-server to establish the connection (relay ip addresses, etc.) But since the game will be hosted on a server, you could still implement these centralised P2P chat boxes and greatly reduce the load on the server.
pax.
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Custom chat box
I think creating something like that is a bit beyond my area of expertise, but I would be interested if a solution like that sprang-up!
The indelible lord of tl;dr