Is there any way to define colors?

Discussion in 'Mod Discussions' started by thedbp, June 10, 2013.

  1. thedbp

    thedbp Member

    Messages:
    223
    Likes Received:
    8
    in line 106 in new_game_alpha.html it defines that when you click the army color it goes
    Code:
    <a href="#" data-bind="click:  function () { $root.nextColor($index()) }">
    says - goto next color

    and then it defines how the colors look in the laucher.

    Code:
    <span class="div_primary_color" data-bind="style: { background: $data.primaryColor }">
    <span class="div_secondary_color" data-bind="style: { background: $data.secondaryColor }"></span>
    </span></a>
    is there any way to reverse this like say
    Code:
    $data.primaryColor = #00CC00;
    $data.secondaryColor = #000000;
    so the colors become dark green + black in game?

    I'm asking because I want to make a bit more diverse color chooser on top of the existing code.
  2. Raevn

    Raevn Moderator Alumni

    Messages:
    4,226
    Likes Received:
    4,324
    Had a look for you, it appears to be engine side i'm afraid.

    nextColor is defined in new_game_alpha.js:
    Code:
    this.nextColor = function (army_index) {
        var id = self.serverArmyState()[army_index].army_id;
        m = {};
        m.army_id = id;
        self.send_message('next_color', m);
    }
    
    and send_message in ui/alpha/shared/common.js:
    Code:
    model.send_message = function (message, payload) {
        var m = {};
        if (payload)
            m = payload;
        m.message_type = message;
        engine.call("conn_send_message", JSON.stringify(m));
    }
    As you can see from the last line, it would seem to be an engine call.
  3. thedbp

    thedbp Member

    Messages:
    223
    Likes Received:
    8
    well yes but as you can see here (I might be wrong though)
    Code:
    <span class="div_primary_color" data-bind="style: { background: $data.primaryColor }">
    <span class="div_secondary_color" data-bind="style: { background: $data.secondaryColor }"></span>
    </span></a>
    it's calling for the colors from engine side by "background: $data.primaryColor". I just wonder if there is any way to define it rather than ask for it.
  4. Raevn

    Raevn Moderator Alumni

    Messages:
    4,226
    Likes Received:
    4,324
    Hmm, but if you directly modified those variables, I would think the server wouldn't know about it. Worth a try, they're in the .js file.
  5. thedbp

    thedbp Member

    Messages:
    223
    Likes Received:
    8
    those a just the ones referring to the java?

    how does it know what "nextColor" outputs

    also tried changing the java file colors but that only does changes locally no one else can see it and it doesn't go into the game...
  6. Baleur

    Baleur Member

    Messages:
    122
    Likes Received:
    22
    I hope the colors get changed later on.
    Right now it's some of the weirdest tasteless combinations.
    I mean, puke green and pink? Seriously?
    And about 10 different blacks.
  7. numptyscrub

    numptyscrub Member

    Messages:
    325
    Likes Received:
    2
    It is designed to disorient and nauseate puny organics who dare oppose our might. ;)

    Also, I would deliebrately do the same in Dawn of War with the army painter. An army of Orks (or especially Necrons) outfitted in aqua, shocking pink, yellow and lime green is a sight to behold :mrgreen:

    If / when custom colours are implemented in the lobby you can bet I'll be doing it there as well...

Share This Page