Game Development Community

Question regarding scripting mouse inputs

by Louis Hamou-Lhadj · in Torque Game Engine · 01/17/2005 (4:09 pm) · 2 replies

Finally found the right forum to put this in...

Hello, I was wondering if anybody could help me out here. Is there any sort of function or command that would retrieve to me the current position of the cursor on the screen? I have been going through Torque and am trying to figure out if I will be able to easily implement an idea where you would have a regular point and shoot FPS but then if you hold down like "ctrl" your view is locked and instead you can use your mouse cursor to move around the screen. I want to find the coordinates of the cursor once the ctrl key is hit, and then I want to find the coordinates of the cursor after the "ctrl" key is let go. [edit: and then the mouse goes back to controlling the view/aim of the player) ]

I am basically trying to experiment with a sort of "gesture" system, by which the user can make different inputs by moving the mouse in a horizontal line, or a diagonal, or even a circle, and depending on how the mouse is moved while the "ctrl" key is held then a different action can be taken.

Ideally I was hoping I could figure out how to do this through TorqueScript. My knowledge of C++ is entirely console base (I have no experience with visual c++ programming) so trying to mess with the engine intimidates me a bit. Of course if this is the only way to implement by idea then I guess I will have to give in. I searched the forums and resources for this but I had a hard time finding what I was looking for. Any help would be greatly appreciated and I thank you in advance for your time.

#1
01/17/2005 (5:02 pm)
I've been trying to come up with a way to do this only in script, and the only real way I can think of is to try to set up a series of invisible gui boxes on the main play gui in a grid format.

You would then be able to track "hit" events on these various gui buttons, and could (in theory) track a sequence of mouse movements through the buttons.

For example, if you had a grid of 9 of these invisible gui's in a 3 x 3 pattern, every time the mouse enters one of the gui's, you could mark that as a "hit state", and track the order of hit states. Off the top of my head I cannot remember which specific console method is called when the mouse enters a gui, but I'm pretty confident you could do it in this manner.

There are a couple of issues that still would happen with this type of technique, and quite honestly code would be a better way to implement the functionality. In code, you would have a better way of defining the hit areas on the screen, as well as the ability to actually time the movements as well. One of the main issues off the top of my head with this system would be if you needed mouse click events to "pass through" the boxes, for example, if you needed to be able to click on game objects that happened to be behind your input hit boxes.
#2
01/17/2005 (5:30 pm)
Couldn't you just make a new console method to do this?