Editing the position of the Input Number Window

_Soysauce_

Villager
Member
Joined
Sep 12, 2018
Messages
19
Reaction score
5
First Language
English
Primarily Uses
RMMV
Hi everyone,
I've googled far and away for the simplest of plugins (I'm assuming), but at this point I'm pretty positive nobody cares enough for the input number window, as most plugins seem to be a complete overhaul of it.

I'm working on a project that resizes the game window to 288x192px (pretty unusual size, yeah).
Thanks to fullscreen, no anti-aliasing and a few other touches I think it works pretty good.
Problem is, there's a lot of things to take care on - thanks to the wonderful HIME_HMSChoiceDisplayMode plugin, I got the choices embed into the messages, which works great.

And now there's the Number Input window, which is perfectly working... but not in frame.
And I'm just way too inept at Java to figure out how to simply be able to change its X and Y coordinates.

I don't want to waste talented programmer's time, but after a few days of trying to come up with alternatives and solutions I really have nowhere to turn to, and I hope it turns out it's an amazingly simple thing that can be accomplished by a small plugin.

Thanks a lot for anybody that might give it a shot!
 

megumi014

Veteran
Veteran
Joined
Mar 8, 2017
Messages
130
Reaction score
212
First Language
Spanish
Primarily Uses
RMMV
EDIT: Ok this is embarassing I read Name Input instead of Number input :'D I will change the answer.

Hiya! I don't know how to make it as a plugin, but if no one can do one I can explain you how to change it from the code meanwhile.

In the rpg_windows.js archive (in the js folder) search Window_NumberInput. In the updatePlacement part is where these windows coordinates are fixated:

Code:
Window_NumberInput.prototype.updatePlacement = function() {
    var messageY = this._messageWindow.y;
    var spacing = 8;
    this.width = this.windowWidth();
    this.height = this.windowHeight();
    this.x = (Graphics.boxWidth - this.width) / 2;
    if (messageY >= Graphics.boxHeight / 2) {
        this.y = messageY - this.height - spacing;
    } else {
        this.y = messageY + this._messageWindow.height + spacing;
    }
};
So depending on where you want to move the window you can change manually the value there, but it will stay on that position every time, to change the location in different places during the game yep, I guess you would need a plugin. For example change [this.x = (Graphics.boxWidth - this.width) / 2;] for [this.x = 0;] and it should stick the window to the left side of the screen.

I hope this helps you until someone can make a plugin for it (or I learn someday how to do them lol).
 
Last edited:

_Soysauce_

Villager
Member
Joined
Sep 12, 2018
Messages
19
Reaction score
5
First Language
English
Primarily Uses
RMMV
EDIT: Ok this is embarassing I read Name Input instead of Number input :'D I will change the answer.

Hiya! I don't know how to make it as a plugin, but if no one can do one I can explain you how to change it from the code meanwhile.

In the rpg_windows.js archive (in the js folder) search Window_NumberInput. In the updatePlacement part is where these windows coordinates are fixated:

Code:
Window_NumberInput.prototype.updatePlacement = function() {
    var messageY = this._messageWindow.y;
    var spacing = 8;
    this.width = this.windowWidth();
    this.height = this.windowHeight();
    this.x = (Graphics.boxWidth - this.width) / 2;
    if (messageY >= Graphics.boxHeight / 2) {
        this.y = messageY - this.height - spacing;
    } else {
        this.y = messageY + this._messageWindow.height + spacing;
    }
};
So depending on where you want to move the window you can change manually the value there, but it will stay on that position every time, to change the location in different places during the game yep, I guess you would need a plugin. For example change [this.x = (Graphics.boxWidth - this.width) / 2;] for [this.x = 0;] and it should stick the window to the left side of the screen.

I hope this helps you until someone can make a plugin for it (or I learn someday how to do them lol).
Thanks, that does help to change the X position. Things seem to still be a bit tricky with Y, though.
On a new project, I can delete anything from [if (messageY >= Graphics.boxHeight / 2)] and turn it into [this.y = 0;], and it does work to change the Y position of the window. But with YEP_CoreEngine, which I'm using to alter the resolution to 288x192px, it seems to have no effect. Only X works, and Y seems to be stuck and not move upward or downward, whatever number I put into.

I'm completely uneducated on javascript, and have no idea at this point if this is still small fish or something more complicated.
 

megumi014

Veteran
Veteran
Joined
Mar 8, 2017
Messages
130
Reaction score
212
First Language
Spanish
Primarily Uses
RMMV
Thanks, that does help to change the X position. Things seem to still be a bit tricky with Y, though.
On a new project, I can delete anything from [if (messageY >= Graphics.boxHeight / 2)] and turn it into [this.y = 0;], and it does work to change the Y position of the window. But with YEP_CoreEngine, which I'm using to alter the resolution to 288x192px, it seems to have no effect. Only X works, and Y seems to be stuck and not move upward or downward, whatever number I put into.

I'm completely uneducated on javascript, and have no idea at this point if this is still small fish or something more complicated.
Oh that is because Yanfly Message Core also modifies NumberInput, here:

Code:
//=============================================================================
// Window_NumberInput
//=============================================================================

Yanfly.Message.Window_NumberInput_updatePlacement =
    Window_NumberInput.prototype.updatePlacement;
