Author Topic: How to change player name color in chat  (Read 1591 times)

If a player is a certain BL_ID or Administrator, what is the code for changing their player name in chat

You have to either rewrite messageSent or package it and just display the message if you're admin.

You have to either rewrite messageSent or package it and just display the message if you're admin.
Forgive me, I dont understand

Do you have a even basic understanding of Torquescript?

Do you have a even basic understanding of Torquescript?
I have some, not much. I am just a beginner

Player names cannot be changed regardless of their adminship. You would have to literally rewrite the chat function to use a different name.


Couldn't he just package servercmdMessageSent to check for a certain BLID or variable in %client and just messageAll();?

Couldn't he just package servercmdMessageSent to check for a certain BLID or variable in %client and just messageAll();?

Sure, if you want to break how chat normally works.

Why would it break the normal chat?

It wouldn't have checks for links, spam or the e-tard.

If it's an admin speaking, I don't see why not.

Nor does messageAll send the message through the same channels that chat is sent through. It would appear the same to the end user but it would take a completely different path than normal chat takes. Using messageAll to deliver chat messages is piss-poor practice.

If it's an admin speaking, I don't see why not.
By "wouldn't have checks for links" he means an admin won't be able to use links in the chat with this mod.

There's no good way to do this since all the chat functionality is mashed into one big server command clusterforget. If you want an okay way, just copy/paste Slayer's chat function and make your modifications to that. May have to cut out some Slayer specific stuff if you're not running Slayer, but I find the function less ugly than the default messageSent.

Yes. Chat is not modularized in any way so if you want to do something such as change the name color then you have to overwrite the entire thing.

edit: Just had a very simple idea to make this easier. PMing Badspot...



My PM:
Quote
Currently, to modify something to do with chat (such as the name color), one needs to rewrite the entire serverCmdMessageSent function.

The default tagged string is '\c7%1\c3%2\c7%3\c6: %4'. Simply set that to a global variable so that modders can change it easily. Also create variables for the arguments.

For example:
Code: [Select]
$chat::string = '\c7%1\c3%2\c7%3\c6: %4';
$chat::arg1 = %client.clanPrefix;
$chat::arg2 = %client.getPlayerName();
//etc...

Modifying the chat is a very frequent topic in Coding Help, and this will simplify it immensely. It will also allow more than one add-on to modify the chat at once. (it's currently limited to one because the function must be overwritten)

Thanks
Sad that Badspot never implemented this.
Not that it'd help, but it'd be cool if the modding community petitioned Badspot to add this. Maybe then it'd get his attention.