How can I order the menu commands?

Greetings I have found myself with the difficulty of not being able to order the menu commands, since I have put another command of (backpack) but this one appears far below the others, in which it is essential that it be in the first or second place.

I would like to know how I can move the commands to taste, I do not know the file where it can be modified or there are some plugins to be able to do it.

Saludos

me he encontrado con la dificultad de no poder ordenar los comando de menu, ya que he puesto otro comando de (mochila) pero este aparece muy abajo de los demas, en cual es indespensable que este en primer lugar o segundo.

Me gustaria saber como puedo mover los comando a gusto, desconosco el archivo donde se puede modificar o existe algun plugins para poder realizarlo.

mochila.jpg
Hi there!

The menu commands are basically an array(this._list property). And they are drawn based on their positions inside the array.

JavaScript:
Window_MenuCommand.prototype.makeCommandList = function() {
    this.addMainCommands();
    this.addFormationCommand();
    this.addOriginalCommands();
    this.addOptionsCommand();
    this.addSaveCommand();
    this.addGameEndCommand();
};

So you can alias this function and change the array order as you like, either by using the sort function or just by manually changing the command you want to another position inside the array. But it cannot have empty elements inside the array.

JavaScript:
const alias = Window_MenuCommand.prototype.makeCommandList // Store the original function inside a variable.
Window_MenuCommand.prototype.makeCommandList = function() {
    alias.call(this) // Call the original function
    // Do your thing.
};

Another easy way, is if you want the "Backpack" command to be the first, just alias the function above and add the backpack command first:

JavaScript:
const alias = Window_MenuCommand.prototype.makeCommandList // Store the original function inside a variable.
Window_MenuCommand.prototype.makeCommandList = function() {
    // Add the backpack command first.
    alias.call(this) // Call the original function
};
¡Hola!

Los comandos de menú son básicamente una propiedad array(this._list). Y se dibujan en función de sus posiciones dentro de la matriz.

JavaScript:
 Window_MenuCommand.prototype.makeCommandList = function() {
    this.addMainCommands();
    this.addFormationCommand();
    this.addOriginalCommands();
    this.addOptionsCommand();
    this.addSaveCommand();
    this.addGameEndCommand();
}; [/CÓDIGO]

Por lo tanto, puede alias esta función y cambiar el orden de la matriz como desee, ya sea utilizando la función de ordenación o simplemente cambiando manualmente el comando que desee a otra posición dentro de la matriz. Pero no puede tener elementos vacíos dentro de la matriz.

[CODE=javascript]
const alias = Window_MenuCommand.prototype.makeCommandList // Almacenar la función original dentro de una variable.
Window_MenuCommand.prototype.makeCommandList = function() {
alias.call(this) // Llamar a la función original
Haz lo tuyo.
}; [/CÓDIGO]

Otra forma fácil, es si desea que el comando "Mochila" sea el primero, simplemente alias la función anterior y agregue primero el comando mochila:

[CODE=javascript]
const alias = Window_MenuCommand.prototype.makeCommandList // Almacenar la función original dentro de una variable.
Window_MenuCommand.prototype.makeCommandList = function() {
Agregue primero el comando mochila.
alias.call(this) // Llamar a la función original
}; [/CÓDIGO]
[/QUOTE]
Thank you very much, it was very helpful, I see that you make plugins, I will need custom plugins for my project, I will contact you by email to let you know.
Hi there!

The menu commands are basically an array(this._list property). And they are drawn based on their positions inside the array.

JavaScript:
Window_MenuCommand.prototype.makeCommandList = function() {
    this.addMainCommands();
    this.addFormationCommand();
    this.addOriginalCommands();
    this.addOptionsCommand();
    this.addSaveCommand();
    this.addGameEndCommand();
};

So you can alias this function and change the array order as you like, either by using the sort function or just by manually changing the command you want to another position inside the array. But it cannot have empty elements inside the array.

JavaScript:
const alias = Window_MenuCommand.prototype.makeCommandList // Store the original function inside a variable.
Window_MenuCommand.prototype.makeCommandList = function() {
    alias.call(this) // Call the original function
    // Do your thing.
};

Another easy way, is if you want the "Backpack" command to be the first, just alias the function above and add the backpack command first:

JavaScript:
const alias = Window_MenuCommand.prototype.makeCommandList // Store the original function inside a variable.
Window_MenuCommand.prototype.makeCommandList = function() {
    // Add the backpack command first.
    alias.call(this) // Call the original function
};
what are your contacts? to be able to explain what I want
what are your contacts? to be able to explain what I want
You can send a PM here through the forum ^^

Original thread: https://forums.rpgmakerweb.com/threads/how-can-i-order-the-menu-commands.146641/