MV Solved Aligning Battle Log texts to Center

Hello!

Note that I am using this eval in Action Sequences to show texts in the Battle Log

Code:
eval: BattleManager._logWindow.addText('Hello!');

How can I make sure they're centered?
Try this:
Code:
eval: BattleManager._logWindow.addText('<CENTER>Hello!');
From the YEP_BattleEngineCore documentation:

When changing "Terms" and the "Messages" that appear in battle, inserting the following tag anywhere in the message will cause the message to center itself in the battle log. <CENTER> This tag must be all caps in order for the battle log window to recognize it as an instruction to center the displayed battle text message.
Try this:
Code:
eval: BattleManager._logWindow.addText('<CENTER>Hello!');
From the YEP_BattleEngineCore documentation:

When changing "Terms" and the "Messages" that appear in battle, inserting the following tag anywhere in the message will cause the message to center itself in the battle log. <CENTER> This tag must be all caps in order for the battle log window to recognize it as an instruction to center the displayed battle text message.

Oh Sorry, I read about that and thought it only works on the messages.

Thank you!
Here's a way to do it once by activating a single Switch.

JavaScript:
//==============================================================================
// * WBLCenterTextYEP.js
//   Scripter : Kyonides Arkanthes
//   Release Date: 2023-07-03
//==============================================================================
/*:
 * @plugindesc Center Text of Window_BattleLog Messages
 * @author Kyonides
 * @help Date: 2023-07-03
 *
 * @param Center Text
 * @type switch
 * @default 0
 * @desc
 */

function WBLCenterText() {
  throw new Error('This is a static class');
}

WBLCenterText.parameters = PluginManager.parameters('WBLCenterText');
WBLCenterText.switch_id = Number(WBLCenterText.parameters['Center Text']);

WBLCenterText.battlelog_draw_line_text = Window_BattleLog.prototype.drawLineText;
Window_BattleLog.prototype.drawLineText = function(index) {
  let switch_on = $gameSwitches.value(WBLCenterText.switch_id);
  if (switch_on) {
    this.drawDirectCenterLine(index);
  } else {
    WBLCenterText.battlelog_draw_line_text.call(this, index);
  }
};

Window_BattleLog.prototype.drawDirectCenterLine = function(index) {
  let text = this._lines[index];
  let rect = this.itemRectForText(index);
  this.contents.clearRect(rect.x, rect.y, rect.width, rect.height);
  let tw = this.textWidthEx(text);
  let wx = rect.x + (rect.width - tw) / 2;
  this.resetFontSettings();
  this.drawTextEx(text, wx, rect.y);
};
Here's a way to do it once by activating a single Switch.

JavaScript:
//==============================================================================
// * WBLCenterTextYEP.js
//   Scripter : Kyonides Arkanthes
//   Release Date: 2023-07-03
//==============================================================================
/*:
 * @plugindesc Center Text of Window_BattleLog Messages
 * @author Kyonides
 * @help Date: 2023-07-03
 *
 * @param Center Text
 * @type switch
 * @default 0
 * @desc
 */

function WBLCenterText() {
  throw new Error('This is a static class');
}

WBLCenterText.parameters = PluginManager.parameters('WBLCenterText');
WBLCenterText.switch_id = Number(WBLCenterText.parameters['Center Text']);

WBLCenterText.battlelog_draw_line_text = Window_BattleLog.prototype.drawLineText;
Window_BattleLog.prototype.drawLineText = function(index) {
  let switch_on = $gameSwitches.value(WBLCenterText.switch_id);
  if (switch_on) {
    this.drawDirectCenterLine(index);
  } else {
    WBLCenterText.battlelog_draw_line_text.call(this, index);
  }
};

Window_BattleLog.prototype.drawDirectCenterLine = function(index) {
  let text = this._lines[index];
  let rect = this.itemRectForText(index);
  this.contents.clearRect(rect.x, rect.y, rect.width, rect.height);
  let tw = this.textWidthEx(text);
  let wx = rect.x + (rect.width - tw) / 2;
  this.resetFontSettings();
  this.drawTextEx(text, wx, rect.y);
};
I know this is a different question, but do you know how to change it's font/size/color?
I published this plugin with all the modifications of YEP we've discussed so far. It still needs approval so please wait patiently.
I published this plugin with all the modifications of YEP we've discussed so far. It still needs approval so please wait patiently.
Thank you very much for all the help! Do you have other plugins you made I can check out?
In the MV subforum, yeah. But they're very few indeed.
In the MV subforum, yeah. But they're very few indeed.
If you can link them to me; I would love to check them out!

Original thread: https://forums.rpgmakerweb.com/threads/solved-aligning-battle-log-texts-to-center.158933/