There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer connection cpu crash css dell desktop dma driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express pio problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
Perl, color in between signs


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
Tesh's Avatar
Junior Member with 1 posts.
 
Join Date: Jul 2005
19-Jul-2005, 10:00 PM #1
Perl, color in between signs
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!
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 09:08 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.