Perl, color in between signs

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Tesh

Thread Starter
Joined
Jul 19, 2005
Messages
1
Hello.

I have a perl chat running on my website (Ralf Chat), and I would like to add a feature, but I'm a little clueless as where to start.

The feature I have in mind is to make a specific part of a message appear in a different color than the rest. In this case, it would be the text typed that is in between stars (*). So if a message goes like this...

Hello! *waves*

Then "Hello!" is typed out in say, black, and "*waves*" appear in green automatically. Like this:

Hello! *waves*

I'm guessing this would require string manipulation of some kind? I've seen other chatrooms use this feature, but they were all manually added later, so I haven't been able to get a code for this. The part of the chat script that seems to handle text output looks like this..

Code:
		$pm_message = &wash_msg($pm_message);
		$msg = "<B>$pm_from</B> says:<br> $pm_message<br>";
	} elsif ($pm_type eq "private") {
		$pm_message = &wash_msg($pm_message);
		$msg = "<B>*$pm_from* whispers to you:</B> $pm_message";
	} elsif ($pm_type eq "private_out") {
		$pm_message = &wash_msg($pm_message);
		$msg = "<B>You whisper to $pm_from:</B> $pm_message";
	} elsif ($pm_type eq "action") {
		$msg = "$pm_message";
	} elsif ($pm_type eq "command") {
		$msg = "<B>[$pm_from]</B> $pm_message";
	} elsif ($pm_type eq "memo") {
		$msg = "<B>[$pm_from]</B> $pm_message";
	} elsif ($pm_type eq "me") {
		$pm_message = &wash_msg($pm_message);
		$msg = "<B>*$pm_from $pm_message</B>";
	} elsif ($pm_type eq "plain") {
		$msg = "$pm_message";
	}
I'm sorry if my explenation is bad. I have done minor changes and modifications to the chat, but my programming skills aren't that advanced. It would be great if anyone could help me or give me hints.

Thank you for your time!
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Members online

Top