-
Notifications
You must be signed in to change notification settings - Fork 0
/
autoFollow3.3.ahk
140 lines (134 loc) · 4.91 KB
/
autoFollow3.3.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
;;;;; NEEDED TO RUN ;;;;;
#Include <classMemory>
#include botLauncherConfigBARD.ini
;;;;; OPTOMIZE SORCERY ;;;;;
#singleinstance force
#NoEnv
SetBatchLines -1
ListLines Off
;;;;; OTHER GOODIES ;;;;;
coordmode, mouse, client
coordmode, pixel, screen
coordmode, tooltip, screen
#InstallMouseHook
SetKeyDelay, 0, 0
;;;;; SET THE WINDOW ID/NAMES ;;;;;
WinGet, id, List, BlankTK
loop, %boxes% {
WinSetTitle, % "ahk_id " id%A_Index%, , freedomPoet%A_Index%
freedomPoet%a_index% := new _ClassMemory("freedomPoet"a_index, "", hProcessCopy)
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;; ON THE GO SCRIPT MAINTENANCE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
~$`::Suspend
~!r::Reload
~!^q::exitApp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;; TOGGLE BOT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$+f6::
inputbox, followDistance, FOLLOWER, How close?,,150,140,,,,30,3
return
$f6::
if (autoFollow = 1) {
autoFollow = 0
autoFollowState = OFF
return
}
if (autoFollow != 1) {
autoFollow = 1
autoFollowState = ON
return
}
return ; if nothing
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;; MOVE ALL CHARS TO ACTIVE WINDOW ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$^f6::
; presets
autoFollow = 0
autoFollowState = OFF
loop { ; infinite loop, can't use a_index here
ping1 := A_TickCount ; start the stop watch ping timer
loop % boxes { ; search for active window
WinGetActiveTitle, activeWindow
if (autoFollow=1) and (activeWindow = "freedomPoet"a_index) { ; turned on and leader is active
loop % boxes { ; pull all current x/y coords and do some maths
map%a_index% := freedomPoet%a_index%.readString(0x6FE204,,, 0xF8)
x%a_index% := freedomPoet%a_index%.read(0x6FE238, "UInt", 0xFC)
y%a_index% := freedomPoet%a_index%.read(0x6FE238, "UInt", 0x100)
if (activeWindow = "freedomPoet"a_index) {
xLeader := freedomPoet%a_index%.read(0x6FE238, "UInt", 0xFC)
yLeader := freedomPoet%a_index%.read(0x6FE238, "UInt", 0x100)
}
if (xLeader > x%a_index%)
2x%a_index% := xLeader - x%a_index%
if (xLeader <= x%a_index%)
2x%a_index% := x%a_index% - xLeader
if (yLeader > y%a_index%)
2y%a_index% := yLeader - y%a_index%
if (yLeader <= y%a_index%)
2y%a_index% := y%a_index% - yLeader
3x%a_index% := xLeader - x%a_index%
3y%a_index% := yLeader - y%a_index%
;cache section for map follow
}
loop %boxes% { ; move all non-active windows to active window
if ((2x%a_index% + 2y%a_index%) > followDistance) and (activeWindow != "freedomPoet"a_index) { ; too far away and not active window
if (2x%a_index% > 2y%a_index%) and (3x%a_index% > 0) { ; right
Controlsend,, {right 2}, freedomPoet%A_Index%
random, rand1, 1, 3
if rand1 = 1
Controlsend,, {down 2}, freedomPoet%A_Index%
if rand1 = 2
Controlsend,, {up 2}, freedomPoet%A_Index%
if rand1 = 3
Controlsend,, {right 2}, freedomPoet%A_Index%
if rand1 = 4
Controlsend,, {left 2}, freedomPoet%A_Index%
}
if (2x%a_index% > 2y%a_index%) and (3x%a_index% < 0) { ; left
Controlsend,, {left 2}, freedomPoet%A_Index%
random, rand1, 1, 3
if rand1 = 1
Controlsend,, {up 2}, freedomPoet%A_Index%
if rand1 = 2
Controlsend,, {down 2}, freedomPoet%A_Index%
if rand1 = 3
Controlsend,, {left 2}, freedomPoet%A_Index%
if rand1 = 4
Controlsend,, {right 2}, freedomPoet%A_Index%
}
if (2x%a_index% <= 2y%a_index%) and (3y%a_index% > 0) { ; down
Controlsend,, {down 2}, freedomPoet%A_Index%
random, rand1, 1, 3
if rand1 = 1
Controlsend,, {left 2}, freedomPoet%A_Index%
if rand1 = 2
Controlsend,, {right 2}, freedomPoet%A_Index%
if rand1 = 3
Controlsend,, {down 2}, freedomPoet%A_Index%
if rand1 = 4
Controlsend,, {up 2}, freedomPoet%A_Index%
}
if (2x%a_index% <= 2y%a_index%) and (3y%a_index% < 0) { ;left
Controlsend,, {up 2}, freedomPoet%A_Index%
random, rand1, 1, 3
if rand1 = 1
Controlsend,, {right 2}, freedomPoet%A_Index%
if rand1 = 2
Controlsend,, {left 2}, freedomPoet%A_Index%
if rand1 = 3
Controlsend,, {up 2}, freedomPoet%A_Index%
if rand1 = 4
Controlsend,, {down 2}, freedomPoet%A_Index%
}
}
} ; end move all chars
} ; end bot loop
} ; end search for active window
tooltip, autoFollow: %autoFollowState%,0, 90
sleep, 100
}
return