How to check mousewheel scrolling in a blocking while loop

Started by Trapezoid, Tue 24/02/2015 22:21:15

Previous topic - Next topic

Trapezoid

I have two custom menu systems in my game. One for verbs, one for dialog. They work pretty similarly: the menu pops up, enters a while loop sort of like this:
Code: ags

bool chosen;
while (chosen==false) {
    if (IsKeyPressed(eKeyDownArrow)) [[[scroll menu down]]]
    if (IsKeyPressed(eKeyUpArrow)) [[[scroll menu down]]]
    if (IsKeyPressed(eKeyReturn) || Mouse.IsButtonDown(eMouseLeft)) chosen = true;
Wait(1);
}

(They're more complicated than that, checking for mouse movement as well.)

Basically, I want to add the ability to scroll the menu with the mousewheel during this loop. But apparently eMouseWheelNorth and eMouseWheelSouth can ONLY be detected by on_mouse_click. And on_mouse_click does not fire during a while loop. Is there any workaround?

Snarky

Quote from: Trapezoid on Tue 24/02/2015 22:21:15And on_mouse_click does not fire during a while loop. Is there any workaround?

ITYM on_mouse_click doesn't fire during a Wait(). The obvious answer would be to not be in the wait state, but rewrite it as a rep_exec check.

Trapezoid

Hmm yeah, I think that would take some rewriting, might not be worth it. I was just wondering if the mousewheel events could be detected the same way keystrokes and clicks can.
One simple idea-- I'm already making a launcher wrapper for the game with Autohotkey, and I can code it to convert mousewheel events to up/down keystrokes whenever the game's in focus.

SMF spam blocked by CleanTalk