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,756
Reaction score
2,849
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,724
Reaction score
8,508
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,410
Reaction score
15,213
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,756
Reaction score
2,849
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,756
Reaction score
2,849
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


1,Randomly generate events with planted spawner events(great flexibility for customization and auto-match player's level)
2,Randomly enter roguelike dungeon
3,Player can exit dungeon or back to town or choose to challenge BOSS at the end of each dungeon
4,Dungeon maps can be randomly generated by a third-party tool
Got locked out of the house yesterday... best friends who had the spare ghosted me. Locksmith had to literally drill thru the lock bc they couldn't pick it. Whole process took 4 hours and far too much money. And they have to come back next week bc they don't have the right cylinder, cause it's an old interlocking lock. I'm livid lol
 I’m probably going to regret this, but I need kobolds for my project and I’ve decided to sprite them myself. This is Attempt #1, front view only.

KoboldFront.gif
It's a shame that Selection Control will not be ported to MZ. I found a neat way of using it to enable ways for tanks to protect squishies. lol
Lately I have been taking a break from game and resource making so I won't get burnt out. But I am also interested in the Game Jams this site periodically holds. It'd be great if I knew when the next one, if any, is planned.

Forum statistics

Threads
115,354
Messages
1,089,229
Members
150,034
Latest member
Kipa_Dev_Team
Top