Hello, basically I have a script with two ahk groups, I'm trying to have it to share the same function. However some keys for the group "ext" stopped functioning, I guess it's due to duplicate keys from group "gw2"
I wanted group "ext" to function the commands when in "action camera mode" and return to its original function when out of "action camera mode"
Wheelleft:: and XButton1:: xbutton2:: being duplicated and override
Code: Select all
#NoEnv
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
#KeyHistory 0
ListLines Off
Process, Priority, , A
SetBatchLines, -1
SetKeyDelay, -1, -1
SetWinDelay, -1
SetControlDelay, -1
settimer, check, 100
DllCall("ntdll\ZwSetTimerResolution","Int",5000,"Int",1,"Int*",MyCurrentTimerResolution)
GroupAdd, gw2, Guild Wars 2 ;GroupAdd Gw2
GroupAdd, gw2, `.00
GroupAdd, ext, `.01 ;GroupAdd Ext
VarSetCapacity(active_cursor,A_PtrSize+16) ;Gw2 Action Camera
mouse_button_right := "f1"
mouse_wheel_up:="8"
mouse_wheel_down:="7"
mouse_wheel_left:="8"
;#If (WinActive("ahk_group gw2") AND WinActive("ahk_exe Gw2-64.exe"))
#IfWinActive ahk_exe Gw2-64.exe ;Gw2 Action Camera
RButton::
if GetKeyState("LButton","P") and !Action_Camera_LMB
allow_key("RButton","down")
else if Check_Cursor(active_cursor) = 0 {
allow_key(mouse_button_right,"down")
Action_Camera_RMB := true
}
else
allow_key("RButton","down")
return
RButton up::
if Action_Camera_RMB {
allow_key(mouse_button_right,"up")
Action_Camera_RMB := false
}
else
allow_key("RButton","up")
return
WheelUp::
if Check_Cursor(active_cursor) = 0 {
Send, {%mouse_wheel_up%}
}
else
Send, {WheelUp}
return
WheelDown::
if Check_Cursor(active_cursor) = 0 {
Send, {%mouse_wheel_down%}
}
else
Send, {WheelDown}
return
Wheelleft::
if Check_Cursor(active_cursor) = 0 {
Send, {%mouse_wheel_left%}
}
else
Send, {Wheelleft}
return
Wheelleft up::
if Action_Camera_RMB {
allow_key(mouse_wheel_left,"up")
Action_Camera_RMB := false
}
else
allow_key("Wheelleft","up")
return
allow_key(key,state) { ;Gw2 Action Camera
global
Send,{Blind}{%key% %state%}
if !WinActive(GMWI) {
Critical,Off
KeyWait,%key%
Send,{Blind}{%key% up}
}
return
}
Check_Cursor(ByRef cursor) {
NumPut(A_PtrSize+16,cursor)
DllCall("GetCursorInfo","uint",&cursor)
return NumGet(cursor,4)
} ;Gw2 Action Camera
xbutton1::send {]}{\} ;Gw2 Target
xbutton2::send {[}{\}
check: ;Else If ahk_group ext
(id := WinExist("ahk_group ext"))
MouseGetPos,,,Win
return
#If (Win == id)
XButton1::
send {click}
send {enter}
return
XButton2::i
F7::Esc
Wheelleft:: ;chest
send {click}
send {Click, 1840, 2000, right}
MouseMove, 1710, 1975
sleep 400
Send !{F4}
return