Code: Select all
active_pattern := ak2pattern ;semi-redundant and will make sense later
sens:=1.52
key_shoot:="LButton"
modifier:=1.52/sens
;instead of having 29 separate dllcalls with a bunch of if->elses, use an array so you can loop over them
;"another" pattern, just an example of adding more
ak2pattern := {1: "0,5", 2: "1,5", 3: "0,5"
, 4: "3,5", 5: "0,5", 6: "1,5"
, 7: "0,5", 8: "1,2", 9: "0,2"
, 10: "1,2", 11: "0,2", 12: "0,1"
, 13: "0,1", 14: "0,1", 15: "-1,0"
, 16: "-1,0", 17: "-0,1", 18: "-0,1"
, 19: "0,0", 20: "0,1", 21: "0,0"
, 22: "0,1", 23: "1,0", 24: "0,1"
, 25: "1,0", 26: "-1,0", 27: "-0,0"
, 28: "-0,0", 29: "-1,0" , 30: "1,0"
, 31: "0,0" , 32: "0,1" , 33: "1,1"}
active_pattern := ak2pattern ;setting the ak_pattern as the default one at launch, demo purposes
;;simplified version of getting the active weapon, and instead of it setting a string, just sets the pattern to be used, demo purposes
8::active_pattern := ak2pattern
;;just a hotkey instead of chain of labels for simplicity, demo purposes
lbutton::
if (active_pattern) { ;make sure the equipped weapon has a pattern
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
}
return
F4::Suspend