Blockland Forums > Modification Help

Chat Compatibility

Pages: (1/2) > >>

Greek2me:

I need to know what I'm doing wrong here, if anything, that will break chat in other mods:

--- Code: --- 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);
--- End code ---

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?

TripleNickels:

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

Greek2me:

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.


--- Quote from: TripleNickels on April 05, 2011, 07:24:47 PM ---On top of that, that is the least efficient way of modifying chat, that breaks just about everything and allows serious exploitation of chat.

--- End quote ---
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'?


--- Quote from: TripleNickels on April 05, 2011, 07:24:47 PM ---I gave some code to Cucumberdude that you can use here: http://forum.blockland.us/index.php?topic=148963.0

--- End quote ---
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?

lilboarder32:


--- Quote from: TripleNickels on April 05, 2011, 07:24:47 PM ---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

--- End quote ---
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.

Greek2me:

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

Yes, I'm completely overwriting serverCmdMessageSent.

--- Quote from: lilboarder32 on April 05, 2011, 08:32:25 PM ---it will break other mods that utilize that function as it won't really be called for them.

--- End quote ---
I didn't think of that. Actually, I think I only tested it with client sided mods.


--- Quote from: lilboarder32 on April 05, 2011, 08:32:25 PM ---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.

--- End quote ---
Oh, that's included in the rest of the function.

Pages: (1/2) > >>

Go to full version