1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Hair missing

Discussion in 'Help' started by prawnie16, Jul 24, 2014.

  1. prawnie16

    prawnie16 Potential Patron

    Joined:
    Jul 18, 2014
    Messages:
    3
    Likes Received:
    0
    when loading the character folder in the loader, the hair.png flashes and then disappears leaving the default hair style.

    it would seem that the character code resets this since it is set to the SD chan hairstyle and it is loaded after the png. file

    Problem file includes
    Code.txt
    Hair.png
    swf.file
    mod.txt

    so i dont think i am missing anything

    Would love to know at way to fix this

    Thanks
     
  2. sby

    sby Club Regular Content Creator

    Joined:
    Sep 11, 2012
    Messages:
    1,337
    Likes Received:
    76
    hmm, could try setting this in the loader settings:

    loadCodeLast=0



    description is "Whether code should load last, or first. For bug testing purposes."

    i always thought it was talking about actionscript code being applied before sdt code or after (per frame basis), but i am not actually sure as i had fiddled with it and didn't notice anything breaking.
     
  3. prawnie16

    prawnie16 Potential Patron

    Joined:
    Jul 18, 2014
    Messages:
    3
    Likes Received:
    0
  4. sby

    sby Club Regular Content Creator

    Joined:
    Sep 11, 2012
    Messages:
    1,337
    Likes Received:
    76
    oh, i see now. you have an swf and a hair in the same folder. the loader loads the hair first, and then the swf ends up resetting the hair back to normal.


    i don't think there are any ways to specify the load order. it might be possible to add some type of "LoadHairAfterMods" setting. since modguy did give me source i could look into how this could be done, depends if modguy prefers to be all-knowing of all the code that is put into the loader (and it would probably be a simple tweak).

    edit, or i can just post some code and probably be alright
    function loadCharString(c:String)
    {
    if (!loadingChar)
    {
    if(c.charAt(0) == "/") c = c.substring(1);
    custCount = -1;
    officialWait = false;
    loadInt = setInterval(resetLoadingChar,3000);
    loadingChar = true;
    cData = c;
    loadHairFile("Mods/" + cData + "/Hair.png");
    hueData.load(new URLRequest("Mods/" + cData + "/HueData.txt"));
    var settingsLoader2:URLLoader = new URLLoader ;
    settingsLoader2.addEventListener(Event.COMPLETE,onSettings);
    custMods = ["Mod.swf","Char.swf"];
    settingsLoader2.addEventListener(IOErrorEvent.IO_ERROR,function(){
    modTxt.load(new URLRequest("Mods/" + cData + "/Mods.txt"));});
    settingsLoader2.load(new URLRequest("Mods/" + cData + "/Settings.txt"));
    if (! loadCodeLast)
    {
    ldr.load(new URLRequest("Mods/" + cData + "/Code.txt"));
    }
    }
    }
    function loadCharString(c:String)
    {
    if (!loadingChar)
    {
    if(c.charAt(0) == "/") c = c.substring(1);
    custCount = -1;
    officialWait = false;
    loadInt = setInterval(resetLoadingChar,3000);
    loadingChar = true;
    cData = c;
    if(! LoadHairLater) loadHairFile("Mods/" + cData + "/Hair.png");
    hueData.load(new URLRequest("Mods/" + cData + "/HueData.txt"));
    var settingsLoader2:URLLoader = new URLLoader ;
    settingsLoader2.addEventListener(Event.COMPLETE,onSettings);
    custMods = ["Mod.swf","Char.swf"];
    settingsLoader2.addEventListener(IOErrorEvent.IO_ERROR,function(){
    modTxt.load(new URLRequest("Mods/" + cData + "/Mods.txt"));});
    settingsLoader2.load(new URLRequest("Mods/" + cData + "/Settings.txt"));

    if (! loadCodeLast)
    {
    ldr.load(new URLRequest("Mods/" + cData + "/Code.txt"));
    }
    if(LoadHairLater) loadHairFile("Mods/" + cData + "/Hair.png");
    }
    }

    //declare 'LoadHairLater' somewhere for the settings and stuff
    // i put the hair last because it makes more sense for the hair to override the code settings
    //i am also not sure if these are event listener based and not necessarily sequentially finished before the next, just threw a simple idea out there
     
  5. ModGuy

    ModGuy Club Regular Content Creator

    Joined:
    Feb 17, 2011
    Messages:
    1,754
    Likes Received:
    22
    That's one option sure, but why not:

    Find whatever is resetting the hair.
    Proxy it blank if we successfully found a Hair.png
    Enable it after successful load.
     
  6. sby

    sby Club Regular Content Creator

    Joined:
    Sep 11, 2012
    Messages:
    1,337
    Likes Received:
    76
    i am thinking to cover situations where a mod also a hair element, but you wish to replace it by having a hair file in that loader folder. if it was an swf hair, that is easy because you could put it after the mod in the 'Mods.txt'

    so i suppose if 'Mods.txt' supported loading hairs/backgrounds/code or whatnot, that could probably solve any load ordering that people may desire.

    edit - i can see duplicate loading issues possibly arising if this was taken, and so things may require naming conventions depending on how many things you attempt to support
     
  7. ModGuy

    ModGuy Club Regular Content Creator

    Joined:
    Feb 17, 2011
    Messages:
    1,754
    Likes Received:
    22
    Code:
    var lp = lProxy.createProxy(l.g.inGameMenu, "loadData");
    lp.hooked = false;
    lp.addPre(vanillaCodeProxy, true);
    function vanillaCodeProxy(a:String, b:Boolean=true, c:Boolean=false, d=null){
    	var dat:String = l.standardLines(a).join(";").split(";;").join(";");
    	if(l.isHairLoaded()){
    		dat = dat.split("hair:").join("BLANK:");
    	}
    	l.g.inGameMenu.loadData_l(dat);
    }
    The tweak is a much better idea really, but having to manually do this across every mod instead of just modifying vanilla behaviour is easier IMO.
    Thoughts?
     
  8. sby

    sby Club Regular Content Creator

    Joined:
    Sep 11, 2012
    Messages:
    1,337
    Likes Received:
    76
    i believe that will solve the issue of the 'code.txt' replacing the loaded hair (assuming that is added and then removed when doing character loading, because it would mess stuff up if left on afterward), but i don't think it will cover the situation where you load a hair.png, and then load a mod.swf that also includes a hair in it. (but the user would want to replace that one since they decided to place the hair.png in that folder in the first place)

    i am thinking that the hair file being placed in the folder indicates that it should probably override any hair loaded through code.txt or any hairs loaded through swf mods


    edit - also how is adding 2 lines in the loader code not easier than that?
    (setting up that setting being ignored, as you could probably just move the loading of the hair down)
     
  9. ModGuy

    ModGuy Club Regular Content Creator

    Joined:
    Feb 17, 2011
    Messages:
    1,754
    Likes Received:
    22
    Tweak added.

    As for my point of view, I figured the end user would be more comfortable with automation rather than setting things.
    Adding in settings almost always results in people missing them so I wasn't too keen.
    After implementing it however it works, while a proxy would result in more flexible behaviour I'd probably need a million flags for detection anyway so why bother.
     
  10. sby

    sby Club Regular Content Creator

    Joined:
    Sep 11, 2012
    Messages:
    1,337
    Likes Received:
    76
    just make the default setting to load the hair later on, i think it makes more sense this way
     
  11. ModGuy

    ModGuy Club Regular Content Creator

    Joined:
    Feb 17, 2011
    Messages:
    1,754
    Likes Received:
    22
    Tried that out just there, while it sorts out that situation, it causes other hairs to load under what feels like a race condition, ends up becoming unreliable.
    Kinda why I suggested the proxy since the loader would be in charge of load order.

    I might proxy everything up in the future but who can be bothered now heh.

    A different race condition.
     
  12. sby

    sby Club Regular Content Creator

    Joined:
    Sep 11, 2012
    Messages:
    1,337
    Likes Received:
    76
    if that is the case, then your current loading of everything is probably event based and not guaranteed to be loaded in any order xD.

    i would suggest changing the way it loads to be sequential instead. perhaps put the code.txt loading with settingsLoader2 onSettings/onfail, and then put the hair loading on ldr onloaded/blank


    edit - i see you put the ishairloaded thing on ldr
     
  13. limecat

    limecat Potential Patron

    Joined:
    May 7, 2013
    Messages:
    30
    Likes Received:
    0
    nice tweaks!