MV Change Variable Inside Character Creator Scene

Hey y'all -- I've been working on making some edits to the Character Creator EX plugin. This is one of the last things I need to figure out, so if you're able to help me with it, I'd be tremendously grateful!

What I'm trying to do is simply: when the player selects a certain piece of a certain section, I'd like to set a variable to a certain value. This should, in theory, then unhide certain folders, since I have them set up so that they'll show in the Character Creator if a condition is met (i.e. if variable 64 = 2, for example).

I have been able to make this work, but only if I run the script outside of the CharacterCreator scene. So, how can I make something like this run inside the CharacterCreator scene?

JavaScript:
if $gameCharacterCreations.getInfo(1).Body.file == 'Body (1)' {
        $gameVariables.setValue(64, 1);
        $gameVariables.setValue(65, 1);
        $gameVariables.setValue(66, 1);
    } else if $gameCharacterCreations.getInfo(1).Body.file == 'Body (2)' {
        $gameVariables.setValue(64, 2);
        $gameVariables.setValue(65, 1);
        $gameVariables.setValue(66, 2);
    } else if $gameCharacterCreations.getInfo(1).Body.file == 'Body (3)' {
        $gameVariables.setValue(64, 3);
        $gameVariables.setValue(65, 1);
        $gameVariables.setValue(66, 2);
    } else $gameCharacterCreations.getInfo(1).Body.file == 'Body (4)' {
        $gameVariables.setValue(64, 4);
        $gameVariables.setValue(65, 2);
        $gameVariables.setValue(66, 3);
    }

This is a truncated version of all the if statements I need to run -- I have 9 bodies for the player to choose from! But if I can get this implemented and working, then I can easily add in the rest of the bodies and the appropriate variable numbers for them.

Also, you can see the entire code for the Character Creator plugin here (just click View)! In case that helps anyone who's willing to help me out with this! I'm not sure where in the plugin I need to run this code, and if any other changes need to be made in order for it to be executed.

Thanks a million!
Hm...I haven't used the plugin, but try it inside of saveCurrentSelection? So every time you save a choice it checks for unlocks based on it?
Hm...I haven't used the plugin, but try it inside of saveCurrentSelection? So every time you save a choice it checks for unlocks based on it?
Thank you so much for responding regardless if you've used it before, it really means a lot to me!! I definitely think this is on the right track... in the other spots where I tried pasting it, it just didn't do anything. This time, when I test it out, as soon as I select the body type, I get an error message, so I think it's trying to work!
Spoiler
1631589277336.png

This is where I put it in the saveCurrentSelection. I tried placing it after the combinedMode selection but then the plugin acted like it wasn't installed at all, for some reason?
1631589333482.png


I'll keep tinkering with it... this feels promising. Thanks for the suggestion!

Edit: If I delete the .file in Body.file, the error disappears, but the variable does not change, alas.
Edit: AH! AH! I TINKERED WITH IT SOME MORE AND I GOT IT!! I just had to make sure the $gameCharacterCreations.getInfo fell was inside the currentFile, as such!!!

Code:
if (this._fileList.currentFile($gameCharacterCreations.getInfo(1).Body == 'Body (1)')) {
        $gameVariables.setValue(64, 1);
        $gameVariables.setValue(65, 1);
        $gameVariables.setValue(66, 1);
    } else if(!this._combinedMode) {

Hooooly crap. I can't thank you enough for pointing me in the right direction!!

Edit: Okay, not perfect yet... it unhides the folder, but now it's not applying the images in the preview window. I'm close to figuring it out tho!!

Edit: Final update! Just had to make sure I had the additional information about the previewWindow in there as well! Obvious in retrospect haha, because it was if/else if, it wasn't checking to add images to the previewWindow as well. Had to check for both Body == 'Body(1) as well as !this._combinedMode. A screenshot for anyone else who stumbles across this looking to do the same thing!
1631591166530.png


Seriously, thanks for steering me right here. That was the nudge I needed to get me on the right path and get this issue solved! And I feel like I've learned a little more about how this plugin works, as well as the code behind it all, so I'm just feeling very good right about now!

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/change-variable-inside-character-creator-scene.140389/