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

Loading a character via mod

Discussion in 'Loader' started by Churchill, Jan 24, 2015.

  1. Churchill

    Churchill Potential Patron

    Joined:
    Jun 21, 2014
    Messages:
    20
    Likes Received:
    1
    The basic goal I have is to make a "character reload" feature as part of my mod but I'm having difficulty discerning where that action is going on. In the decompiled SDT core I found the characterMenu object and I also see in Loader where there are hooks into various aspects... but I've not figured out where the interaction with the menu is versus where the actual loading occurs.

    Anyone familiar enough with the object model to point me in the right direction?
     
  2. stuntcock

    stuntcock Club Regular Staff Member Moderator

    Joined:
    Jun 5, 2012
    Messages:
    1,522
    Likes Received:
    355
    Writing ActionScript which ties into the SDT UI can be a bit tricky. There are a few functions which don't cooperate with proxies (such as the big "Reset" button). The simple answer to your request is
    Code:
    g.inGameMenu.characterMenu.triggerSelect(g.inGameMenu.characterMenu.lastSelectedID);
    but this answer may be too simple. It's similar to the "Revert to Saved" feature that you can find in office software - it will discard any changes (to costume, personality, resistance, etc) which have occured during the current game session. If the user has spent ten minutes assembling a custom character then they'll be very upset if you abruptly wipe away all of their work.

    It may be useful to elaborate here -- why are you trying to reload the character and/or what do you hope to accomplish? How often do you envision this behaviour occuring, and in what context (e.g. once-per-character during the initialization of your mod, or every five minutes during gameplay)? Would it be triggered by user action or is it a fault-recovery behaviour invoked by the mod itself?

    Alternatively - if you're trying to Reload simply because the character is dirty, then there's already a hotkey to remove all strands from the scene. If the character's position and anatomy has become screwy then loading an Animtools file will usually fix it.

    If your mod is actually fiddling with character definitions at runtime (e.g. editing them into a new posture, saving them, loading each "posture variant" at the appropriate moment, etc) then you'll need to wait for feedback from someone who's more familiar with the stuff. I haven't even figured out how to get Character folders working on my end :'(
     
  3. sby

    sby Club Regular Content Creator

    Joined:
    Sep 11, 2012
    Messages:
    1,337
    Likes Received:
    76
    what does this 'character reload' specifically do?

    load charcode?
    load mods?
    load loader character folder?
    clear strands and reset initial resistance and reset dialog?
     
  4. Churchill

    Churchill Potential Patron

    Joined:
    Jun 21, 2014
    Messages:
    20
    Likes Received:
    1
    Good questions, the lot of it. The quick-ish answer:
    Let's say after ten minutes of alteration I have mussed something up and want to reset but I cannot (ever) be bothered with the mouse. I press F5 and kablam, it is as though none of it ever happened.

    Why not just use the mouse? See above.
    But also because sometimes alterations require resetting because hair/costume/whatever mods don't unload due to that specific parameter in the settings file I can't recall the name of offhand.

    Why not just alter the settings file or have a settings file per character? See below.
    Seriously, though, the reason would be for a reliable one-size-fits-all-comfy-pajamasuit reload of the character. So, for specifics, the F5 would first reset (ala-peanut-butter-sammiches) using loader.resetCharClicked() and then load the character again as though just clicked from the menu... thus coloring within the lines of the aforementioned quote (not that one the one above that, the one about the mouse... we don't get along but don't tell it).

    So possibly...
    Code:
    var lastCharacterID:uint = g.inGameMenu.characterMenu.lastSelectedID;
    loader.resetCharClicked();
    g.inGameMenu.characterMenu.triggerSelect(lastCharacterID);
    
    Not sure if the lastCharacterID is necessary, maybe the reset won't reset which character was loaded last? I'll will play with it and see.

    Thanks, as always, for your input and kind assistance. I'm still listening if further discussion ensues. n_n
     
  5. Faceless

    Faceless Club Regular Content Creator

    Joined:
    Jun 12, 2011
    Messages:
    1,118
    Likes Received:
    22
    The loader does natively iterate through character folders, so all you'd need to do is set up your mod in a folder (which you should be doing anyway), and then hit whatever key you've mapped to 'Next character' followed by 'Previous character'.
     
  6. Churchill

    Churchill Potential Patron

    Joined:
    Jun 21, 2014
    Messages:
    20
    Likes Received:
    1
    Definitely designing my mod to be sourced from a directory nestled under the «root»/Mods directory. For my preference it is currently in the $INIT$ directory.

    The loader functionality to cycle through custom characters isn't exactly what I'm looking for in this particular instance. Basically I'm looking for a "refresh" button that clears out changes and loads the character again.

    Initial attempts with just g.inGameMenu.characterMenu.triggerSelect(«character_id») haven't panned out. I may not be referencing the character ID correctly because it traces back as 1. I'm fairly sure if I can nail the character ID then I can get the thing working.

    Turns out that the character ID is being referenced correctly but apparently since I nest characters under sub-folders it isn't targeting the right source of information.

    My directory hierarchy goes a bit like...
    [table]
    [tr][td]«root»[/td][td]Mods[/td][td]Genre A[/td][td]Character 1[/td][/tr]
    [tr][td] [/td] [td][/td][td] [/td][td]Character 2[/td][/tr]
    [tr][td] [/td] [td][/td][td] [/td][td]Character 3[/td][/tr]
    [tr][td] [/td] [td][/td][td]Genre B[/td][td]Character 4[/td][/tr]
    [tr][td] [/td] [td][/td][td] [/td][td]Character 5[/td][/tr]
    [tr][td] [/td] [td][/td][td]Genre C[/td][td]Character 6[/td][/tr]
    [tr][td] [/td] [td][/td][td] [/td][td]Character 7[/td][/tr]
    [tr][td] [/td] [td][/td][td] [/td][td]Character 8[/td][/tr]
    [/table]

    If I drill down on Genre A and click the second character, the character ID traces back as 2.
    If I drill down on Genre C and click the second character, the character ID ALSO traces back as 2.

    Sooooooooooooo... seems like I need to target the last selected MENU ITEM and not simply the last selected ID... if that's even possible ;)
     
  7. sby

    sby Club Regular Content Creator

    Joined:
    Sep 11, 2012
    Messages:
    1,337
    Likes Received:
    76
    just glanced at loader code
    might be able to get away with:

    l.loadCharString(mycData); //not even sure if this is accessible


    where mycData is the l.cData that is grabbed in the initl(l)

    try not to blow out the stack along the way