Goddiga

Veteran
Veteran
Joined
Oct 3, 2015
Messages
61
Reaction score
10
First Language
Thai
Primarily Uses
RMMV
Hello! I was trying to make the cursor move by itself using "Input._currentState.dir". But, I've stumbled upon some problem.

Ex. When I use "Input._currentState.down = true", the cursor will keep going down on its own only when I pressed Down button. Nothing happened when I pressed Up. I want the cursor to insist on moving down even when I pressed Up button.

And this command seems to have a limit in which it cannot repeat the move to go up and down forever. It will go only one direction. Like, if it goes down, it will stay at the bottom and it won't repeat from the top.

If anyone has any ideas how to do this, please share it with me. Thank you!
 

Fornoreason1000

Black Sheep
Veteran
Joined
Mar 1, 2014
Messages
206
Reaction score
96
First Language
English
Primarily Uses
RMMV
Hi, Now im assuming you want to select something with in a Window.

each window that Inherits from Window_Selectable has a private property called _index and a function called Select( )
_index is what tells the window cursor where it needs to be. the WindowClass waits for you to press up,down et.c before modifying _index via Select()

Code:
Window_Selectable.prototype.processCursorMove = function() {
    if (this.isCursorMovable()) {
        var lastIndex = this.index();
        if (Input.isRepeated('down')) {
            this.cursorDown(Input.isTriggered('down'));
        }
        if (Input.isRepeated('up')) {
            this.cursorUp(Input.isTriggered('up'));
        }
        if (Input.isRepeated('right')) {
            this.cursorRight(Input.isTriggered('right'));
        }
        if (Input.isRepeated('left')) {
            this.cursorLeft(Input.isTriggered('left'));
        }
        if (!this.isHandled('pagedown') && Input.isTriggered('pagedown')) {
            this.cursorPagedown();
        }
        if (!this.isHandled('pageup') && Input.isTriggered('pageup')) {
            this.cursorPageup();
        }
        if (this.index() !== lastIndex) {
            SoundManager.playCursor();
        }
    }
};
and this is all CursorUp Does.


Code:
Window_Selectable.prototype.cursorUp = function(wrap) {
    var index = this.index();
    var maxItems = this.maxItems();
    var maxCols = this.maxCols();
    if (index >= maxCols || (wrap && maxCols === 1)) {
        this.select((index - maxCols + maxItems) % maxItems);
    }
};
and this is what Select Does

Code:
Window_Selectable.prototype.select = function(index) {
    this._index = index;
    this._stayCount = 0;
    this.ensureCursorVisible();
    this.updateCursor();
    this.callUpdateHelp();
};

so i think the solution to your problem is to ditch trying to control Input, and instead directly control the window you want using this information.

here is my Pseudo Code example for forcing a window to select the third item if it exist

Code:
var window = SceneManager._scene.menuCommandWindow; //anything to get your window
window.waitFrames = window.waitFrames || 20;
var destinationIndex = 3;

//this part will call everyframe so a For loop will not work, we also should wait for 20 frames
if (window.waitFrames == 0) {
    if (window._index < destinationIndex) {
        window.cursorDown(); //moves + 1 down -1 for up
        window.waitFrames = 20;
    }
    if (window._index > destinationIndex) {
        window.cursorUp(); //moves + 1 down -1 for up
        window.waitFrames = 20;
    }
    if (window._index == destinationIndex) {
        window.cursorOk();   //Press Okay
        window.waitFrames = 20;
    }

}
window.waitFrames--;

if i were you though, id write up a designated function for forcing windows to make cursor Moves, have them update them when a Windows has forced inputs. have some way of queuing up forced cursor Moves so you can literately jump scene to scene without having to reprogram everything.

just a reminder as well that events do not run at all until you exit the menu after calling Open Menu Screen :)

hope it helps :)
 
Last edited:

Latest Threads

Latest Posts

Latest Profile Posts

I typically ask this on my normal social media channels, but figured there may be good replies here. Anyone got any good horror movie recommendations? I've seen a lot, but I always love getting suggestions! Bonus points if you know which service it is streaming on (in the US) - bring on the spOoooOky!
 After a few distractions (and my annual rough second week of October), I’m getting back on track with my OMGC project.
 Am I overcomplicating it? Yes. Am I going to tone it down? Almost certainly not.
 At least the dialogue stuff is almost done. I need to do the map itself, and then all that’s left is combat.
 Getting there!
Creating 3D CGs for Cutscenes. :kaosalute:

I keep wanting to post every song I make for the game and have to hold back on that because at this rate, I'll have spoiled all the really good stuff lol..
DerniBorges wrote on TSR's profile.
Is there any way this plugin works with the big character, and the QSprite plugin? Using RTP chars, everything works fine, but the big ones, with QSprite, it's like that in the image, it doesn't reflect right. And there is, in the settings, an option to fix it. Thanks.
bug2.png

Forum statistics

Threads
115,902
Messages
1,093,836
Members
151,150
Latest member
cungcapbomnuoc
Top