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,755
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,713
Reaction score
8,497
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,385
Reaction score
15,195
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,755
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,755
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 Threads

Latest Posts

Latest Profile Posts

Another comic with Backstage Malak...
If you want to ask him anything, you can ask on my DeviantArt page! I'm not sure if you're allowed to do it here.
Forum tip of the day ...
If you get a temporary suspension for being a jerk to people who are trying to help you, and arguing with mods and admins, don't go making new accounts. Chances are, if you p**s us off enough to suspend you for a week, we're not going to hesitate giving you a permanent ban when you give us a reason.
E_6fAErVkAQILXu.png
I'm so close to releasing my game on steam! :blush::blush::blush:
Us:
"This game is awesome! I wish there are more games like this in the future."
Also us:
"I hate how games stopped being original and start copying other successful games."
Should've done this a few days ago but...
PRI_200136808.jpg
Rest in Peace, Sir Clive Sinclair
1940 - 2021
Entrepreneur, Technologist, Father of the Modern British Computing Industry, and protagonist of Legend of ZUN.

Without you, England's games and tech industry wouldn't be where it is.

Forum statistics

Threads
115,292
Messages
1,088,686
Members
149,927
Latest member
antodi
Top