MV Scene Item - Scrolling 'issue' with default menu.

I'm facing an "issue" with the default Item Menu: it won't scroll down to the last item in a specific situation.

1748203658350.png


There are 7 items in the bag, however I can't access the last item (by pressing 'Down') if the cursor is on Item 6. I have to scroll to Item 5 and then press 'Down' to get to Item 7.
It works if I press 'Right' while on Item 6, but "pressing Right to go down" is not ideal...

1748203954865.png


I was wondering if there's a way to make the cursor go from Item 6 to Item 7 by pressing 'Down'.
And also stop 'Right' and 'Left' from going down and up the list.
Any help is appreciated.

(Sorry if this is the wrong place, or if there's already a thread about this. My searches were not fruitful...)
Bump?
👋 You can save this as a .js file (Save As -> File Type: All Files, Filename: whatever.js) then import it as a plugin:
JavaScript:
/*:
 * @target MV MZ
 * @plugindesc Select last item if cursor down fails.
 * @author Caethyril
 * @url https://forums.rpgmakerweb.com/threads/177919/
 * @help Free to use and/or modify for any project, no credit required.
 */
;void (function() {
"use strict";
  const alias = Window_Selectable.prototype.cursorDown;
  Window_Selectable.prototype.cursorDown = function() {
    const n = this.index();              // memorise current index
    alias.apply(this, arguments);        // proc as usual
    if (this.index() === n)              // if index is unchanged, then
      this.select(this.maxItems() - 1);  // select last item
  };
})();

To also disable right/left row changes, you could try adding these lines to the end of that code:
JavaScript:
void (function(alias) {
  Window_Selectable.prototype.cursorLeft = function() {
    if (this.index() % this.maxCols() !== 0)        // only if not in left-most column
      alias.apply(this, arguments);
  };
})(Window_Selectable.prototype.cursorLeft);
void (function(alias) {
  Window_Selectable.prototype.cursorRight = function() {
    if ((this.index() + 1) % this.maxCols() !== 0)  // only if not in right-most column
      alias.apply(this, arguments);
  };
})(Window_Selectable.prototype.cursorRight);
(Because the first/top-left item in a selectable list is index 0.)

As-is, these changes will apply to all selectable windows. To make them apply only to Item list windows, you can replace all instances of Window_Selectable with Window_ItemList.
Hmmm, shouldn't you also check that maxItems is uneven, because now if it's even with 2 columns it'll jump from bottom left to bottom right when you press down...unless I'm confused LOL?

EDIT: Not like that would really matter much, but OP seemed strict with their cursor movements 😀
👋 You can save this as a .js file (Save As -> File Type: All Files, Filename: whatever.js) then import it as a plugin:
JavaScript:
/*:
 * @target MV MZ
 * @plugindesc Select last item if cursor down fails.
 * @author Caethyril
 * @url https://forums.rpgmakerweb.com/threads/177919/
 * @help Free to use and/or modify for any project, no credit required.
 */
;void (function() {
"use strict";
  const alias = Window_Selectable.prototype.cursorDown;
  Window_Selectable.prototype.cursorDown = function() {
    const n = this.index();              // memorise current index
    alias.apply(this, arguments);        // proc as usual
    if (this.index() === n)              // if index is unchanged, then
      this.select(this.maxItems() - 1);  // select last item
  };
})();

To also disable right/left row changes, you could try adding these lines to the end of that code:
JavaScript:
void (function(alias) {
  Window_Selectable.prototype.cursorLeft = function() {
    if (this.index() % this.maxCols() !== 0)        // only if not in left-most column
      alias.apply(this, arguments);
  };
})(Window_Selectable.prototype.cursorLeft);
void (function(alias) {
  Window_Selectable.prototype.cursorRight = function() {
    if ((this.index() + 1) % this.maxCols() !== 0)  // only if not in right-most column
      alias.apply(this, arguments);
  };
})(Window_Selectable.prototype.cursorRight);
(Because the first/top-left item in a selectable list is index 0.)

As-is, these changes will apply to all selectable windows. To make them apply only to Item list windows, you can replace all instances of Window_Selectable with Window_ItemList.

You're awesome 😢
Thank you so much!
Hmmm, shouldn't you also check that maxItems is uneven, because now if it's even with 2 columns it'll jump from bottom left to bottom right when you press down...
Good point! Personally I'd check the row instead, to support 3+ columns. E.g. change this line:
JavaScript:
    if (this.index() === n)              // if index is unchanged, then
...to this:
JavaScript:
    if (this.index() === n && this.row() !== this.maxRows() - 1)
I.e. "if cursor down failed and we're not on the bottom row".

Thank you so much!
You're welcome! Happy RPG Making~
I got the fix here too for each arrow (so it works for each colums/rows)
which I had as I hated the default didn't do that or jump back to top and
stick on the bottom.

you can find the fix here just in case if you want it more improved.

this fix is overridden of the 4 functions to make it work correctly.

find it [here], or if you want to test it though.
I got the fix here too for each arrow (so it works for each colums/rows)
which I had as I hated the default didn't do that or jump back to top and
stick on the bottom.

you can find the fix here just in case if you want it more improved.

this fix is overridden of the 4 functions to make it work correctly.

find it [here], or if you want to test it though.
I'm having an issue... :blush: When the cursor loops around vertically, the help window doesn't update and keeps the description of the last selected item.

loop.gif
thats weird, as it works on my end, so I cannot really tell on that part as
it only fix the arrow and don't touch the help section.

I use my base where I have it in, as stand alone it works as well.
if its only 1 column than I need to check what does that.

is it only this plugin or do you use other plugins?
is it only this plugin or do you use other plugins?
No other plugins. I thought it was a conflict, but that also happens in a blank project.
gonna test it again on my end a bit later.

Edit:
No other plugins. I thought it was a conflict, but that also happens in a blank project.
There is indeed an issue as while for UP as well for DOWN, left and right
does work correctly, while its more a global fix to always work (on any amount
of columns (1,2,3,4,5,6,7,8) somehow, the other index doesn't work.

I need to fiddle around that, why the index fails on the helpfile.

(I come back to it though or someone else sees the issue?)

Edit 2:
use the following to update the description correctly.
I might rewrite this function a bit more global or better after testing
it inside my bestiary, than update the other thread on it for usage.

so alter arrowUP and arrowDown with the following:
JavaScript:
    Window_Selectable.prototype.cursorDown = function(wrap) {
        const index = this.index();
        const maxItems = this.maxItems();
        const maxCols = this.maxCols();
        const maxRows = this.maxRows();
        if (index < maxItems - maxCols || (wrap && maxCols === 1)) {
            this.select((index + maxCols) % maxItems);
        } else {
            let newIndex = index - (maxRows * maxCols) + maxCols;
            if (newIndex < 0) {
                newIndex = maxItems - 1;
            }
            this.select(newIndex);
        }
    };

    Window_Selectable.prototype.cursorUp = function(wrap) {
        const index = this.index();
        const maxItems = this.maxItems();
        const maxCols = this.maxCols();
        const maxRows = this.maxRows();
        if (index >= maxCols || (wrap && maxCols === 1)) {
            this.select((index - maxCols + maxItems) % maxItems);
        } else {
            let newIndex = index + (maxRows * maxCols) - maxCols;
            if (newIndex >= maxItems) {
                newIndex = maxItems - 1;
            }
            this.select(newIndex);
        }
    };

so the description does work.
as the UP and DOWN didn't uses "this.select()".

hope that does what you want.

Original thread: https://forums.rpgmakerweb.com/threads/scene-item-scrolling-issue-with-default-menu.177919/