View difference between Paste ID: KX5fN6kd and RGPWnxsE
SHOW: | | - or go back to the newest paste.
1
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
2
#AutoIt3Wrapper_Outfile=ISx86Area.exe
3
#AutoIt3Wrapper_Outfile_x64=ISx64.exe
4
#AutoIt3Wrapper_UseX64=n
5
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
6
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
7
#include <ImageSearch.au3>
8
9
#include <GUIConstantsEx.au3>
10
#include <Debug.au3>
11
$sTitle = "My Debug Report"
12
_DebugSetup($sTitle)
13
;~ 		_DebugOut("Search for item:" & $gI)
14
15
16
Global $Paused
17
HotKeySet(",", "Start") ;script started by pressing -
18
HotKeySet(".", "Pause") ;script paused by pressing =
19
HotKeySet("x", "Stop") ;script stopped by pressing x
20
21
Func Start()
22
	$Pause = False
23
EndFunc   ;==>Start
24
25
Func Pause()
26
	$Pause = True
27
EndFunc   ;==>Pause
28
29
Func Stop() ;to allow the script to stop
30
	Exit
31
EndFunc   ;==>Stop
32
33
34
;ImageSearch Looting Variables
35
$directory = "D:\Tmp\Diablo\Png\" ; CHANGE THIS! Point it to the directory with the imagesearch pngs
36
$totalItems = 20 ; This needs to match the number of pngs you are loading
37-
$Legendary[0] = "legendaryA.png" ; Matches "Legenday" 		require tolerance >70 <100 
37+
38
Global $General[2]
39
$General[0] = "uare.png" ; Matches "Square" 			require tolerance >70
40
$General[1] = "tome.png" ; Matches "Tome"   			require tolerance >100
41
42
Global $Legendary[6]
43
$Legendary[0] = "legendaryA.png" ; Matches "Legenday" 		require tolerance >70
44
$Legendary[1] = "legendaryE.png" ;
45-
$Set[0] = "setA.png" ; Matches "Set"  				require tolerance >70
45+
46
$Legendary[3] = "legendaryO.png" ;
47
$Legendary[4] = "legendaryU.png" ;
48
$Legendary[5] = "legendaryY.png" ;
49
50
Global $Set[6]
51
$Set[0] = "setA.png" ; Matches "Set"  					require tolerance >70
52
$Set[1] = "setE.png" ;
53-
$Rare[0] = "rareA.png.png" ; Matches "Rare"			require tolerance >70 >>
53+
54-
$Rare[1] = "rareE.png.png" ;
54+
55-
$Rare[2] = "rareI.png.png" ;
55+
56-
$Rare[3] = "rareO.png.png" ;
56+
57-
$Rare[4] = "rareU.png.png" ;
57+
58-
$Rare[5] = "rareY.png.png" ;
58+
59
$Rare[0] = "rareA.png" ; Matches "Rare"
60
$Rare[1] = "rareE.png" ;
61
$Rare[2] = "rareI.png" ;
62
$Rare[3] = "rareO.png" ;
63
$Rare[4] = "rareU.png" ;
64
$Rare[5] = "rareY.png" ;
65
66
;Timers
67
$walktime = 4500 ; time in ms the script waits for you to enter and load the cellar. Slow this down for slower move speeds and loading times
68
$loadtime = 5000 ; time in ms the script waits for the game to load before it starts pathfinding. Slow this down for slower hard drives
69
$tptime = 6900 ; time in ms the script waits for teleport before exiting the game
70
71
;Settings
72
$Timer = False ; set this to true and the bot will randomly wait (5% chance) in town for 30-60 seconds before starting over
73
$LootRares = True ; Change this to false if you don't want the bot to pick up rares (good for legendary/set only, recommend setting LootGems to False)
74
$LootGems = False ; Change this to true if you want to pick up gems (messy, can fill up bag with whites/blues)
75
76
;Repairs colors
77
$yellow = 0xFFF000 ; yellow color code (repair icon)
78
$red = 0xD90000 ; red color code (repair icon)
79
80
$Continue = True
81
$Pause = True
82
$Dead = False
83
$Logout = False
84
$Window = False
85
$NeedRepair = False
86
$default_resolutionX = 1920
87
$default_resolutionY = 1080
88
$x_ratio = @DesktopWidth / $default_resolutionX ; Change @Desktopwidth to a static number if you are running different resolutions ingame and on desktop
89
$y_ratio = @DesktopHeight / $default_resolutionY ; Change @Desktopwidth to a static number if you are running different resolutions ingame and on desktop
90
$i = 0
91
$x = 0
92
$currentArrayItem = 0
93
$gX = 0
94
$gY = 0
95
96-
			Sleep(10000)
