View difference between Paste ID: wVTpQUg2 and 0jMz6Gaj
SHOW: | | - or go back to the newest paste.
1
;============================================================
2
;Auto initialisation, non-user configurable stuff usually
3
;============================================================
4
5
#NoEnv
6
#SingleInstance, Force
7
SendMode, Input
8
SetBatchLines, -1
9
SetWorkingDir, %A_ScriptDir%
10
11
12
;============================================================
13
;configurable stuff, remember that variables need to be global if you want to set them this far from the function
14-
;configurable stuff, remember that varibales need to be global if you want to set them this far from the function
14+
15
global sWindowString:="ahk_exe PathOfExile.exe"
16
17
18
;============================================================
19
;Hotkeys
20
;============================================================
21
22
23
Numpad1:: ;your key of choice to fire this macro
24-
Numpad1::
24+
25
    BonesAndProfane()
26-
    GrenadeBurst()
26+
27
}
28
29
30
31
32
;============================================================
33
;Main process or loop
34
;============================================================
35
36
BonesAndProfane()
37-
GrenadeBurst()
37+
38
39
    ;fire bones then fire the debuff
40-
    ;Fire flash bang then fire gas grenade
40+
    SuperSend("f","both",1000,1200,,sWindowString) ;bones
41-
    SuperSend("t","both",35,840,,sWindowString)
41+
    SuperSend("q","both",35,1200,,sWindowString) ;profane
42-
    SuperSend("q","both",35,1050,,sWindowString)
42+
43
/* 
44
    The one-line SuperSend function largely replaces the need to do a series of
45
    commends for key combos with ideal timing
46
47
    Here's is how I had previously written the above for just 2 skils;
48
49
    send {t down}
50
    rsleep(35)
51
    send {t up}
52
    rsleep(840)
53
    send {q down
54
    rsleep(50)
55
    send {q up}
56
    rsleep(1050)
57
*/
58
59
}
60
61
;============================================================
62
;Functions and classes etc
63
;============================================================
64
65
66
    SuperSend(key,direction,delay:=50,postdelay:=0,repetition:=1, winactiveString:=0)
67
    {
68
    ;A way to do more repeat sends when the application is flaky with just a single send. Don't go big on the repetitions.
69
            
70
    ;First three parameters must be enclosed in quotes ""
71
        
72
    ;The key is the key you want to send
73
    ;The direction should be "up" or "down" for partial keys, "both" for a regular down then up
74
        
75
    ;The following paramters are optinoal:
76
    ;Delay is how many ms between the up and the down, only applies to normal key presses
77
    ;postdelay is a delay that will occur after the key press. for "both" it occurs after the up, otherwise occurs after the part key press
78
    ;Reptition is how many loops, defaulting to 1
79
    ;winactiveString is the string to pass to ifwinactive and can be the normal paramters acceptable by that function, e.g. "ahk_exe PathOfExile.exe"
80
        
81
        
82
        if delay<1
83
            delay:=0
84
        
85
        if (direction = "both") ;do this for normal key sends
86
        {
87
            sStringDown:=(key . " down")
88
            sStringUp:=(key . " up")
89
90
            Loop, %repetition%
91
            {
92
93
                Send {%sStringDown%}
94
                RSleep(delay)
95
                Send {%sStringUp%}
96
97
                if postdelay>0
98
                    {
99
                        RSleep(postdelay)
100
                    }
101
            }
102
            
103
        }
104
        else ;do this when you just want key up or key down, such when applications aren't handle single key down reliably.
105
        {
106
            sString:=(key . " " . direction)
107
            
108
            Loop, %repetition%
109
            {
110
                ifwinactive, %winactiveString%
111
                {
112
                    Send {%sString%}
113
114
                    if postdelay>0
115
                        {
116
                            RSleep(postdelay)
117
                        }
118
                }
119
            }
120
        }
121
         
122
    }
123
124
125
    RSleep(duration,variance:=10)
126
    {
127
        min:=duration
128
        max:=min+variance
129
        random,RND,min,max
130
        sleep %RND%
131
    }