Selecting first item in the next row when clicking on Down Arrow from Window_Selectable

Hisao Shou

Veteran
Veteran
Joined
Jan 8, 2015
Messages
146
Reaction score
21
Primarily Uses
Hello, I'm currently trying to make a list of elements and I'm trying to make it work on both PC and Mobile.
For example it is given a list of 4 elements, while having 3 elements per row and this makes the 4th element to be on a new row. I'm using Window_Selectable for this, but the whole window height is the same to fit only 1 row, meaning that the player has to press on the list's DOWN BUTTON in order to get to the second row; Now here is my issue:

Player is able to press on the list's DOWN BUTTON only if he has the first item from the first row selected (because the button attempts to automatically select the item on the next row UNDER the selected item), if for example the player has the second item from the first row selected, the DOWN BUTTON will not work. My request is simple, I want the DOWN BUTTON to select first item on the next row if there is no item available under selected one.

I have tried to modify it myself, I think the mouse wheel has a similar function to what I want, yet I don't understand how to make it down. I'm still a very beginner at plugin scripting.

If you could help me I would be really thankful!
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
1,712
Reaction score
1,162
First Language
EN
Primarily Uses
RMMV
Try putting this in a .js file (Save As > File Type: All Files, Filename: whateverYouLike.js) then import it as a plugin:
JavaScript:
(function(alias) {
'use strict';
	Window_Selectable.prototype.cursorDown = function(wrap) {
		let ix = this.index();
		alias.apply(this, arguments);
		if (this.index() === ix) this.select(this.maxItems() - 1);
	};
})(Window_Selectable.prototype.cursorDown);
:)
 

Hisao Shou

Veteran
Veteran
Joined
Jan 8, 2015
Messages
146
Reaction score
21
Primarily Uses
Try putting this in a .js file (Save As > File Type: All Files, Filename: whateverYouLike.js) then import it as a plugin:
JavaScript:
(function(alias) {[/INDENT]
[INDENT]'use strict';[/INDENT]
[INDENT]    Window_Selectable.prototype.cursorDown = function(wrap) {[/INDENT]
[INDENT]        let ix = this.index();[/INDENT]
[INDENT]        alias.apply(this, arguments);[/INDENT]
[INDENT]        if (this.index() === ix) this.select(this.maxItems() - 1);[/INDENT]
[INDENT]    };[/INDENT]
[INDENT]})(Window_Selectable.prototype.cursorDown);
:)
Thank you very much! It works perfectly!
 

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

Latest Threads

Latest Posts

Latest Profile Posts

I didn't think I'd spend the evening jamming out to the battle theme of a Hole Punch.
Welcome back to the dark era, where everything is in dark mode!
.
.
.
I'm not complaining! :o
Currently without internet due to storm damage and most of our state is devastated. No idea how long I'll be unable to log onto here, but I'll answer questions as soon as I can.
This is supposed to be pso2 photon blast inspired animation
I'm sure this question's been asked before, but I can't find an answer: is there any way to run the Steam version of RPGMaker *without* being logged into Steam? It's a frustrating extra step sometimes.

Forum statistics

Threads
100,716
Messages
978,720
Members
132,336
Latest member
shorp_
Top