Author Topic: Messing with chat  (Read 459 times)


If I set %client to my self, and %target to any other client, and set %msg to any text, I can see the message.
If I set %client to any other client besides my self, and %target to any other client besides my self, and set %msg to any text, %client can not view the message. Any idea why? Once again, any help would be appreciated.


Code: [Select]


function ChatTest(%client, %target, %msg)
{
if(clientgroup.ismember(%client))
{
if(clientgroup.ismember(%target))
{
%all = '';
%pre = %target.prefix;
%suf = %target.suffix;
%name = %target.name;
%color = "<color:FFFFFF>";


commandtoclient(%client, 'chatmessage', %target, '', '', %all, %pre, %name, %suf, %msg, %color, %team.name);
commandtoclient(%target, 'chatmessage', %target, '', '', %all, %pre, %name, %suf, %msg, %color, %team.name);

}
}
}


Well, first off your variables are a bit off.

%all should be the entire string that's being sent to the client, including clan prefix, suffix, name, etc.

%pre should be %target.clanprefix, likewise %suf should be %target.clansuffix
%name should be %target.getPlayerName(), there's nothing wrong with what you did but it's proper to use getPlayerName()

Second, if you see it when you're %client, everyone should see it when they're %client. I think your commandToClients are a bit off, but I'm not positive of the proper archetecture off the top of my head. So, either your test subjects are lying to you, or your arguments are off in some really odd way where it still works for you.

I have tested it on multipull people and its still off, so I guess my commandtoclient is wrong.

Ok so I got it to work, but I can't figure out how to modify the chat color and how to put words in front of the message.

Code: [Select]
%pre = %client.clanprefix;
%suf = %client.clansuffix;
%name = %client.getplayername();
%wordstoputinfrontofmessage = "wordshere";
%color = "somehexadecimalcodehere";
%all  = '\c7%1\c3%2\c7%3\c6: %4' @ %channelname @ "\c7" @ %pre @ "\c3" @ %name @ "\c7" @ %suf @ "\c6: " @ %color @ %msg; // I don't understand the tagged string :(

%newclient = %clientblah;
commandtoclient(%newclient, 'chatmessage', %client, '', '', %all, %pre, %name, %suf, %msg, %color, %team.name);


I don't understand this part as well.
Code: [Select]
'\c7%1\c3%2\c7%3\c6: %4'

Copied code from http://forum.blockland.us/index.php?topic=150124.0
« Last Edit: November 03, 2012, 02:11:15 PM by Gartanium »

I don't understand this part as well.
Code: [Select]
'\c7%1\c3%2\c7%3\c6: %4'
Well, let's break it up. All \cX things are color codes, so they're just setting the color. If you remove them, you get:
"%1%2%3: %4"
Now, I've never personally used these types of variables for anything, so I'm not 100% sure how they work, but the idea is %1 would be replaced with their clan prefix (with \c7 to color it grey), %2 would be replaced with their name (with \c3 to color it yellow), %3 would be replaced with their clan suffix (with \c7 to color it grey), (\c6 colors everything from this point on white), ": %4" would be replaced with ": messagehere".



Ok so I got it to work, but I can't figure out how to modify the chat color and how to put words in front of the message.
So, to modify chat color you've got two choices. The easy choice is to use \cX coloring. To figure out what numbers produce which color, start a server and type /colorTest in chat. The harder way is to use the TorqueML tag for color, which is "<color:RRGGBB>" where RR, GG, and BB are HEX codes for how much of that color to add. You can get these numbers here. To put words in front of the message, do something like %message = "My Words " @ %message;

The "@" operand attatches two strings together, so "Hello " @ "World" would become "Hello World". I don't know how much of this you know, so sorry if I'm explaining too much.

I already use RGB color codes because I prefer them :p. All I was trying to figure out was what the %1, %2, etc. was in the tagged string. I think I have all my questions answered.