MV Yanfly Shop Menu Core Yep Custom Commands

Hi folks

I recently got the yep package and i wanted to add the YEP_ItemSynthesis plugin to the YEP_ShopMenuCore.
Meaning basically that you have the option to use synthesize in the shop menu.
I tried to do add the command myself but my coding knowledge isn't the best.
I'm not sure how you want that to work. You can't synthesize items listed for sale in the shop because they haven't been created into independent items yet.

If you just want an option there to take you to synthesizing items in the inventory, the easiest way would be to add it as an option in the evented conversation before the shop screen opens up.

Embedding it into the shop itself is a bit trickier because you have to transfer between different scenes.
Sorry for the late response.
Basically what i did is I made a custom button in the shop menu which is called fusion.
My problem I don't know how to call the event that opens the synthesis window as reference i have the code

this code sets the funtionality for the other buttons

JavaScript:
Scene_Shop.prototype.setCommandWindowHandlers = function() {
    this._commandWindow.setHandler('buy',    this.commandBuy.bind(this));
    this._commandWindow.setHandler('sell',   this.commandSell.bind(this));
    this._commandWindow.setHandler('cancel', this.popScene.bind(this));   
};

this is the function i want to activate the function is in another script


JavaScript:
Yanfly.IS.Game_Interpreter_pluginCommand =
    Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
    Yanfly.IS.Game_Interpreter_pluginCommand.call(this, command, args)
    if (command === 'OpenSynthesis') this.gotoSceneSynthesis(args);
    if (command === 'ShowSynthesis') $gameSystem._showSynthesis = true;
    if (command === 'HideSynthesis') $gameSystem._showSynthesis = false;
    if (command === 'EnableSynthesis') $gameSystem._enableSynthesis = true;
    if (command === 'DisableSynthesis') $gameSystem._enableSynthesis = false;
};

Game_Interpreter.prototype.gotoSceneSynthesis = function(args) {
    if ($gameParty.inBattle()) return;
    if (args && args.length >= 2) {
      var text = args[0].toUpperCase();
      var id = parseInt(args[1]);
      if (text === 'ITEM') {
        $gameTemp._synthRecipe = $dataItems[id];
      } else if (text === 'WEAPON') {
        $gameTemp._synthRecipe = $dataWeapons[id];
      } else if (text === 'ARMOR') {
        $gameTemp._synthRecipe = $dataArmors[id];
      }
    }
    SceneManager.push(Scene_Synthesis);
};
The plugin command has nothing to do with it.

You add your new command to the list then add a function for when it's selected.

JavaScript:
Scene_Shop.prototype.setCommandWindowHandlers = function() 
{
    this._commandWindow.setHandler('buy',    this.commandBuy.bind(this));
    this._commandWindow.setHandler('sell',   this.commandSell.bind(this));
    this._commandWindow.setHandler("fusion", this.commandFusion.bind(this));
    this._commandWindow.setHandler('cancel', this.popScene.bind(this));  
};

Scene_Shop.prototype.commandFusion = function()
{
    SceneManager.push(Scene_Synthesis);
};

Window_ShopCommand.prototype.makeCommandList = function() 
{
    this.addCommand(TextManager.buy,    'buy');
    this.addCommand(TextManager.sell,   'sell',   !this._purchaseOnly);
    this.addCommand("Fusion", "fusion");
    this.addCommand(TextManager.cancel, 'cancel');
};
okey it works nice and thank you a lot

one small issue is though when i want to close the menu it crashes the game
even when i just press the cancel button on the keyboard
this is the error message i get
i really tried finding a solution but i cant think it has something to do with the shop cause it gets a null reference in the rpg windows file

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-shop-menu-core-yep-custom-commands.171030/