RMMV Select item window sometimes showing up on bottom

cuby

Perpetual Toil
Veteran
Joined
Jun 20, 2015
Messages
122
Reaction score
19
First Language
English
Primarily Uses
RMMV
I have noticed a quite weird thing -- usually, "select item" opens up the selection window at the top of the screen. I'm not super stoked about that since I'd prefer it at the bottom, but not a big deal.

But I have one event with a Select Item, where it is preceded by a show text that is in the middle, rather than on the bottom. This led to the discovery that if there is a Show Text on screen either on top or in the middle at the time of a Select Item, it opens the selection window at the bottom.

My question is, might there be a way to force RPGMV to open the Select Item window on the bottom, even if preceded by a Show Text on the bottom?

The only thing I can think to try is having the show text on the bottom, followed by a "Wait", then the Select Item. But that places the selection window again at the top, which suggests the top is the default location. Would anyone know a way to shove that window down to the bottom?

Thanks!
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,752
Reaction score
2,848
First Language
English
Primarily Uses
RMMZ
The reason for this is the updatePlacement function in Window_ChoiceList:

JavaScript:
Window_ChoiceList.prototype.updatePlacement = function() {
    var positionType = $gameMessage.choicePositionType();
    var messageY = this._messageWindow.y;
    this.width = this.windowWidth();
    this.height = this.windowHeight();
    switch (positionType) {
    case 0:
        this.x = 0;
        break;
    case 1:
        this.x = (Graphics.boxWidth - this.width) / 2;
        break;
    case 2:
        this.x = Graphics.boxWidth - this.width;
        break;
    }
    if (messageY >= Graphics.boxHeight / 2) {
        this.y = messageY - this.height;
    } else {
        this.y = messageY + this._messageWindow.height;
    }
};

If you want it to work differently, you'll have to edit this, be it directly or via a plugin (preferably a plugin as editing the default scripts is ill-advised)
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
33,692
Reaction score
8,495
First Language
German
Primarily Uses
RMMV
anything can be changed by plugin. and you'll need that plugin to change the default position and behaviour of select item.

but yes, several commands check for show text positions to change their output window positions, exactly to allow for combinations.

EDIT: ninja'd
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,358
Reaction score
15,171
First Language
English
Primarily Uses
RMMV

I've moved this thread to Plugin Requests. Thank you.

 

cuby

Perpetual Toil
Veteran
Joined
Jun 20, 2015
Messages
122
Reaction score
19
First Language
English
Primarily Uses
RMMV
The reason for this is the updatePlacement function in Window_ChoiceList:

Thanks for this @Trihan I'd never have known where to look.

Let me know if I'm interpreting this correctly -- the "position type" is 0, 1, or 2 in the switch function -- that refers to top, middle or bottom. I bet I could figure out which one is which by testing, but I'm trying to understand as much as possible before going in.

It seems I could just change each case to have the same desired bottom position -- any idea which case represents the bottom-position select item window?

And as long as we're digging in here, might you know which function I might look into to increase the number of lines the select item window displays? Ideally, I'd have the select item on the bottom, and it would display 8 lines rather than the default 4.

Thanks again for putting me on the right path -- I'll be experimenting in the meantime!

c

EDIT: I've been messing with that function (via plugin) and as you probably already know, the switch changes the position of the previous message window in ways I don't understand -- I'm going to push pause on that and see if wiser folks can help -- thanks again!

Just to recap lol: hoping to force placement of the select item window, and ideally increase the number of rows.
 
Last edited:

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,752
Reaction score
2,848
First Language
English
Primarily Uses
RMMZ
Thanks for this @Trihan I'd never have known where to look.

Let me know if I'm interpreting this correctly -- the "position type" is 0, 1, or 2 in the switch function -- that refers to top, middle or bottom. I bet I could figure out which one is which by testing, but I'm trying to understand as much as possible before going in.

It seems I could just change each case to have the same desired bottom position -- any idea which case represents the bottom-position select item window?

And as long as we're digging in here, might you know which function I might look into to increase the number of lines the select item window displays? Ideally, I'd have the select item on the bottom, and it would display 8 lines rather than the default 4.

Thanks again for putting me on the right path -- I'll be experimenting in the meantime!

c

EDIT: I've been messing with that function (via plugin) and as you probably already know, the switch changes the position of the previous message window in ways I don't understand -- I'm going to push pause on that and see if wiser folks can help -- thanks again!

Just to recap lol: hoping to force placement of the select item window, and ideally increase the number of rows.
Almost 100% of the time when there's a switch case involving a dropdown in the editor it goes in order of the options from 0 to whatever the last option is. If you look at the "Window Position" setting in a Show Text command:

1624441641255.png

So 0 is Top, 1 is Middle and 2 is Bottom.

However, if you look closely, that code only affects the *x* coordinate of the choice window. The part which changes the y coordinate is:

JavaScript:
if (messageY >= Graphics.boxHeight / 2) {
        this.y = messageY - this.height;
    } else {
        this.y = messageY + this._messageWindow.height;
    }

Breaking this down: if the Y coordinate of the message is greater than or equal to half the screen height, the Y of the choice window will be the Y of the message minus the choice window's height (which will position it above the message window) and if it's *not* greater than or equal to half the screen height (meaning it's at the top or in the middle) the Y of the choice window will be the Y of the message window *plus* the message window's height (which will position it below the message window). If you want it to just be one or the other, then just set this.y to whichever one you always want it to be.

As for the number of items, this is your culprit:

JavaScript:
Window_EventItem.prototype.numVisibleRows = function() {
    return 4;
};

Just change that to 8.
 

cuby

Perpetual Toil
Veteran
Joined
Jun 20, 2015
Messages
122
Reaction score
19
First Language
English
Primarily Uses
RMMV
You are a hero as always @Trihan -- testing now and will edit post with results!

EDIT: The select item rows number change does the job, but I still am not able to get it on either top or bottom by force. I've sort of determined it's not that important.
If it's super simple for you to provide a copypaste of what might force the select item screen to go on the bottom, then that'd be cool, but I don't want you to spend more time than you already have been so generous with.
 
Last edited:

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,752
Reaction score
2,848
First Language
English
Primarily Uses
RMMZ
You are a hero as always @Trihan -- testing now and will edit post with results!

EDIT: The select item rows number change does the job, but I still am not able to get it on either top or bottom by force. I've sort of determined it's not that important.
If it's super simple for you to provide a copypaste of what might force the select item screen to go on the bottom, then that'd be cool, but I don't want you to spend more time than you already have been so generous with.
Try

this.y = Graphics.boxHeight - this.height;
 

Latest Profile Posts

Added a small refining scene to my game.

It makes sense that you try to focus on the squishy mages at the back of the party first, right? If the mage can out-DPS the enemy DPS before the latter can kill the tank in front, the fight becomes boring.
finally got footage of my main character running around the main hub world. I've fixed a few things tho even since this video unsurprisingly lol.
 …I think I might need to switch from standard ATK/DEF up/down buffs to parameter altering states. I just had an actor whose usual attack against an enemy does ~25 do a buffed attack against a debuffed enemy for ~600…

Forum statistics

Threads
115,233
Messages
1,088,273
Members
149,829
Latest member
TheMonkiShogun
Top