MV Galv Choice Pictures + YEP_X_ExtMesPack1- Small Compatibility Fix?

Hello, it's me again.

Hopefully this is a small one. So, I'm using Galv Choice Pictures.
Works great... until I remove a choice using Yanfly's YEP_X_ExtMesPack 1's Plugin Command HideChoice, whereby the pictures don't seem to get the memo that this choice is now missing (and are hence are assigned to the wrong choices now). Considering this is being used to attach character portraits (and later, a function for teleport to a location), that's kind of a big deal. :rswt2:

Looking at the code, he already has compatibility for Hime's Hidechoices built in; so what I'm hoping is that it shouldn't be too hard for someone more savvy than I to apply the same fix to YEP.

I tried some basics, like seeing if I could reference YEP rather than Hime, deleting brackets here and there, but it's clear that's a wash unlike my impromptu fix to Visual Novel Choices. Could I just get Hime? Well, yes, but it's extra redundancy, fights horribly with Message Core (I tried it before), and is probably not worth the stress. Eli ChoicePictures is going to be very unwieldy to use as an alternative since the scene in question has 10 pictures, so I'd have to spam 10 plugin commands, and YEP is stitching together 2 sets of choice already, so there may be further problems due to that.

So hence the request.

Thankyou kindly for your attention.
tl;dr- Galv Pictures attached to choices don't update if YEP hides them.
You can try this one: Some Random Dev_Picture Choices
SRD's is another thing entirely, turning pictures into choices. I want pics to show up alongside choices.
Try this, it splices the picList when the choice isn't shown, so the indexes should match with the choice window indexes. But I'm not 100% sure if this works. Seemed to work when I made a test with a couple of choices.

Galv.CPICS.getPics = function() {
Galv.CPICS.picList = [];
if (!$gameMessage._choices) return;
for (var i = 0; i < $gameMessage._choices.length; i++) {
var txt = $gameMessage._choices[i].match(/<p:(.*)>/i);
if (txt) Galv.CPICS.setPic(i,txt);
}
for (var i = 0; i < $gameMessage._choices.length; i++) {
if (!$gameSystem.isChoiceShown(i)) Galv.CPICS.picList.splice(i, 1);
}
};

EDIT: Though I just realized that if you remove more than one element like that, the indexes will probably get messed. So I don't think it'll work like that if more than one choice is hidden. But it's a starting point maybe LOL.

EDIT2: Maybe try replacing it with filter (this might require you to have assigned pics to all the choices, not sure):

Galv.CPICS.getPics = function() {
Galv.CPICS.picList = [];
if (!$gameMessage._choices) return;
for (var i = 0; i < $gameMessage._choices.length; i++) {
var txt = $gameMessage._choices[i].match(/<p:(.*)>/i);
if (txt) Galv.CPICS.setPic(i,txt);
}
Galv.CPICS.picList = Galv.CPICS.picList.filter((pic, index) => $gameSystem.isChoiceShown(index));
};
Try this, it splices the picList when the choice isn't shown, so the indexes should match with the choice window indexes. But I'm not 100% sure if this works. Seemed to work when I made a test with a couple of choices.

Galv.CPICS.getPics = function() {
Galv.CPICS.picList = [];
if (!$gameMessage._choices) return;
for (var i = 0; i < $gameMessage._choices.length; i++) {
var txt = $gameMessage._choices[i].match(/<p:(.*)>/i);
if (txt) Galv.CPICS.setPic(i,txt);
}
for (var i = 0; i < $gameMessage._choices.length; i++) {
if (!$gameSystem.isChoiceShown(i)) Galv.CPICS.picList.splice(i, 1);
}
};

EDIT: Though I just realized that if you remove more than one element like that, the indexes will probably get messed. So I don't think it'll work like that if more than one choice is hidden. But it's a starting point maybe LOL.

EDIT2: Maybe try replacing it with filter (this might require you to have assigned pics to all the choices, not sure):

Galv.CPICS.getPics = function() {
Galv.CPICS.picList = [];
if (!$gameMessage._choices) return;
for (var i = 0; i < $gameMessage._choices.length; i++) {
var txt = $gameMessage._choices[i].match(/<p:(.*)>/i);
if (txt) Galv.CPICS.setPic(i,txt);
}
Galv.CPICS.picList = Galv.CPICS.picList.filter((pic, index) => $gameSystem.isChoiceShown(index));
};
Thankyou yet again RPGLord69, absolute star.

If I could give you more than 1 like, I would. 😀 Edit 2's version works perfectly.

Yes, I should have mentioned specifically, what is going is that you are being asked to present all the potential characters you can choose from. A portrait of each accompanies the choice. And after talking of each, that choice is deleted, it increments a variable, and if you reach the label with the variable at 10, it jumps on to the next part of the discussion.
Eliaquim ChoiceManagerPro have choices and picture showing too,

but if it works, it works, depending how its setup.
Eliaquim ChoiceManagerPro have choices and picture showing too,

but if it works, it works, depending how its setup.
I had already tried ChoiceManagerPro at the time, but it wouldn't operate with YEP's messages and Visual Novel Choices either.

Original thread: https://forums.rpgmakerweb.com/threads/galv-choice-pictures-yep_x_extmespack1-small-compatibility-fix.181147/