0
votes

I have a 4 button mouse and am trying to manage complex, extensive MMO spell rotations quickly by mapping a combination of modified clicks to the 1-8 keys.

My goal is:

  • While holding down (3rd Mouse Button) XButton1, Left Click = 1 Key.
  • While holding down (3rd Mouse Button) XButton1, Right Click = 2 Key.
  • While holding down (4th Mouse Button) XButton2, Left Click = 3 Key.
  • While holding down (4th Mouse Button) XButton2, Right Click = 4 Key.
  • While holding down (3rd Mouse Button) XButton1 and Shift, Left Click = 5 Key.
  • While holding down (3rd Mouse Button) XButton1 and Shift, Right Click = 6 Key.
  • While holding down (3rd Mouse Button) XButton2 and Shift, Left Click = 7 Key.
  • While holding down (3rd Mouse Button) XButton2 and Shift, Right Click = 8 Key.

XButton1 & LButton::
Send 1
XButton1 & RButton::
Send 2
XButton2 & LButton::
Send 3
XButton2 & RButton::
Send 4
XButton1 & +LButton::
Send 5
XButton1 & +RButton::
Send 6
XButton2 & +LButton::
Send 7
XButton2 & +RButton::
Send 8

I'm getting an invalid hotkey error at line 9. I'm completely new to AutoHotkey so this may be all wrong, I'm not sure.

1
your code would misbehave. Either put the hotkey statements in a line each (woxxom did in his answer), or finish every hotkey with a return.phil294

1 Answers

0
votes
  1. You've used + to indicate a Shift key on that line 9 but the combokey notation allows exactly two physical keys to be paired. Solution: check the Shift key state manually with GetKeyState.
  2. Put the hotkey command (Send ...) onto the same line as the hotkey declaration, otherwise all commands below will be executed until a return statement is encountered or to the end of the script (all send commands in your case).

XButton1 & LButton::SendEither(1, 5)
XButton1 & RButton::SendEither(2, 6)
XButton2 & LButton::SendEither(3, 7)
XButton2 & RButton::SendEither(4, 8)

SendEither(key, keyShift) {
    Send % GetKeyState("Shift","P") ? keyShift : key
}