Jump to content
Korean Random
Tey

Customize nicknames in chat (colorize, add info, etc)

Recommended Posts

This mod allows you to decorate players name in battle chat messages. The default configuration colorizes players name based on their ratings, and add the flag of message author:

 

2hcn89c.jpg

 

Installation:

  1. download the latest version from here (click on the "Download ZIP" button).
  2. extract the files.
  3. copy mod_chat_color.py to the res_mods\configs\xvm\py_macro folder.
  4. copy chat.xc to the res_mods\configs\xvm\default folder (or wherever your XVM configuration files are).
  5. edit @xvm.xc and add the following line just before the last closing brace (}):
  , "chat": ${"chat.xc":"chat"}

Check the comments in chat.xc to tweak the configuration. Note that the prefix/suffix parameters do not use the XVM macros formatting because this is not available from Python scripts (or I'm too stupid to figure out how to do). The formatting comes from Python with named arguments whose list is given in chat.xc comments (names match some XVM macros). The list is way smaller than what's available in XVM macros, but I might add some more on demand.

 

Known issues:

  • this mod cannot decorate non-radio messages when playing a replay. This is because non-radio messages are not recorded as chat messages in replay files. Also, decorations of non-radio messages are recorded in replay files: anyone playing the replay file will see these messages as decorated, even without that mod installed.
Edited by Tey
  • Upvote 12

Share this post


Link to post

Short link
Share on other sites

i will grab a copy thank you :) 

just added to my modpack as this is a very simple idea that makes a very good little mod

Edited by soulza

Share this post


Link to post

Short link
Share on other sites

@soulza: I'll answer your PM here just in case other people are also interested by that.
 
Download the latest version of the mod here and you'll be able to add stuff before and after the players names by editing chat.xc. The default version inserts the player flag before its name, but only for the message author (not the targets).

post-32219-0-07706200-1485317433.jpg

 

To add your fruit images, you probably want to change both authorPrefix and prefix with something like that:

    // Prefix for the message author
    "authorPrefix": "<img src='cfg://soulzaskehoblue/keho/fruit/{xr:.0f}.png' width='12' height='12'>",
    // Prefix for target players
    "prefix": "<img src='cfg://soulzaskehoblue/keho/fruit/{xr:.0f}.png' width='12' height='12'>",