96+
97
98
Func RestartRun()
99
	While $Continue
100
		If Not ($Pause) Then
101
			_DebugOut("Start Testing:")
102
			Call("pickItems")
103
			Sleep(5000)
104
		EndIf
105
	WEnd
106
	Call("RestartRun")
107
EndFunc   ;==>RestartRun
108
109
110
Func pickItems()
111
	Sleep(6000)
112
;~ 	Loot Legenday
113
	For $gI = 0 To (5)
114
		$urlString = $directory & $Legendary[$gI]
115
 		$Target = _ImageSearch($urlString, 1, $gX, $gY, 75)
116
		_DebugOut("Link:" & $urlString)
117
		While $i <= 3
118
			If $Target Then
119
				_DebugOut(" ===================================" )
120-
				Sleep(5000)
120+
121
				_DebugOut("x=" & $gX)
122
				_DebugOut("y=" & $gY)
123
				MouseClick("left", $gX, $gY)
124
				Sleep(Random(1000, 1200))
125
				MouseMove(0, 100) ;Reset cursor position, it doesn't need to hover
126
 				$Target = _ImageSearch($urlString, 1, $gX, $gY, 75)
127
				$i += 1
128
			Else
129
				ExitLoop
130
			EndIf
131
		WEnd
132
	Next
133
134
;~ 	Loot Set
135
	For $gI = 0 To (5)
136
		$urlString = $directory & $Set[$gI]
137
 		$Target = _ImageSearch($urlString, 1, $gX, $gY, 75)
138
		_DebugOut("Link:" & $urlString)
139
		While $i <= 3
140
			If $Target Then
141
				_DebugOut(" ===================================" )
142
				_DebugOut("ItemFound:" & $Target)
143-
				Sleep(5000)
143+
144
				_DebugOut("y=" & $gY)
145
				MouseClick("left", $gX, $gY)
146
				Sleep(Random(1000, 1200))
147
				MouseMove(0, 100) ;Reset cursor position, it doesn't need to hover
148
 				$Target = _ImageSearch($urlString, 1, $gX, $gY, 75)
149
				$i += 1
150
			Else
151
				ExitLoop
152
			EndIf
153
		WEnd
154
	Next
155
156
;~ 	Loot Rare
157
	For $gI = 0 To (5)
158
		$urlString = $directory & $Rare[$gI]
159
 		$Target = _ImageSearch($urlString, 1, $gX, $gY, 100)
160
		_DebugOut("Link:" & $urlString)
161
		While $i <= 5
162
			If $Target Then
163
				_DebugOut(" ===================================" )
164
				_DebugOut("ItemFound:" & $Target)
165
				_DebugOut("x=" & $gX)
166-
				Sleep(5000)
166+
167
				MouseClick("left", $gX, $gY)
168
				Sleep(Random(1000, 1200))
169
				MouseMove(0, 100) ;Reset cursor position, it doesn't need to hover
170
 				$Target = _ImageSearch($urlString, 1, $gX, $gY, 100)
171
				$i += 1
172
			Else
173
				ExitLoop
174
			EndIf
175
		WEnd
176
	Next
177
178
;~ Loot general
179
	For $gI = 0 To (1)
180
		$urlString = $directory & $General[$gI]
181
 		$Target = _ImageSearch($urlString, 1, $gX, $gY, 115)
182
		_DebugOut("Link:" & $urlString)
183
		While $i <= 10
184
			If $Target Then
185
				_DebugOut(" ===================================" )
186
				_DebugOut("ItemFound:" & $Target)
187
				_DebugOut("x=" & $gX)
188
				_DebugOut("y=" & $gY)
189-
				Sleep(5000)
189+
190
				Sleep(Random(1000, 1200))
191
				MouseMove(0, 100) ;Reset cursor position, it doesn't need to hover
192
 				$Target = _ImageSearch($urlString, 1, $gX, $gY, 115)
193
				$i += 1
194
			Else
195
				ExitLoop
196
			EndIf
197
		WEnd
198
	Next
199
EndFunc   ;==>pickItems