Game Development Community

Looking for recurring gui event hook

by Stephen Zepp · in Torque Game Engine · 06/17/2004 (6:55 pm) · 6 replies

I'm trying to find a recurring event that I can tie into via script that occurs every tick, related to GUI's. Every one that I can find seems to be a "single action" state change, instead of a "repeat until mouse leaves gui" type of event.

Specifically, I want to write a script that sends a command to the server every tick that the mouse is within that guicntrl...I've used our nifty new full text search feature, but everything I can find is purely "on enter" and "on exit" based--what I'm really looking for is a way to catch mMouseOver, but catch it every tick that the mouse is over a screen area.

Any thoughts? This will be used for providing continuous inputs to my orbit cam. For example, when the mouse is moved to the left side of the window/screen, the orbit camera will rotate smoothly and continuously until the mouse is moved back towards the middle. I already have the single tick input working, but I want to call it continuously until the mouse leaves that section of the screen.

TIA!

#1
06/17/2004 (9:12 pm)
Have you tried using schedule() and cancel()?
#2
06/17/2004 (9:23 pm)
Could look in making a script hook for onMouseMove and tracking that.
#3
06/18/2004 (3:42 am)
@Ben: actually that occurred to me late last night, after I wasn't able to find any recurring hooks on my own, but it would do what we need, just not very elegantly, hehe. I was wondering if there was a timed/looped event triggered by the sim somewhere before I dig into a schedule solution.

@Sebastien: Not a bad idea, except that if the mouse enters the gui block, and then stays there with no movement, the camera control function will still be called until the mouse leaves.
#4
06/18/2004 (8:17 am)
Catch the GuiEvent onMouseEnter and have it start a schedule which calls a different function every tick which will turn notify your server.

Then catch the GuiEvent onMouseLeave and have it cancel the schedule.
#5
06/18/2004 (8:37 am)
@Robert: That's exactly what I wound up doing. Technique posted Here.
#6
06/18/2004 (8:38 am)
There isnt really a single function thats called every update. Because by default the GUI's use a dirty region update mechanism. So in theory, some controls dont get asked to redraw.