Im trying to make choices with pictures, but i want to move cursor with mouse wheel.
MV Is there any script command to check if mouse wheel down or up?
Javascript/Plugin Support👋 It's
If you're interested in the choice window, note that by default the wheel is used to scroll new items into view, not change which item is selected. To change this behaviour, you can try putting this code in a .js file (copy+paste into a text editor, Save As > File Type: All Files, Filename: whatever.js) and importing it as a plugin (untested):
If you want this new behavior to only apply to the choice window, replace
TouchInput.wheelY; the core scripts seem to check against a threshold of 20, i.e.
JavaScript:
if (TouchInput.wheelY >= 20) {
// wheel moved +
} else if (TouchInput.wheelY <= -20) {
// wheel moved -
}
If you're interested in the choice window, note that by default the wheel is used to scroll new items into view, not change which item is selected. To change this behaviour, you can try putting this code in a .js file (copy+paste into a text editor, Save As > File Type: All Files, Filename: whatever.js) and importing it as a plugin (untested):
JavaScript:
// Override!
Window_Selectable.prototype.processWheel = function() {
if (this.isOpenAndActive()) {
var threshold = 20;
if (TouchInput.wheelY >= threshold) {
this.cursorDown(); // originally this.scrollDown();
}
if (TouchInput.wheelY <= -threshold) {
this.cursorUp(); // originally this.scrollUp();
}
}
};
Window_Selectable with Window_ChoiceList.Thanks for the reply! Im trying doing this, but nothing happened! (Parallel process)
Try something like this instead:
Notes:
Code:
◆Loop
◆Comment:Check cancel
◆If:Button [Cancel] is pressed down
◆Break Loop
◆
:Else
◆Comment:Check wheel state this frame
◆If:Script:TouchInput.wheelY >= 20
◆Text:None, Window, Bottom
: :Wheel down!
◆
:Else
◆If:Script:TouchInput.wheelY <= -20
◆Text:None, Window, Bottom
: :Wheel up!
◆
:End
◆
:End
◆
:End
◆Comment:Check again next frame
◆Wait:1 frame
◆
:Repeat Above
◆Comment:--------------------------------------------------
: :Wait for cancel to be released before ending the event.
: :This avoids triggering the menu every time.
◆Loop
◆If:Button [Cancel] is pressed down
◆Wait:1 frame
◆
:Else
◆Break Loop
◆
:End
◆
:Repeat Above
- Conditional Branch > Script expects an expression that evaluates to true or false. An
ifstatement is neither of those.
- If you wait 6 frames and the user scrolls the wheel between those, the game won't see the wheel change. Wait 1 frame between loops when checking input! 🙏
- If you're doing this in Parallel then you can get rid of the Loop command, because Parallel events trigger whenever they are active and not already running. Also, if you're using a Parallel event (rather than Autorun) for picture-menu stuff that seems a bit strange...I'm guessing you have a reason for that, though.
Thank you very much man!!!
Original thread: https://forums.rpgmakerweb.com/threads/is-there-any-script-command-to-check-if-mouse-wheel-down-or-up.132082/