[REL][CLIENT] Team Colored Chat

Discussion in 'Released Mods' started by dom314, April 7, 2015.

  1. dom314

    dom314 Post Master General

    Messages:
    896
    Likes Received:
    1,196
    When playing a game, easily see the team to which a player belongs by looking at the colored rectangle found in front of their name!

    Here is a screen cap showing what it looks like when the AI talks to one another:
    [​IMG]

    Thanks to @mikeyh and @cola_colin for helping me make this mod.

    I would also like to thank @reptarking for all the love and support.
    Last edited: April 7, 2015
  2. Quitch

    Quitch Post Master General

    Messages:
    5,853
    Likes Received:
    6,045
    I used to love the idea of the old coloured chat mod, but it constantly broke chat. Hopefully this one won't :)
  3. dom314

    dom314 Post Master General

    Messages:
    896
    Likes Received:
    1,196
    Do you mean the name being entirely colored instead of just the indicator? That's actually quite possible but it is not as flexible, since some colors make the name really hard to read.
  4. Quitch

    Quitch Post Master General

    Messages:
    5,853
    Likes Received:
    6,045
    I prefer the look of this implementation.
    dom314 likes this.
  5. dom314

    dom314 Post Master General

    Messages:
    896
    Likes Received:
    1,196
    Wooh! xD
    Alpha2546 likes this.
  6. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    moved to released mods
    dom314 likes this.
  7. Remy561

    Remy561 Post Master General

    Messages:
    1,016
    Likes Received:
    641
    Awesome, this should be in vanilla!!
    dom314 likes this.
  8. dom314

    dom314 Post Master General

    Messages:
    896
    Likes Received:
    1,196
    Thanks :3
  9. Remy561

    Remy561 Post Master General

    Messages:
    1,016
    Likes Received:
    641
    I really love small but handy and good looking changes ^^

    So @jables, maybe add something like this to the 'to do' list? Or allow yourselves to implement user mods :)
  10. killerkiwijuice

    killerkiwijuice Post Master General

    Messages:
    3,879
    Likes Received:
    3,597
    Oh, I think the better option would be to promote PAMM on the PA Main panel.

    Saves work for Uber and shows other obvious advantages
    Remy561 likes this.
  11. Quitch

    Quitch Post Master General

    Messages:
    5,853
    Likes Received:
    6,045
    Make a video of PAMM and rig the video voting :)
    killerkiwijuice likes this.
  12. DeathByDenim

    DeathByDenim Post Master General

    Messages:
    4,327
    Likes Received:
    2,125
    I don't think you even need to rig it. :)
  13. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    Code:
        api.panels.chat.message('update_player_color_index', primary_map);
    
    Should be guarded in case the chat panel does not exit. Shorthand would be `api.panels.chat &&`
    dom314 and stuart98 like this.
  14. dom314

    dom314 Post Master General

    Messages:
    896
    Likes Received:
    1,196
    Good suggestion, thanks. I've updated the mod. Did you notice anything else that I may need to guard? In other words, please forgive me for this horrendous hack and do you think there is a way around it?
    Code:
    model.getMessageFlairColor = function(data) {
        var color_map = model.color_map();
    
        if (data.isServer()) {
            var message = data.message;
    // using substring to see if I can find the player name in the message, since the the actual player field has been stripped out :(
            for (var i = message.length; i >= 0; i--) {
                var _name = message.substring(0, i);
    ///////////////////////////////////////////////////////////////////////////////////////
                // it works....but it may fail if someone has an odd name like "x has disconnected" and
                // someone else also has the name x
                if (_name in color_map) {
                    return color_map[_name].color;
                }
            }
        }
        if (data.isGlobal()) {
            if (data.player_name in color_map) {
                return color_map[data.player_name].color;
            }
        }
        return '';
    }
    Last edited: January 13, 2016
  15. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    Caution is a good virtue for a programmer; I probably check fewer things than I should. I noticed this one because I often turn off panels when I'm reloading a lot for mod dev. Uber has a couple of these unguarded messages as well, so you're in good company ;^)
    dom314 likes this.

Share This Page