Tey Posted January 21, 2017 Share Posted January 21, 2017 (edited) 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: Installation: download the latest version from here (click on the "Download ZIP" button). extract the files. copy mod_chat_color.py to the res_mods\configs\xvm\py_macro folder. copy chat.xc to the res_mods\configs\xvm\default folder (or wherever your XVM configuration files are). 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 March 9, 2017 by Tey 12 @ Quote Link to comment Short link Share on other sites More sharing options...
soulza Posted January 21, 2017 Share Posted January 21, 2017 (edited) 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 January 21, 2017 by soulza @ Quote Link to comment Short link Share on other sites More sharing options...
Tey Posted January 25, 2017 Author Share Posted January 25, 2017 (edited) @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). 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 January 25, 2017 by Tey 1 @ Quote Link to comment Short link Share on other sites More sharing options...
Ragnarocek Posted January 25, 2017 Share Posted January 25, 2017 (edited) @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). mod_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 January 25, 2017 by Ragnarocek @ Quote Link to comment Short link Share on other sites More sharing options...
Tey Posted January 25, 2017 Author Share Posted January 25, 2017 (edited) 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 January 25, 2017 by Tey @ Quote Link to comment Short link Share on other sites More sharing options...
Ragnarocek Posted January 25, 2017 Share Posted January 25, 2017 working perfectly :) thanx bro :) @ Quote Link to comment Short link Share on other sites More sharing options...
soulza Posted January 26, 2017 Share Posted January 26, 2017 (edited) 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. Edited January 26, 2017 by soulza @ Quote Link to comment Short link Share on other sites More sharing options...
yaya070 Posted February 2, 2017 Share Posted February 2, 2017 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'>", @ Quote Link to comment Short link Share on other sites More sharing options...
Tey Posted February 3, 2017 Author Share Posted February 3, 2017 @yoyo070: download latest version from here, and use something like that: "authorPrefix": "<img src='cfg://yaya070/img/wn8/{cr}.png' width='16' height='13'>", 1 @ Quote Link to comment Short link Share on other sites More sharing options...
yaya070 Posted February 3, 2017 Share Posted February 3, 2017 working fine thx @ Quote Link to comment Short link Share on other sites More sharing options...
yaya070 Posted February 4, 2017 Share Posted February 4, 2017 (edited) @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 if i set false for colorize without prefixe file the name of player write something and the target was colored Example "chat": { "colorizeAuthor": true, "colorizeTarget": true, "authorPrefix": "", "prefix": "", "authorSuffix": "", "suffix": "" } give that 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": "" } "colorize...": false, Does not seem to work Edited February 4, 2017 by yoyo070 @ Quote Link to comment Short link Share on other sites More sharing options...
Tey Posted February 4, 2017 Author Share Posted February 4, 2017 (edited) @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 February 4, 2017 by Tey 2 @ Quote Link to comment Short link Share on other sites More sharing options...
yaya070 Posted February 4, 2017 Share Posted February 4, 2017 (edited) 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": "" } "chat": { "colorizeAuthor": true, "colorizeTarget": true, "authorPrefix": "", "prefix": "", "authorSuffix": "", "suffix": "" } Edited February 4, 2017 by yoyo070 @ Quote Link to comment Short link Share on other sites More sharing options...
ADv Posted February 5, 2017 Share Posted February 5, 2017 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. @ Quote Link to comment Short link Share on other sites More sharing options...
Slava7572 Posted February 5, 2017 Share Posted February 5, 2017 Where color is edited? @ Quote Link to comment Short link Share on other sites More sharing options...
Ragnarocek Posted February 5, 2017 Share Posted February 5, 2017 (edited) Where color is edited? colors are set in colors.xc and depending on rating settings which you have set on XVM page Edited February 5, 2017 by Ragnarocek 1 @ Quote Link to comment Short link Share on other sites More sharing options...
Slava7572 Posted February 5, 2017 Share Posted February 5, 2017 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 1 1 @ Quote Link to comment Short link Share on other sites More sharing options...
Tey Posted February 6, 2017 Author Share Posted February 6, 2017 (edited) 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 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 February 6, 2017 by Tey 1 @ Quote Link to comment Short link Share on other sites More sharing options...
Slava7572 Posted February 6, 2017 Share Posted February 6, 2017 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)) @ Quote Link to comment Short link Share on other sites More sharing options...
Tey Posted February 6, 2017 Author Share Posted February 6, 2017 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. 1 @ Quote Link to comment Short link Share on other sites More sharing options...
Recommended Posts
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.