Donc, j'ai ce code avec moi et je le veux quand j'appuie sur "pavé numero 1" je peux activer et désactiver "LBouton". Script fonctionne réellement si je le lance mais comme j'utilise LButton (bouton gauche de la souris) pour changer certaines options et faire d'autres tâches dans un jeu, si je le laisse juste je ne pourrai pas utiliser LButton pour autre chose que juste le script, donc je veux être en mesure d'activer et de désactiver. Je ne sais pas vraiment si je me suis fait comprendre mais j'espère l'avoir fait. Merci de répondre!Désactiver une partie d'un script/ou raccourci clavier en utilisant un autre
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
Gui,+AlwaysOnTop
Gui,Show,w500 h500 Center,AlwaysOnTop Window
Gui, Add, Text, x10 y15 w105 h90 , Choose your weapon.
Gui, Show, x127 y87 h269 w246, Recoilbot
Gui, Add, DropDownList, x120 y10 w50 vList1 gOnSelect, Off|AK-47|M4A4
#Persistent
Gui, Add, Checkbox, vSjekkboksen, Status
;;;no reason to set the same info every time you click so define outside/before the label
active_pattern := ak_pattern ;semi-redundant and will make sense later
sens:=2.52
key_shoot:="LButton"
modifier:=2.52/sens
;instead of having 29 separate dllcalls with a bunch of if->elses, use an array so you can loop over them
no_pattern := {}
ak_pattern := {1: "-4,7", 2: "4,19", 3: "-3,29"
,4: "-1,31", 5: "13,31", 6: "8,28"
,7: "13,21", 8: "-17,12", 9: "-42,-3"
,10: "-21,2", 11: "12,11", 12: "-15,7"
,13: "-26,-8", 14: "-3,4", 15: "40,1"
,16: "19,7", 17: "14,10", 18: "27,0"
,19: "33,-10", 20: "-21,-2", 21: "7,3"
,22: "-7,9", 23: "-8,4", 24: "19,-3"
,25: "5,6", 26: "-20,-1", 27: "-33,-4"
,28: "-45,-21", 29: "-14,1"}
;"another" pattern, just an example of adding more
m416_pattern := {1: "-4,7", 2: "4,19", 3: "-3,29"
,4: "-1,31", 5: "13,31", 6: "8,28"
,7: "13,21", 8: "-17,12", 9: "-42,-3"
,10: "-21,2", 11: "12,11", 12: "-15,7"
,13: "-26,-8", 14: "-3,4", 15: "40,1"
,16: "19,7", 17: "14,10", 18: "27,0"}
active_pattern := no_pattern ;setting the ak_pattern as the default one at launch, demo purposes
1::active_pattern := ak_pattern
2::active_pattern := m416_patternpattern
3::active_pattern := no_pattern
#IfWInActive, Recoilbot
Numpad1::
ControlGet, outPutVar, Checked , , Button1, Recoilbot
If outPutVar
GuiControl, , Sjekkboksen, 0
Else
GuiControl, , Sjekkboksen, 1
Return
Numpad0::
ControlGet, outPutVar, Checked , , Button1, Recoilbot
If outPutVar
GuiControl, , Sjekkboksen, 1
Else
GuiControl, , Sjekkboksen, 0
return
return
Gui, show
OnSelect:
Gui, Submit, nohide
if (List1 = "AK-47") {
active_pattern:=ak_pattern
}
Else if (List1 = "M4A4") {
active_pattern:=m416_pattern
}
Else if (List1 = "Off") {
active_pattern:= no_pattern
}
return
;using right button so I can close script easier (will change it once script is finished).
LButton::
DllCall("mouse_event", uint, 2, int, 0, int, 0, uint, 0, int, 0) ;send the mouse down like in your script
loop { ;loop "until" key_shoot is released or you've reached the end (empty mag) "a_index > active_pattern.maxindex()"
x := strsplit(active_pattern[a_index],",")[1] ;get the "x" from the item at a_index in active_pattern
y := strsplit(active_pattern[a_index],",")[2] ;get the "y" from the item at a_index in active_pattern
dllcall("mouse_event","UInt",0x01,"UInt",x*modifier,"UInt",y*modifier) ;same relative dllcall like in your script
sleep, 99 ;same...
} until % !GetKeyState(key_shoot,"P") || a_index > active_pattern.maxindex() ;see loop comment
DllCall("mouse_event", uint, 4, int, 0, int, 0, uint, 0, int, 0) ;send the mouse up like in your script