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..
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!
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";
}
Thank you for your time!