WoW on a Touchpad (AHK)

Post Reply
User avatar
offheal
Posts: 239
Joined: 19 Aug 2015 16:29

WoW on a Touchpad (AHK)

#1 » Post by offheal » 17 Feb 2016 18:04

Sick tab targeting bro!
Last month blah blah angry blah blah poor blah blah no time blah.. blah, and I decided to write a script for my couch chilling with a notebook (and I do it most of the time lately).
Basically, it remaps Right Mouse somewhere near your movement and skill keys but instead of holding it like you do on mouse (unless its dungeon and dragons online xd) you can toggle it( to lock the camera)
It is a very light weight and basic autohotkeys script.

Code: Select all

#IfWinActive, World of Warcraft
CursorFree:=true
CapsLock::
{
Loop
{
GetKeyState, state, CapsLock, P
if state = D
{
if (CursorFree=true and A_Index<=1)
{
SendInput, {RButton Down}
}
}
else if state = U
{
if (CursorFree=true)
{
CursorFree:=false
break
}
else if (CursorFree=false)
{
CursorFree:=true
SendInput, {RButton up}
break
}
}
}
}
return
so, i chose caps lock for it. when you hold it down, it acts as normal right mouse button. but upon releasing it toggles pressed down state.

there are some extras that I use

Code: Select all

f::
{
if (CursorFree=false)
{
sendinput, {RButton up}{f}
CursorFree:=true
}else if (CursorFree=true)
sendinput, {LButton}{f}
}
return
if you have any spell that requires interaction with cursor/mouse - like blizzard/hellfire/distract spells or mouseover macros
you can call it right out of the locked cam state, not only that but the second key press will click it. And since script tracks basic toggle, you can lock it right away.

I not sure if anyone will ever need it, but may bring new ideas.
P.S: You may even do solid PvE healing with similar macro and at some level it even brings some improvement over classic mouse mechanics.
for AHK enthusiasts read inside
[hide]Problem was that you can't right click and move cam while hovering over UI, but if you move mouse to the clear spot before sending click, you can bring cursor right back.
Ive done it as follows:

Code: Select all

if (CursorFree=true and A_Index<=1)
{ ;if cursor is free takes one sample:
MouseGetPos, xpos, ypos ;mouse position and window dimensions
WinGetPos, X, Y, Width, Height, World of Warcraft
MouseMove, Width/2, Height/2 ;move to the middle of the screen
SendInput, {RButton Down}
}
and when its time to remove toggle

Code: Select all

else IF (CursorFree=false)					;Right mouse is pressed, cursor hidden in the center
{
SendInput, {RButton up}
MouseMove, xpos, ypos
CursorFree:=true
break
}
another imporvement was to check if mouse is really where it should be before pressing it:
as follows

Code: Select all

GetKeyState, state, CapsLock, P
if state = D ;Key is pressed down:
{
if (CursorFree=true and A_Index<=1){ ;if cursor is free takes one sample:
MouseGetPos, xpos, ypos ;mouse position and window dimensions
WinGetPos, X, Y, Width, Height, World of Warcraft

}
else if (CursorFree=true){
MouseMove, Width/2, Height/2 ;move center and start next loop
Loop
{
MouseGetPos, xpos2, ypos2 ;Get new mouse position
if (Width/2=xpos2 and Height/2=ypos2){ ;compare it with coordinates of center the screen
SendInput, {RButton Down} ;finally if they match, press down and break loop
Break
}
}
}

}
[/hide]
Image
Image

Post Reply

Who is online

Users browsing this forum: Lesjeby and 4 guests