How do i centre the text for choice window, and how can i completely disable mobile buttons?

Hi can someone help me to figure out this?
I'm also new on RM MZ.😅

1697365121099.png
​
In MZ, Window_GameEnd (like most other command windows) is centre-aligned by default (itemTextAlign). Are you sure you're using RPG Maker MZ?

The buttons are touch UI, to permit the game to be fully played with mouse or touch-screen. This can be for reasons of accessibility, comfort, and/or hardware limitations - it's not just for mobile players. They can be toggled in-game via the options menu. I would not recommend disabling them fully unless you have a suitable replacement, but it's possible, e.g.
Spoiler: plugin code
JavaScript:
/*:
 * @target MZ
 * @url https://forums.rpgmakerweb.com/threads/162024/
 * @help Free to use and/or modify for any project, no credit required.
 */
;void (alias => {
  Window_Options.prototype.addCommand = function(name, symbol) {
    if (symbol !== "touchUI")
      alias.apply(this, arguments);
  };
})(Window_Options.prototype.addCommand);
void (alias => {
  Scene_Options.prototype.maxCommands = function() {
    return alias.apply(this, arguments) - 1;
  };
})(Scene_Options.prototype.maxCommands);
void (alias => {
  ConfigManager.applyData = function() {
    alias.apply(this, arguments);
    this.touchUI = false;
  };
})(ConfigManager.applyData);
In MZ, Window_GameEnd (like most other command windows) is centre-aligned by default (itemTextAlign). Are you sure you're using RPG Maker MZ?

The buttons are touch UI, to permit the game to be fully played with mouse or touch-screen. This can be for reasons of accessibility, comfort, and/or hardware limitations - it's not just for mobile players. They can be toggled in-game via the options menu. I would not recommend disabling them fully unless you have a suitable replacement, but it's possible, e.g.
Spoiler: plugin code
JavaScript:
/*:
 * @target MZ
 * @url https://forums.rpgmakerweb.com/threads/162024/
 * @help Free to use and/or modify for any project, no credit required.
 */
;void (alias => {
  Window_Options.prototype.addCommand = function(name, symbol) {
    if (symbol !== "touchUI")
      alias.apply(this, arguments);
  };
})(Window_Options.prototype.addCommand);
void (alias => {
  Scene_Options.prototype.maxCommands = function() {
    return alias.apply(this, arguments) - 1;
  };
})(Scene_Options.prototype.maxCommands);
void (alias => {
  ConfigManager.applyData = function() {
    alias.apply(this, arguments);
    this.touchUI = false;
  };
})(ConfigManager.applyData);
Hi, thanks for the response, I wanted to clarify that I'm actually working on an completely evented menu and I have to simulate the game end scene with choices and I wanna centre the text… think I will add more choices tho.
You could centre the text in the picture. More generally, to centre-align content, "move" half the empty space to the left. So in this case, you can increase the text's X coordinate by:

(window width - text width) / 2

Edit: hold up a moment, I misread. Thought you were using a picture menu. 😴

Edit 2: OK, maybe a plugin like this? (Untested.)
Spoiler: plugin code
JavaScript:
/*:
 * @target MZ
 * @plugindesc Centre-aligned choices.
 * @author Caethyril
 * @url https://forums.rpgmakerweb.com/threads/162024/
 * @help Free to use and/or modify for any project, no credit required.
 */
;void (alias => {
  Window_ChoiceList.prototype.drawItem = function(index) {
    const rect = this.itemLineRect(index);
    const cmd = this.commandName(index);
    const dx = Math.floor(rect.width - this.textSizeEx(cmd).width) / 2;
    this.drawTextEx(cmd, rect.x + dx, rect.y, rect.width);
  };
})(Window_ChoiceList.prototype.drawItem);
Edit 3: corrected dx calculation to depend on rect.width instead of this.innerWidth.
You could centre the text in the picture. More generally, to centre-align content, "move" half the empty space to the left. So in this case, you can increase the text's X coordinate by:

(window width - text width) / 2


Edit: hold up a moment, I misread. Thought you were using a picture menu. 😴

Edit 2: OK, maybe a plugin like this? (Untested.)
Spoiler: plugin code
JavaScript:
/*:
 * @target MZ
 * @plugindesc Centre-aligned choices.
 * @author Caethyril
 * @url https://forums.rpgmakerweb.com/threads/162024/
 * @help Free to use and/or modify for any project, no credit required.
 */
;void (alias => {
  Window_ChoiceList.prototype.drawItem = function(index) {
    const rect = this.itemLineRect(index);
    const cmd = this.commandName(index);
    const dx = Math.floor(rect.width - this.textSizeEx(cmd).width) / 2;
    this.drawTextEx(cmd, rect.x + dx, rect.y, rect.width);
  };
})(Window_ChoiceList.prototype.drawItem);
Edit 3: corrected dx calculation to depend on rect.width instead of this.innerWidth.
Thank you so much! I’ll test it right now!

Edit: It works! :awink: Thanks!
1697373097478.png

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-centre-the-text-for-choice-window-and-how-can-i-completely-disable-mobile-buttons.162024/