Author Topic: Basic mouse-to-keyboard movement command  (Read 2973 times)

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4631
  • RTFM
Basic mouse-to-keyboard movement command
« on: May 31, 2023, 02:47:18 AM »
Attached is a profile containing four versions of essentially the same command, which will translate mouse movement to keyboard keypresses.

When the command is started, the current mouse cursor position will be registered, and moving the cursor a specified distance away from that position will trigger the holding and/or releasing of certain keys.
To stop keys being held down, move the cursor back to its starting position.


Note that these commands do not attempt any pseudo analog-to-digital conversion where how fast you move the cursor determines how often a given key is pressed.
Instead it operates basically like a digital (eight-way) joystick, where the absolute position away from the center results in a given constant movement.


By default, only one command is enabled within the profile, which will perform its function of pressing the WASD keys while the Caps Lock key is held down.

The second version will function identically, but press the ZQSD keys for those with a corresponding keyboard layout, instead.


There are also versions for both WASD and ZQSD of an alternate operating mode where pressing the Caps Lock key once will start the command, and pressing the Caps Lock key again will stop it.


If you'd like to use a command other than the default, edit the command that currently has its "When I press keys" option enabled (I.E. doesn't have that grayed out in the command list) and uncheck that option, then edit the command you'd like to use instead and check the "When I press keys" option for that command.

If you'd prefer to use a key other than Caps Lock, you can change the key (combination) assigned to the "When I press keys" option.
No further changes are required; none of the actions check this key.


At the top of each command are the two threshold values: one for left and right, one for up and down. If you find there is too much or too little "deadzone" when moving your mouse cursor, these values can be decreased or increased.


The main limitations of this command are that it's not feasible to show any reference points on screen, so you need to remember where you started, and that any games that force the mouse cursor to stay in the center of the screen (even though the ingame mouse cursor won't show it) will likely not allow this command to function correctly.

thatguy52

  • Newbie
  • *
  • Posts: 4
Re: Basic mouse-to-keyboard movement command
« Reply #1 on: December 30, 2023, 03:35:26 PM »
So if I'm reading this correctly is there no way to have the keys be pressed only when the mouse moves instead of a toggle? For example, if the program reads the mouse as moving to the left it would hold down the A key until the mouse stops and then it would release. The same goes for the D key. Does it have to toggle until you center the mouse again to the original position? I'm looking for a command just like this for driving vehicles with the mouse but it would seem like having it toggle until you center it would make driving difficult versus only having the key held when the mouse moves a specific direction.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4631
  • RTFM
Re: Basic mouse-to-keyboard movement command
« Reply #2 on: December 31, 2023, 12:15:26 AM »
This profile does not facilitate that, no. That doesn't mean it's impossible.

thatguy52

  • Newbie
  • *
  • Posts: 4
Re: Basic mouse-to-keyboard movement command
« Reply #3 on: December 31, 2023, 09:09:09 AM »
So, would you be able to tell me how I could modify the script to function the way I was talking about above rather than having to center it to release the toggle? I have a script for the glovepie I've been using for years but if I could get the same function out of voice  attack that would be great.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4631
  • RTFM
Re: Basic mouse-to-keyboard movement command
« Reply #4 on: December 31, 2023, 09:11:35 AM »
It's not a matter of simple modification. It'd require a complex new command.

If you have a working solution already, it'd make more sense to stick with that.

thatguy52

  • Newbie
  • *
  • Posts: 4
Re: Basic mouse-to-keyboard movement command
« Reply #5 on: December 31, 2023, 09:32:23 AM »
I do like what I have set up already  but my fear is glovepie is no longer being updated and eventually it might stop working.thats why I've been looking for an alternate solution just in case. I also like voice attacks set up for VoiceCommands but I really don't want to have to run both programs at once to get what I want out of them.