RMMV Select item window sometimes showing up on bottom

cuby

Perpetual Toil
Veteran
Joined
Jun 20, 2015
Messages
119
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,713
Reaction score
2,830
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,372
Reaction score
8,395
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
42,903
Reaction score
14,996
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
119
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,713
Reaction score
2,830
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
119
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,713
Reaction score
2,830
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 Profile Posts

how does everybody even finish anything

i have like 5 projects in the backburner and it's just so sad that i probably won't get to finish all or maybe even any of them
Did you know that 90% of people in the world use the number in their sentence as they see fit?
It's been a long time since I was here but I have a lot of updates... btw I am teaching again about game programming and game design in some schools here in Brazil hahahaha It's good to see kids and teens learning this kind of thing!
welp, I literally can't continue working on ALEX now that my MZ trial is up (unless I somehow place in the jam which I don't remotely deserve to for my unfinished crap) so I am back on my bullshit

Forum statistics

Threads
113,891
Messages
1,078,237
Members
147,985
Latest member
H3ctorGH
Top