MV Help to edit conditional menu commands in Save/Load scene

Hi!

In our game, we have specific places to save the game and other places to load the game.

I am trying the edit the Save/Load scene because I want to limit the options depending on the load restrictions.

I am writing something wrong in the lines below.

JavaScript:
Window_SaveAction.prototype.makeCommandList = function() {

    var id = this.savefileId();

    var enabled = DataManager.isThisGameFile(id);

    var isLoadEnabled = DataManager.loadSavefileInfo(id);

/// Conditional Save/load menus

    function {

      if (this._mode !== 'save') return false;

      return this.addCommand(this.getCommandName('save'), 'save', this.isSaveEnabled()); && this.addCommand(this.getCommandName('delete'), 'delete', enabled);

      } else if (this._mode !== 'save') return true;

      return this.addCommand(this.getCommandName('load'), 'load', isLoadEnabled; && this.addCommand(this.getCommandName('delete'), 'delete', enabled);

  };

Can someone spare a minute to help me?
I dont know why you set the condition in a function at all?

other that that you miss a closing brackets "}"

remove the "function {" as this is not required. as it isn't a function at all.
Hi!
Thanks for your reply! I changed the code and still no success:

JavaScript:
Window_SaveAction.prototype.makeCommandList = function() {

    var id = this.savefileId();
    var enabled = DataManager.isThisGameFile(id);
    var isLoadEnabled = DataManager.loadSavefileInfo(id);

/// Conditional Save/load menus
    if (this._mode === 'save') {
    return this.addCommand(this.getCommandName('save'), 'save', this.isSaveEnabled());
    } else if (this._mode !== 'save') {
    return this.addCommand(this.getCommandName('load'), 'load', isLoadEnabled;
    }
    this.addCommand(this.getCommandName('delete'), 'delete', enabled);
};
Bump
maybe take a look at TSR_Save which is fully customizable, that also have a delete function
on it, and yo can make it more unique.

it does have everything that a save/load could have.
Hi.

Just in case anyone is curious how I solved this, I just added a condition in the Yep Save Core to show different menu commands depending on a switch:

JavaScript:
Window_SaveAction.prototype.makeCommandList = function() {
    var id = this.savefileId();
    var enabled = DataManager.isThisGameFile(id);
    var valid = DataManager.loadSavefileInfo(id);
    
    if ($gameSwitches.value(177) == true) {
            this.addCommand(this.getCommandName('save'), 'save', this.isSaveEnabled());
      this.addCommand(this.getCommandName('delete'), 'delete', enabled);
  } else {
    this.addCommand(this.getCommandName('load'), 'load', valid);
    this.addCommand(this.getCommandName('save'), 'save', this.isSaveEnabled());
    this.addCommand(this.getCommandName('delete'), 'delete', enabled);
  }


};
I think this is the simplest way to achieve the same goal:

JavaScript:
Window_SaveAction.prototype.makeCommandList = function() {
  let id = this.savefileId();
  let enabled = DataManager.isThisGameFile(id);
  let valid = DataManager.loadSavefileInfo(id);
  if (!$gameSwitches.value(177)) {
    this.addCommand(this.getCommandName('load'), 'load', valid);
  }
  this.addCommand(this.getCommandName('save'), 'save', this.isSaveEnabled());
  this.addCommand(this.getCommandName('delete'), 'delete', enabled);
};

Original thread: https://forums.rpgmakerweb.com/threads/help-to-edit-conditional-menu-commands-in-save-load-scene.154422/