Window_NumberInput.prototype.updatePlacement = function() {
    Yanfly.Message.Window_NumberInput_updatePlacement.call(this);
    var messageY = this._messageWindow.y;
    var messagePosType = $gameMessage.positionType();
    if (messagePosType === 0) {
      this.y = this._messageWindow.height;
    } else if (messagePosType === 1) {
      if (messageY >= Graphics.boxHeight / 2) {
          this.y = messageY - this.height;
      } else {
          this.y = messageY + this._messageWindow.height;
      }
    } else if (messagePosType === 2) {
      this.y = Graphics.boxHeight - this._messageWindow.height - this.height;
    }
};

What it does is attach the NumberInput window to the position of the text window. If you want to change it you could modify the Y on the normal rpg_windows.js like you did and convert this part of Yanfly's plugin to a comment, so it doesn't override the normal code. You can do that writing /* at the beginning and */ at the end of the part you wish to make comment:

Code:
//=============================================================================
// Window_NumberInput
//=============================================================================
/*
Yanfly.Message.Window_NumberInput_updatePlacement =
    Window_NumberInput.prototype.updatePlacement;
Window_NumberInput.prototype.updatePlacement = function() {
    Yanfly.Message.Window_NumberInput_updatePlacement.call(this);
    var messageY = this._messageWindow.y;
    var messagePosType = $gameMessage.positionType();
    if (messagePosType === 0) {
      this.y = this._messageWindow.height;
    } else if (messagePosType === 1) {
      if (messageY >= Graphics.boxHeight / 2) {
          this.y = messageY - this.height;
      } else {
          this.y = messageY + this._messageWindow.height;
      }
    } else if (messagePosType === 2) {
      this.y = Graphics.boxHeight - this._messageWindow.height - this.height;
    }
};
*/
Or modify the Y on Yanfly's plugin itself, but since the only thing that function does is modify the Y position, it's redundant.

Yanfly's Terms of Use say that editing is ok as long as you give them proper credit, so if you plan on release your game i'd add another comment saying something like the plugin is slightly edited but still belongs to Yanfly.

If it still doesn't work you should check if there is any other plugin modifying the NumperInput Scene.
 

_Soysauce_

Villager
Member
Joined
Sep 12, 2018
Messages
19
Reaction score
5
First Language
English
Primarily Uses
RMMV
Oh that is because Yanfly Message Core also modifies NumberInput, here:

Code:
//=============================================================================
// Window_NumberInput
//=============================================================================

Yanfly.Message.Window_NumberInput_updatePlacement =
    Window_NumberInput.prototype.updatePlacement;
Window_NumberInput.prototype.updatePlacement = function() {
    Yanfly.Message.Window_NumberInput_updatePlacement.call(this);
    var messageY = this._messageWindow.y;
    var messagePosType = $gameMessage.positionType();
    if (messagePosType === 0) {
      this.y = this._messageWindow.height;
    } else if (messagePosType === 1) {
      if (messageY >= Graphics.boxHeight / 2) {
          this.y = messageY - this.height;
      } else {
          this.y = messageY + this._messageWindow.height;
      }
    } else if (messagePosType === 2) {
      this.y = Graphics.boxHeight - this._messageWindow.height - this.height;
    }
};

What it does is attach the NumberInput window to the position of the text window. If you want to change it you could modify the Y on the normal rpg_windows.js like you did and convert this part of Yanfly's plugin to a comment, so it doesn't override the normal code. You can do that writing /* at the beginning and */ at the end of the part you wish to make comment:

Code:
//=============================================================================
// Window_NumberInput
//=============================================================================
/*
Yanfly.Message.Window_NumberInput_updatePlacement =
    Window_NumberInput.prototype.updatePlacement;
Window_NumberInput.prototype.updatePlacement = function() {
    Yanfly.Message.Window_NumberInput_updatePlacement.call(this);
    var messageY = this._messageWindow.y;
    var messagePosType = $gameMessage.positionType();
    if (messagePosType === 0) {
      this.y = this._messageWindow.height;
    } else if (messagePosType === 1) {
      if (messageY >= Graphics.boxHeight / 2) {
          this.y = messageY - this.height;
      } else {
          this.y = messageY + this._messageWindow.height;
      }
    } else if (messagePosType === 2) {
      this.y = Graphics.boxHeight - this._messageWindow.height - this.height;
    }
};
*/
Or modify the Y on Yanfly's plugin itself, but since the only thing that function does is modify the Y position, it's redundant.

Yanfly's Terms of Use say that editing is ok as long as you give them proper credit, so if you plan on release your game i'd add another comment saying something like the plugin is slightly edited but still belongs to Yanfly.

If it still doesn't work you should check if there is any other plugin modifying the NumperInput Scene.
Well, thanks a lot. It didn't occur to me that Yanfly's MessageCore might override the Input Number, but now I can edit the X and Y parameters and it finally centers the window as it's supposed to.

I plan on keeping it centered at all times, so I guess for me personally it's not a big deal to edit both scripts instead of using a plugin. Thanks again, you're a lifesaver.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

I started to paint again after it didn't fit my female character. (I really intend to draw women)

I was more focused on female characters than men.

Score Rundown for the demo I'm trying to get done before Halloween, Or around it. Ending is based on your score currently.
Oh goooood, why am putting so many skills into my game AAAAAAAAAAAA!
Stream will be live shortly with some pixel art! Feel free to drop by!

Forum statistics

Threads
103,157
Messages
997,706
Members
134,633
Latest member
NeoLightningProductions
Top