Author Topic: Modifying Chat  (Read 1852 times)

I'm trying to modify chat.

ie:

I say "Hey whats up!"

and the script make it output

Cucumberdude:ADDEDHey whats up!

What should I package?

Depends on if this is Clientside or Serverside.

You will want to package serverCmdMessageSent or serverCmdTeamMessageSent.

Be aware that everyone who does this more or less has an IQ of about 10 and I can come into the server and spam in giant yellow text, justified to the right.

That sounds bad.  :cookieMonster:

Anyway I can change the color of specific people's text? That's really all I need I guess.

Code: [Select]
function serverCmdSetChatColor(%client,%colorName,%colorChat) //might want an admin check on this
{
if(strLen(%colorName) != 6 || strLen(%colorChat) != 6)
{
messageClient(%client,'',"Please use a valid hex code.");
return;
}

%client.colorName = %colorName;
%client.colorChat = %colorChat;
}

package msgStuff
{
function serverCmdMessageSent(%client,%msg)
{
if(%client.colorName $= "") //name color
%colorName = "ffff00";
else
%colorName = %client.colorName;

if(%client.colorChat $= "") //chat color
%colorChat = "ffffff";
else
%colorChat = %client.colorChat;

%name = "\c7" @ %client.clanPrefix @ "<color:" @ %colorName @ ">" @ %client.getPlayerName() @ "\c7" @ %client.clanSuffix;

messageAll('',%name @ "<color:" @ %colorChat @ ">:" SPC %msg);
echo(%client.name @ ":" SPC %msg);
%client.lastMsg = %msg;
}
};
activatePackage(msgStuff);

Made this up really quick. not tested

EDIT: not sure if this would break other mods...
« Last Edit: March 26, 2011, 04:58:18 PM by Greek2me »

-snip-

Made this up really quick. not tested

EDIT: not sure if this would break other mods...

That would break a lot. For one thing, it reroutes chat into server messages. You're also not sending it in proper format.

Examine Truce's given format: http://forum.blockland.us/index.php?topic=140729.msg3220289#msg3220289

If you want to change the color of someone's message, it's actually quite easy. To allow people to do it themselves is stupid.

Manual:
Code: [Select]
findClientByName("_NAME_").clanSuffix = findClientByName("_NAME_").clanSuffix @ "<color:HHEEXX>";

User-chosen:
Code: [Select]
function serverCmdSetTextcolor(%c, %HEX)
{
   %c.clanSuffix = %c.clanSuffix @ "<color:" @ %HEX @ ">";
}

However, be aware you could do something like /setTextColor FF00CC><font:impact:64pt> and their text would be pink, huge, and in impact font.
« Last Edit: March 27, 2011, 10:04:39 PM by TripleNickels »

I never was planning on user controlled color. Thanks.