Author Topic: Chat Compatibility  (Read 2213 times)

I need to know what I'm doing wrong here, if anything, that will break chat in other mods:
Code: [Select]
if(stuff)
%name = "<color:" @ %color @ ">" @ %client.getPlayerName();
else
%name = %client.getPlayerName();
%pre  = %client.clanPrefix;
%suf  = %client.clanSuffix;
%all  = '\c7%1\c3%2\c7%3\c6: %4' @ "\c7" @ %pre @ "\c3" @ %name @ "\c7" @ %suf @ "\c6: " @ %msg;

commandToAll('chatMessage',%client,'','',%all,%pre,%name,%suf,%msg);

Basically I'm just changing the person's name color in chat. It works fine, but one of my testers tells me that it breaks Kalphiter's eval mod. Is the problem that my mod isn't using chat correctly? Or is the problem Kalphiter's mod?
« Last Edit: April 05, 2011, 09:03:11 PM by Greek2me »

Is that your whole code?
You need a function, to start off with, and a package too.
On top of that, that is the least efficient way of modifying chat, that breaks just about everything and allows serious exploitation of chat.

I gave some code to Cucumberdude that you can use here: http://forum.blockland.us/index.php?topic=148963.0

Did you read the entire post? I said that it works in-game. That would mean it's not the whole code. I only posted the relevant portion.

On top of that, that is the least efficient way of modifying chat, that breaks just about everything and allows serious exploitation of chat.
I get the feeling that you don't know what you're talking about. That's the proper way of modifying chat, according to Truce. Also, how can this possibly allow 'serious exploitation of chat'?

I gave some code to Cucumberdude that you can use here: http://forum.blockland.us/index.php?topic=148963.0
I'd say that's a far worse way of modifying it than mine. What if another mod changes the clan tag? What if the clan tag is used in something other than chat?

Is that your whole code?
You need a function, to start off with, and a package too.
On top of that, that is the least efficient way of modifying chat, that breaks just about everything and allows serious exploitation of chat.

I gave some code to Cucumberdude that you can use here: http://forum.blockland.us/index.php?topic=148963.0
Eh, the "code" you gave to Cucumberdude doesn't apply to this at all...

Also, Greek, what is "colorstuff" in this line of code: %name = "<color:" @ colorstuff @ ">" @ %client.getPlayerName();

Are you completely overwriting the serverCmdMessageSent function? I am assuming you are. When you don't call Parent::serverCmdMessageSent(%client) in a package it will break other mods that utilize that function as it won't really be called for them.

And by "serious exploitation" I believe he is referring to Torque Markup Language, where players can then type <font:impact:45> and directly modify their chat. There is a function that filters that stuff out, I believe it is something along the lines of filterStringML or something. I'll quick look it up.
« Last Edit: April 05, 2011, 08:58:43 PM by lilboarder32 »

Colorstuff is a variable containing a hex code. %client.someScriptObject.colorHex

Yes, I'm completely overwriting serverCmdMessageSent.
it will break other mods that utilize that function as it won't really be called for them.
I didn't think of that. Actually, I think I only tested it with client sided mods.

And by "serious exploitation" I believe he is referring to Torque Markup Language, where players can then type <font:impact:45> and directly modify their chat. There is a function that filters that stuff out, I believe it is something along the lines of filterStringML or something. I'll quick look it up.
Oh, that's included in the rest of the function.

Colorstuff is a variable containing a hex code. %client.someScriptObject.colorHex
A variable? There is no % or $ declaring it a variable.

I removed it when I posted the code.


Bump to say that yes, my original method was the correct way to do this. The only problem was that when completely overwriting default functions, you should NOT package it. That way other mods parent to your overwrite, not the default function.