Note that this does not use the XVM macros formatting because this is not available from Python scripts (or I'm too stupid to figure out how to do). The formatting comes from Python with named arguments whose list is given in chat.xc comment.

Edited by Tey
  • Upvote 1

Share this post


Link to post

Short link
Share on other sites

@soulza: I'll answer your PM here just in case other people are also interested by that.

 

Download the latest version of the mod here and you'll be able to add stuff before and after the players names by editing chat.xc. The default version inserts the player flag before its name, but only for the message author (not the targets).

attachicon.gifmod_chat_color-2.jpg

 

To add your fruit images, you probably want to change both authorPrefix and prefix with something like that:

    // Prefix for the message author
    "authorPrefix": "<img src='cfg://soulzaskehoblue/keho/fruit/{xr:.0f}.png' width='12' height='12'>",
    // Prefix for target players
    "prefix": "<img src='cfg://soulzaskehoblue/keho/fruit/{xr:.0f}.png' width='12' height='12'>",

Note that this does not use the XVM macros formatting because this is not available from Python scripts (or I'm too stupid to figure out how to do). The formatting comes from Python with named arguments whose list is given in chat.xc comment.

What about to ability to define color scale (like in XVM) or switch for color source defined in colors.xc? It is possible to implement it ? Or where are colors taken from ?

Edited by Ragnarocek

Share this post


Link to post

Short link
Share on other sites

What about to ability to define color scale (like in XVM) or switch for color source defined in colors.xc? It is possible to implement it ? Or where are colors taken from ?

 

The player name colors are the one defined in colors.xc and the rating (WGR, WN8, WN6, ...) is the one you set in the settings on XVM website. Said differently, the color applied is equivalent to the "{{c:r}}" XVM macro. My colors.xc file is different than the default one from XVM, which explains why some players names are in orange.

Edited by Tey

Share this post


Link to post

Short link
Share on other sites

many many thanks for this m8 much appreciated :)

now when looking at chat in battle when someone is pinging a map square or asking for help its easy to identify if the player knows what he is on about, if a purple person asks for help you will tend to pay attention straight away , screen below poor old sgtRamsey(tomato) is being targeted , i am asking for attention to a map square and an orange player is asking for help , very easy to follow.

 

Untitled.png.fc51391bf7cb5c623b8cb839146

Edited by soulza

Share this post


Link to post

Short link
Share on other sites

hi

i can't see my image wn8

Their name should be like this " #8225ad.png " ?

 

in chat.xc , how i call them

 

"authorPrefix": "<img src='cfg://yaya070/img/wn8/{{c:r}}.png' width='16' height='13'>",

 

or

"authorPrefix": "<img src='cfg://yaya070/img/wn8/{wn8}.png' width='16' height='13'>",

 

or

"authorPrefix": "<img src='cfg://yaya070/img/wn8/{c:wn8}.png' width='16' height='13'>",

Share this post


Link to post

Short link
Share on other sites

@yoyo070: download latest version from here, and use something like that:

"authorPrefix": "<img src='cfg://yaya070/img/wn8/{cr}.png' width='16' height='13'>",
  • Upvote 1

Share this post


Link to post

Short link
Share on other sites

@Tey

I think there is some error somewhere

 

when i set false for the colorize author and target and put an png for prefix (author and target)

the name of target was colored

6Q9c8no.jpg

 

if i set false for colorize without prefixe file

the name of player write something and the target was colored

jqUcDdn.jpg

 

Example

 "chat": {
    "colorizeAuthor": true,
    "colorizeTarget": true,
    "authorPrefix": "",
    "prefix": "",
    "authorSuffix": "",
    "suffix": ""
  }

give that

cAh4FDu.jpg

 

Example

 "chat": {
    "colorizeAuthor": false,
    "colorizeTarget": false,
    "authorPrefix": "<img src='cfg://yaya070/img/icon_tchat/{cr}.png' width='16' height='13'>",
    "prefix": "<img src='cfg://yaya070/img/icon_tchat/{cr}.png' width='16' height='13'>",
    "authorSuffix": "",
    "suffix": ""
  }

kUJcMzT.jpg

 

"colorize...": false,    Does not seem to work

Edited by yoyo070

Share this post


Link to post

Short link
Share on other sites

@yoyo070: you're right, colorizeTarget was not taken into account. This should be fixed in latest version. As for colorizeAuthor, I believe you tested that with replays, right? If so, note that non-radio messages (i.e., messages written by players like "camper noobs" in your last screenshot) are not saved as chat messages in replays, so this mod cannot modify them when playing a replay¹. But if you try in a live battle, your changes to chat.xc should work for these messages.

 

¹ but if the mod did modify them while recording the replay (during live battle), then theses modifications are recorded in the replay and are permanent. This explains why the messages are colorized in your screenshots, even though the mod cannot change this kind of messages during replays playback.

Edited by Tey
  • Upvote 2

Share this post


Link to post

Short link
Share on other sites

yes i use replay for testing config

i retry my test in real game

thx for update


"chat": {

    "colorizeAuthor": false,

    "colorizeTarget": false,

    "authorPrefix": "<img src='cfg://yaya070/img/icon_tchat/{cr}.png' width='13' height='13'>",

    "prefix": "<img src='cfg://yaya070/img/icon_tchat/{cr}.png' width='13' height='13'>",

    "authorSuffix": "",

    "suffix": ""
  }

5t5Ku0F.jpg


"chat": {

    "colorizeAuthor": true,

    "colorizeTarget": true,

    "authorPrefix": "",

    "prefix": "",

    "authorSuffix": "",

    "suffix": ""
  }

QluYAD8.jpg

Edited by yoyo070

Share this post


Link to post

Short link
Share on other sites

Tey, thanks for this macro.

Only one question.

Using

"authorPrefix": "<img src='xvm://res/icons/flags/{flag}.png' width='16' height='13'>",

and when there is no flag set in XVM settings an empty space appears on the left side.

 

Tried to use:

"authorPrefix": "<img src='xvm://res/icons/flags/{{flag|default}}.png' width='16' height='13'>",

but it doesn't work.

Could this be solved somehow?

Thanks.

Share this post


Link to post

Short link
Share on other sites

Where color is edited?

colors are set in colors.xc and depending on rating settings which you have set on XVM page

Edited by Ragnarocek
  • Upvote 1

Share this post


Link to post

Short link
Share on other sites

colors are set in colors.xc and depending on rating settings which you have set on XVM page

I have an older version, without configuration.Specific color can be set?

Also, images can be set depending on the command?like on a picture

c4a8bb23a615.jpg
  • Upvote 1
  • Downvote 1

Share this post


Link to post

Short link
Share on other sites

Tried to use:

"authorPrefix": "<img src='xvm://res/icons/flags/{{flag|default}}.png' width='16' height='13'>",
but it doesn't work.

Could this be solved somehow?

 

 

When the flag is missing, this is already the default.png image that is shown as the flag. This is a transparent 16x13 image in default XVM configuration. Unfortunately, there's no way to specify an alternative image in the syntax, as it uses Python formatting (not XVM macros). Should someone be brave enough to implement XVM macros in Python, I'll be glad to use that instead.

 

I have an older version, without configuration.Specific color can be set?

The colors.xc file is included in official XVM releases since ages, so you should have it. This mod uses the same colors as XVM.

 

That said, I might add specific colors in chat.xc if you need it, but it won't be as elaborate as in colors.xc (that is, there will only be one color scale for the normalized rating, not one color scale for each rating type).

 

Also, images can be set depending on the command?like on a picture

c4a8bb23a615.jpg

The main purpose of that mod is to customize the players name, not the whole chat message. So no, this is not possible. That shouldn't be that hard to implement though, but I have no time for that yet :(

Edited by Tey
  • Upvote 1

Share this post


Link to post

Short link
Share on other sites

 

 

The main purpose of that mod is to customize the players name, not the whole chat message. So no, this is not possible.
 it's a pity :(

 

That said, I might add specific colors in chat.xc if you need it, but it won't be as elaborate as in colors.xc (that is, there will only be one color scale for the normalized rating, not one color scale for each rating type).

Add, if not difficult.I do not want the rainbow chatting))

Share this post


Link to post

Short link
Share on other sites

Add, if not difficult.I do not want the rainbow chatting))

 

Implemented in latest version. This is disabled by default, so you should set customColors to true to enable it. Only the XVM scale is supported, so have a look to this post to find out the conversions to other scales.

 

BTW, if you only want to disable colorization, just set colorizeAuthor and colorizeTarget to false.

  • Upvote 1

Share this post


Link to post

Short link
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...