[REL] Favourite Colour v1.4 [63180]

Discussion in 'Mod Discussions' started by DeathByDenim, January 18, 2014.

  1. Aramai

    Aramai New Member

    Messages:
    9
    Likes Received:
    0
    I'm not entirely sure, honestly. If you'd like, I'd be willing to run teamviewer for you to poke around and see what you can find out. I'm running windows 8.1 64 bit if that makes any difference to you.
  2. DeathByDenim

    DeathByDenim Post Master General

    Messages:
    4,328
    Likes Received:
    2,125
    Ok, I figured it out! Aramai was kind enough to send me his PA config dir so I could debug.

    And it's your fault, raevn! :p
    The problem is that PAMM for Windows rewrites the modinfo.json when enabling or disabling mods. That's fine of course, but PAMM writes text files using ISO-8859-15, whereas I use UTF-8. Since we just recently introduced localization support, the fancy characters such as é, è, ü, etcetera are encoded as strange binary stuff as far as PA is concerned. In retrospect, I should just have asked for the logs:
    Code:
    [18:40:01.673] ERROR Failed to read modinfo.json file for dFavouriteColour
    [18:40:01.673] ERROR malformed UTF-8 sequence
    So the solution here is to make PAMM for Windows use UTF-8 instead of ISO-8859-15 for writing text files. Is that possible?

    EDIT:
    By the way, the mod can be fixed by opening the modinfo.json file in a text editor and save as UTF-8 or alternatively just remove the translations to get rid of the international characters.
    Last edited: January 29, 2014
    Raevn, mishtakashi and cptconundrum like this.
  3. Aramai

    Aramai New Member

    Messages:
    9
    Likes Received:
    0
    XD Glad you were able to figure it out. I followed the instructions and removed the international characters, but simply opening and saving seems to leave the previously changed characters the way they were.
  4. DeathByDenim

    DeathByDenim Post Master General

    Messages:
    4,328
    Likes Received:
    2,125
    Well, I'm not sure what's going on there. Anyway, I changed the mod online, so all you have to do is reinstall the Favourite Colour mod.
  5. DeathByDenim

    DeathByDenim Post Master General

    Messages:
    4,328
    Likes Received:
    2,125
    Actually, what probably happened there is that PAMM was still open. It will overwrite the files with whatever it has in memory. (Just pointing this out for future reference)
  6. Raevn

    Raevn Moderator Alumni

    Messages:
    4,226
    Likes Received:
    4,324
    :oops:

    Should be doable, but of course the current way I'm writing files only otherwise supports the UTF-16 format :p
    I've found another way to do it, just need to swap out some VB methods. Thankfully since the last PAMM re-write that's pretty much the only VB code left.

    I should have the next PAMM version ready by this weekend.
  7. Aramai

    Aramai New Member

    Messages:
    9
    Likes Received:
    0
    You guys are awesome.
  8. cptconundrum

    cptconundrum Post Master General

    Messages:
    4,186
    Likes Received:
    4,900
    Broken in Gamma v.62037
  9. DeathByDenim

    DeathByDenim Post Master General

    Messages:
    4,328
    Likes Received:
    2,125
    Woo-hoo. They're really going for 100% breakage!
  10. cptconundrum

    cptconundrum Post Master General

    Messages:
    4,186
    Likes Received:
    4,900
    They're actually not scoring as high as I expected. It's still a new high score though!
  11. DeathByDenim

    DeathByDenim Post Master General

    Messages:
    4,328
    Likes Received:
    2,125
    Ah, yeah. I noticed after I read few of the other threads on the mod forum. Oh well. Maybe for delta! ;)
    lokiCML, LavaSnake and cptconundrum like this.
  12. DeathByDenim

    DeathByDenim Post Master General

    Messages:
    4,328
    Likes Received:
    2,125
    Drat! I think they did a bad thing.

    Lobby.js is depricated now and replaced by new_game.js. However, in new_game.js they define the handlers AFTER loading the mods, so you can't take them over anymore, which is what I need for this mod. I'm afraid this mod will stay broken until they fix that. (Or until I find a way around it. Possibly with timers or something)
  13. LavaSnake

    LavaSnake Post Master General

    Messages:
    1,620
    Likes Received:
    691
    Don't feel bad about using timers, I had to use two of them in my profile pic fixer to get it to work.
  14. DeathByDenim

    DeathByDenim Post Master General

    Messages:
    4,328
    Likes Received:
    2,125
    Tricky in this case though. The handler I hijack is called very early on. I might be too late if I use timers to set the handlers. Anway, I'll see.
  15. DeathByDenim

    DeathByDenim Post Master General

    Messages:
    4,328
    Likes Received:
    2,125
    Ok, I got it working again. I needed to shadow new_game.js though, so the minute a new PA patch is released, I need to update it pronto! Hopefully the new PA patch will contain the fix I need to make to new_game.js so I won't have to shadow it anymore.
  16. burntcustard

    burntcustard Post Master General

    Messages:
    699
    Likes Received:
    1,312
    Why no secondary colours? Be as technical as you like :) I really want black with yellow and other such custom colours, and I get pissed every time it gives me a random ugly stripe :/
  17. DeathByDenim

    DeathByDenim Post Master General

    Messages:
    4,328
    Likes Received:
    2,125
    I tried. In new_game.js there is this function:
    Code:
    model.send_message("next_secondary_colour");
    But it does nothing!
  18. burntcustard

    burntcustard Post Master General

    Messages:
    699
    Likes Received:
    1,312
    You're right! D: I got the secondary colour showing in the colour box with "background': slot.secondaryColor" in new_game.html, so I can use your mod to set the primary, and then keep jumping in and out of a lobby to set my (seemingly random) secondary colour to what I want it lol... But I can't figure out any other way to change it either :(

    Edit: Secondary colour display, bitches. Should I get this on PAMM? Should I be changing the CSS through a .js? Probably...

    Attached Files:

    Last edited: March 2, 2014
  19. DeathByDenim

    DeathByDenim Post Master General

    Messages:
    4,328
    Likes Received:
    2,125
    That's pretty neat. And yeah, .js is definitely preferred. Otherwise you have to update this mod for every PA patch. Worse still, your mod would most likely break the lobby when people install the PA patch but you hadn't updated the mod yet.
  20. DeathByDenim

    DeathByDenim Post Master General

    Messages:
    4,328
    Likes Received:
    2,125
    Actually, this should do the trick:
    Code:
    $('.slot-color').each( function() {
      var databindstr = $(this).attr('data-bind');
      databindstr = databindstr.replace(
        "\'background\': slot.primaryColor",
        "\'background\': slot.primaryColor, \'border-color\': slot.secondaryColor, \'border-width\': \'3px\'"
      );
      $(this).attr('data-bind', databindstr);
    });

Share This Page