andygongyb

Witch Doctor Farming Bot - Act 1 cellar (0.5)

Jun 15th, 2012
2,014
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 32.60 KB | None | 0 0
  1. #cs
  2.     Witch Doctor Cellar Farming Bot - Version 0.5 [1920x1080 ONLY]
  3.     Developed by Avatar88343 @ Ownedcore and andygongyb @ Ownedcore after V. 0.5
  4.     Other contributers:
  5.  
  6.     What it does:
  7.     *This bot will travel to the cellar in Act 1, kill the mobs, collect the gold and items, and repair your gear.
  8.  
  9.  
  10.     Newbiew Info:
  11.     This is a script that runs on AutoIt. You run this bot by Downloading AutoIt from the web (it's free) and installing it.
  12.     You then paste all this code into any text editor (such as notepad) and save it anywhere on your hard drive. Follow the Select
  13.     steps below to configure this bot before you run it.
  14.  
  15.     Special Instructions for 1920 x 1080:
  16.     1.) Set your game resolution to 1920x1080 (required)
  17.     2.) Set the display mode to Fullscreen Windowed (Don't forget!)
  18.     3.) Follow the Instructions (for all resolutions) section below
  19.  
  20.     Special Instructions for 800 x 600:
  21.  
  22.     1.)Exit Diablo 3
  23.     2.)Go to your document folder and locate the Diablo III folder
  24.     3.)Open the D3Prefs file in any editor (such as notepad)
  25.     4.)Change the following settings to the ones listed below
  26.     "DisplayModeFlags "0"
  27.     DisplayModeWindowMode "1"
  28.     DisplayModeWinLeft "428"
  29.     DisplayModeWinTop "162"
  30.     DisplayModeWinWidth "800"
  31.     DisplayModeWinHeight "600"
  32.     DisplayModeUIOptWidth "800"
  33.     DisplayModeUIOptHeight "600"
  34.     DisplayModeWidth "800"
  35.     DisplayModeHeight "600"
  36.     DisplayModeRefreshRate "75"
  37.     DisplayModeBitDepth "32""
  38.     5.) Follow the Instructions (for all resolutions) section below
  39.  
  40.  
  41.     Instructions (for all resolutions)
  42.     1.) Bind your middle mouse button to Move (found in Key Bindings Option)
  43.     2.) Set your build to this http://us.battle.net/d3/en/calculator/witch-doctor#jaQPZU!VZW!babbca
  44.     3.) Start Act 1, Quest 6 - Talk to Alaric
  45.     4.) Hire the Scoundrel
  46.     5.) Teleport to The Old Ruins using the waypoint and run left until you reach a checkpoint
  47.     6.) Log out of the game
  48.     7.) Press F2 to start the bot! Space is used to pause and resume the bot
  49.     8.) Press shift + \ to turn off the bot
  50.  
  51.     NOTE:
  52.     *Please make sure you are running the correct resolution settings!
  53.     *You must be running the game in Fullscreen Windoed mode if you're using 1080P
  54.     *You WILL need to edit the values below the comments for better results
  55.  
  56.     FEATURES:
  57.     *Supports 1080P Fullscreen Windowed and 800x600 Windowed (V. 0.5 only supports 1080P currently)
  58.     *Automatic looting of Rare, Legendary, and Set items
  59.     *Also able to loot blue items, tomes, and gems
  60.     *Optionally sells blue items when the bag is full
  61.     *Repairs Items when damaged
  62.     *Detects death and responds accordingly
  63.     *Detects connection lost and automatically reconnect (not tested)
  64.     *Randomization for increased safety
  65.     *Added ability to find Cellar during bad runs
  66.  
  67.     IN DEVELOPMENT:
  68.     *Multi-resolution support (need people to help)
  69.     *Stash use
  70.     *Improved combat
  71.     *Speed improvements
  72.     *Multiple routes to improve safety
  73.     *45 min timeout bug
  74.     *Edit d3config
  75.     *Salvage lv60 blue items automatically
  76.  
  77.  
  78.     **Based on the code by notAres and mackus101. Special thanks to them!
  79. #ce
  80. #include <GUIConstantsEx.au3>
  81. #include <WindowsConstants.au3>
  82. ;======THESE VALUES ARE NOT EDITED WITH THE GUI ===================================
  83. $R = 0 ; Leave this as 0 if you are using 1080P. Change it to 1 if you're using 800 x 600
  84. $ComputerLag = 1000 ; Increase this by 100-5000 if you have a slow PC.
  85. $RunSpeed = 10 ; Enter your character's run speed here
  86. $LootRares = True ; Whether or not to loot rare and legendary items
  87. $LootBlues = True ; Whether or not to loot blue items
  88. $LootGems = True ; Whether or not to loot gems
  89. $LootPotions = True ; Whether or not to loot potions
  90. $LootTomes = True ; Whether or not to loot Tome of Secret
  91. $LootGold = True ; Whether or to collect gold that is missed during the first collection attempt
  92. $Repair = True ; Orders the bot to repair when items are damaged
  93. $SellBlues = True ; Orders the bot to sell blue items when the bag is full
  94. ;======================================================================
  95.  
  96. Global $Resume[2][2] ;Location of the Resume Button
  97. Global $Leave[2][2] ;Location of the in-game leave button
  98. Global $GameLobbyCode[2][3] ;Contains X, Y, and Hex color of Resume button so we can see if we're there
  99. Global $GameScreenCode[2][3] ;Contains X, Y, and Hex color used to check if we are in an unpaused game
  100. Global $Loc1[2][2] ;First movement
  101. Global $Loc2[2][2] ;Second movement
  102. Global $Loc3[2][2] ;Third movement  ttt
  103.  
  104. Global $CellarLocation[2][2] ;Cellar door location
  105. Global $CellarLocation2[2] ;Location of cellar during bad runs (ugly workaround for now)
  106. Global $AltCellar = False
  107.  
  108. Global $Loc5[2][2] ; Cellar hallway
  109. Global $Loc6[2][2] ; Cellar doorway
  110. Global $MonsterLoc[2][2] ; Initial boss location
  111. Global $MonsterSearch[2][4] ; Bounds of where we will find our monsters
  112. Global $GoldLoot1[2][2] ; First place to run when looting
  113. Global $GoldLoot2[2][2] ; Second place to run when looting
  114. Global $GoldLoot3[2][2] ; Third place to run when looting
  115. Global $LootingArea[2][4] ; looting bounds (TL X, TL Y, BR X, BR Y)
  116. Global $CharHitBox[2][4] ; Hitbox around user's character
  117. Global $DeathBounds[2][2] ; Used to detect the "You Have Died" text
  118. Global $RepairCoords[2][4][2] ; Four clicks needed to repair
  119. Global $RepairCheck[2][2] ; Used to check for repair icon
  120. Global $CellarOffset[2] ; Used to improve cellar clicking with 1080P/800x600
  121. Global $CellarIcon ; Used to find the yellow cellar icon on the minimap (future use)
  122. Global $pngLoc[2] ; Absolute path of the folder containing pics for image search
  123. Global $LostConnectionOkBtn[2][2] ; The coordinate of the OK button of the "lost connection" window
  124. Global $LostConnectionText0[2][4] ; Image search area of the "lost connection" text
  125. Global $LostConnectionText1[2][4]
  126. Global $CharLoc[2][2] ; Location where the character stands
  127. Global $CastLoc[2][2] ; Location to cast Grasp of the Dead in the cellar
  128. Global $SellCoords[2][2] ; Coordinate of the sell button
  129. Global $SlotOffset[2] ; Length of each slot in the item window
  130. Global $ItemStartCoord0[2][4] ; Pixel search area of the first slot on the second column in item window
  131. Global $ItemStartCoord1[2][4]
  132. Global $BagFullCoords[2][4] ; Image search area of the bag full message
  133. Global $IdleCursorCoords[2][2] ; Coordinate of where the cursor should go for not covering any item name
  134. Global $CellarPixel
  135. Global $RunDelayMult[2] ; Scaler for calculating the delay to run to an item
  136. Global $GemLootOffset[2] ; Distance between gem and its text
  137. Global $BagFull
  138. Global $HasBlue
  139. ActivateGUI()
  140.  
  141. ;Check for people that can't read instructions
  142. If Int($R) < 0 Or Int($R) > 1 Then
  143.     MsgBox(4096, "A wild illiterate appears appears!", "Aha! I caught you! You did not read the instructions. You need to configure the bot!")
  144.     terminate()
  145. EndIf
  146.  
  147.  
  148. ;Clculate run speed
  149. Global $RunTime = 30 * (100 - $RunSpeed) + 2000 ;Length of time to run in 800x600
  150.  
  151. ;All locations are N dimensional arrays. [0][x] is for 1080P and [1][x] is for 800x600
  152. ;1080P
  153.  
  154.  
  155. ;1920x1080
  156. $pngLoc[0] = "F:\Program Files (x86)\Diablo III\pics\1920x1080\" ; Location of the .PNGs (NO SUBFOLDERS - ALL PNGS GO HERE)
  157. $Resume[0][0] = 319
  158. $Resume[0][1] = 416
  159. $GameLobbyCode[0][0] = 319
  160. $GameLobbyCode[0][1] = 416
  161. $GameLobbyCode[0][2] = 4065536
  162. $GameScreenCode[0][0] = 1119
  163. $GameScreenCode[0][1] = 1044
  164. $GameScreenCode[0][2] = 0xDEFDFE
  165. $LostConnectionOkBtn[0][0] = 957
  166. $LostConnectionOkBtn[0][1] = 630
  167. $LostConnectionText0[0][0] = 764
  168. $LostConnectionText0[0][1] = 493
  169. $LostConnectionText0[0][2] = 843
  170. $LostConnectionText0[0][3] = 521
  171. $LostConnectionText1[0][0] = 779
  172. $LostConnectionText1[0][1] = 507
  173. $LostConnectionText1[0][2] = 853
  174. $LostConnectionText1[0][3] = 525
  175. $CharLoc[0][0] = 944
  176. $CharLoc[0][1] = 507
  177. $CastLoc[0][0] = 600
  178. $CastLoc[0][1] = 300
  179. $SellCoords[0][0] = 517
  180. $SellCoords[0][1] = 238
  181. $SlotOffset[0] = 48
  182. $ItemStartCoord0[0][0] = 1460
  183. $ItemStartCoord0[0][1] = 631
  184. $ItemStartCoord0[0][2] = 1462
  185. $ItemStartCoord0[0][3] = 633
  186. $ItemStartCoord1[0][0] = 1460
  187. $ItemStartCoord1[0][1] = 625
  188. $ItemStartCoord1[0][2] = 1468
  189. $ItemStartCoord1[0][3] = 632
  190. $BagFullCoords[0][0] = 1060
  191. $BagFullCoords[0][1] = 125
  192. $BagFullCoords[0][2] = 1120
  193. $BagFullCoords[0][3] = 160
  194. $IdleCursorCoords[0][0] = 400
  195. $IdleCursorCoords[0][1] = 300
  196. $RunDelayMult[0] = 1.5
  197.  
  198. ;800x600
  199. $pngLoc[1] = "F:\Program Files (x86)\Diablo III\pics\800x600\" ; Need people to make those pics
  200. $Resume[1][0] = 174
  201. $Resume[1][1] = 232
  202. $GameLobbyCode[1][0] = 174
  203. $GameLobbyCode[1][1] = 232
  204. $GameLobbyCode[1][2] = 4262400
  205. $GameScreenCode[1][0] = 486
  206. $GameScreenCode[1][1] = 578
  207. $GameScreenCode[1][2] = 0x6C9BFF
  208. ; Need people working on the following coordinates
  209. $LostConnectionOkBtn[1][0] = 0
  210. $LostConnectionOkBtn[1][1] = 0
  211. $LostConnectionText0[1][0] = 0
  212. $LostConnectionText0[1][1] = 0
  213. $LostConnectionText0[1][2] = 0
  214. $LostConnectionText0[1][3] = 0
  215. $LostConnectionText1[1][0] = 0
  216. $LostConnectionText1[1][1] = 0
  217. $LostConnectionText1[1][2] = 0
  218. $LostConnectionText1[1][3] = 0
  219. $CharLoc[1][0] = 0
  220. $CharLoc[1][0] = 0
  221. $CastLoc[1][0] = 0
  222. $CastLoc[1][1] = 0
  223. $SellCoords[1][0] = 0
  224. $SellCoords[1][1] = 0
  225. $SlotOffset[1] = 0
  226. $ItemStartCoord0[1][0] = 0
  227. $ItemStartCoord0[1][1] = 0
  228. $ItemStartCoord0[1][2] = 0
  229. $ItemStartCoord0[1][3] = 0
  230. $ItemStartCoord1[1][0] = 0
  231. $ItemStartCoord1[1][1] = 0
  232. $ItemStartCoord1[1][2] = 0
  233. $ItemStartCoord1[1][3] = 0
  234. $BagFullCoords[1][0] = 0
  235. $BagFullCoords[1][1] = 0
  236. $BagFullCoords[1][2] = 0
  237. $BagFullCoords[1][3] = 0
  238. $IdleCursorCoords[1][0] = 0
  239. $IdleCursorCoords[1][1] = 0
  240. $RunDelayMult[1] = 0
  241.  
  242.  
  243. ;1920x1080
  244. $Leave[0][0] = 969
  245. $Leave[0][1] = 582
  246.  
  247. ;800x600
  248. $Leave[1][0] = 397
  249. $Leave[1][1] = 322
  250.  
  251. ;1920x1080
  252. $Loc1[0][0] = 500 ;First movement
  253. $Loc1[0][1] = 250
  254. $Loc2[0][0] = 1 ;Second movement
  255. $Loc2[0][1] = 370
  256. $Loc3[0][0] = 400 ;Third Movement
  257. $Loc3[0][1] = 600
  258.  
  259. ;800x600
  260. $Loc1[1][0] = 8 ;First movement
  261. $Loc1[1][1] = 146
  262. $Loc2[1][0] = 7 ;Second movement
  263. $Loc2[1][1] = 300
  264. $Loc3[1][0] = 8 ;Third Movement
  265. $Loc3[1][1] = 300
  266.  
  267. ;1080P
  268. $CellarLocation[0][0] = 307 ;Cellar door location
  269. $CellarLocation[0][1] = 74
  270. ;800x600
  271. $CellarLocation[1][0] = 499 ;Cellar door location
  272. $CellarLocation[1][1] = 148
  273. $CellarLocation2[0] = 439
  274. $CellarLocation2[1] = 145
  275. $AltCellarLocation = False
  276.  
  277. ;Cellar offset
  278. $CellarOffset[0] = 33;
  279. $CellarOffset[1] = 10;
  280.  
  281. ;1080P
  282. $Loc5[0][0] = 116 ;Walk down hallway
  283. $Loc5[0][1] = 986
  284. $Loc6[0][0] = 776 ;enter hallway
  285. $Loc6[0][1] = 328
  286. ;800x600
  287. $Loc5[1][0] = 3 ;Walk down hallway
  288. $Loc5[1][1] = 504
  289. $Loc6[1][0] = 255 ;enter hallway
  290. $Loc6[1][1] = 190
  291.  
  292. ;1080P
  293. $MonsterLoc[0][0] = 577
  294. $MonsterLoc[0][1] = 183
  295. ;800x600
  296. $MonsterLoc[1][0] = 188
  297. $MonsterLoc[1][1] = 111
  298.  
  299. ;1920x1080
  300. $MonsterSearch[0][0] = 162
  301. $MonsterSearch[0][1] = 29
  302. $MonsterSearch[0][2] = 1248
  303. $MonsterSearch[0][3] = 446
  304. ;800x600
  305. $MonsterSearch[1][0] = 40
  306. $MonsterSearch[1][1] = 53
  307. $MonsterSearch[1][2] = 424
  308. $MonsterSearch[1][3] = 191
  309.  
  310. ;1920x1080
  311. $GoldLoot1[0][0] = 402
  312. $GoldLoot1[0][1] = 306
  313. $GoldLoot2[0][0] = 1260
  314. $GoldLoot2[0][1] = 351
  315. $GoldLoot3[0][0] = 911
  316. $GoldLoot3[0][1] = 694
  317. ;800x600
  318. $GoldLoot1[1][0] = 96
  319. $GoldLoot1[1][1] = 181
  320. $GoldLoot2[1][0] = 560
  321. $GoldLoot2[1][1] = 191
  322. $GoldLoot3[1][0] = 349
  323. $GoldLoot3[1][1] = 418
  324.  
  325. ;1080P
  326. $LootingArea[0][0] = 300
  327. $LootingArea[0][1] = 200
  328. $LootingArea[0][2] = 1600
  329. $LootingArea[0][3] = 800
  330. ;800x600
  331. $LootingArea[1][0] = 75
  332. $LootingArea[1][1] = 90
  333. $LootingArea[1][2] = 630
  334. $LootingArea[1][3] = 400
  335.  
  336. ;1080P
  337. $CharHitBox[0][0] = 790
  338. $CharHitBox[0][1] = 315
  339. $CharHitBox[0][2] = 1200
  340. $CharHitBox[0][3] = 730
  341. ;800x600
  342. $CharHitBox[1][0] = 304
  343. $CharHitBox[1][1] = 190
  344. $CharHitBox[1][2] = 468
  345. $CharHitBox[1][3] = 323
  346.  
  347. ;1080P
  348. $DeathBounds[0][0] = 538
  349. $DeathBounds[0][1] = 335
  350. ;800x600
  351. $DeathBounds[1][0] = 210
  352. $DeathBounds[1][1] = 180
  353.  
  354. ;1080P
  355. $RepairCoords[0][0][0] = 1690
  356. $RepairCoords[0][0][1] = 102
  357. $RepairCoords[0][1][0] = 930
  358. $RepairCoords[0][1][1] = 136
  359. $RepairCoords[0][2][0] = 517
  360. $RepairCoords[0][2][1] = 483
  361. $RepairCoords[0][3][0] = 223
  362. $RepairCoords[0][3][1] = 592
  363. ;800x600
  364. $RepairCoords[1][0][0] = 691
  365. $RepairCoords[1][0][1] = 88
  366. $RepairCoords[1][1][0] = 505
  367. $RepairCoords[1][1][1] = 52
  368. $RepairCoords[1][2][0] = 282
  369. $RepairCoords[1][2][1] = 261
  370. $RepairCoords[1][3][0] = 157
  371. $RepairCoords[1][3][1] = 329
  372.  
  373. ;1080P
  374. $RepairCheck[0][0] = 1507
  375. $RepairCheck[0][1] = 36
  376. ;800x600
  377. $RepairCheck[1][0] = 573
  378. $RepairCheck[1][1] = 21
  379.  
  380. Opt('MouseCoordMode', 2)
  381. Opt('PixelCoordMode', 2)
  382. HotKeySet("|", "Terminate")
  383. HotKeySet('{F2}', 'Pause')
  384.  
  385. Global $Paused
  386.  
  387. ;bot starts paused. press space to start.
  388. Pause()
  389.  
  390. ;Finding loot takes time. We don't want to overdo it
  391. $LootAttempts = 0
  392. $GemLootAttempts = 0
  393. $HasBlue = 0
  394.  
  395. Sleep(400) ; Please put a random small number here which will confuse Wardon's harsh function
  396.  
  397. WinActivate('Diablo III')
  398. While 1
  399.     If WinActive('Diablo III') Then
  400.  
  401.         Local $gX
  402.         Local $gY
  403.  
  404.         $AltCellarLocation = False
  405.         $LootAttempts = 0
  406.         $GemLootAttempts = 0
  407.         $BagFull = False
  408.  
  409.         ;Make sure that we are in the character selection screen ( we are looking at a spot in the Resume game button)
  410.         For $i = 15 To 0 Step -1
  411.             If InGameLobby() Then
  412.                 ExitLoop
  413.             EndIf
  414.  
  415.             Sleep(600)
  416.             If _ImageSearchArea($pngLoc[$R] & "game.png", 1, $LostConnectionText0[$R][0], _
  417.                     $LostConnectionText0[$R][1], $LostConnectionText0[$R][2], _
  418.                     $LostConnectionText0[$R][3], $gX, $gY, 90) _
  419.                     Or _ImageSearchArea($pngLoc[$R] & "therewas.png", 1, $LostConnectionText1[$R][0], _
  420.                     $LostConnectionText1[$R][1], $LostConnectionText1[$R][2], _
  421.                     $LostConnectionText1[$R][3], $gX, $gY, 90) Then
  422.                 ; check if we lost connection
  423.                 Click($LostConnectionOkBtn[$R][0], $LostConnectionOkBtn[$R][1])
  424.                 ContinueLoop
  425.             EndIf
  426.             If $i == 1 Then
  427.                 MsgBox(4096, "Error Resuming Game", "You don't seem to be in the lobby. Did you properly configure the bot? Bot will now exit", 50)
  428.                 Terminate()
  429.             EndIf
  430.         Next
  431.  
  432.         ;Resume the game
  433.         Click($Resume[$R][0], $Resume[$R][1])
  434.  
  435.         ;Make sure that we are in the game
  436.         For $i = 12 To 0 Step -1
  437.             If InGameplayScreen() Then
  438.                 ExitLoop
  439.             EndIf
  440.  
  441.             Sleep(1000)
  442.             If $i == 1 Then
  443.                 MsgBox(4096, "Error Starting the Game", "The game did not properly load...Are you using English language? Do not use custom themes!", 50)
  444.                 Terminate()
  445.             EndIf
  446.         Next
  447.  
  448.  
  449.         Rest(200)
  450.         Send("{2}")
  451.         Rest(400)
  452.  
  453.         ;Custom running for the 800x600. Sometimes I wonder if it's faster to just buy everyone a 1080P monitor...
  454.         If Int($R) == 1 Then
  455.             MouseMove(11, 220)
  456.             Sleep(400)
  457.             Send("{4}")
  458.             MouseDown("middle")
  459.             Sleep($RunTime)
  460.  
  461.             MouseUp("middle")
  462.             Sleep(2000)
  463.  
  464.             #cs $CellarIcon = PixelSearch(630, 70, 741, 149, 0x71341A, 5)
  465.                 if not @error then
  466.                 ConsoleWrite("Foundtheseller" & @LF)
  467.  
  468.                 EndIf
  469.             #ce
  470.  
  471.         Else
  472.             Move($Loc1[$R][0], $Loc1[$R][1])
  473.             Sleep(200)
  474.             Send("{4}")
  475.             Sleep(500)
  476.             Move($Loc2[$R][0], $Loc2[$R][1])
  477.             Sleep(1100)
  478.             Move($Loc3[$R][0], $Loc3[$R][1])
  479.         EndIf
  480.  
  481.  
  482.         ;Check to see if the cellar is there ```````
  483.         MouseMove($CellarLocation[$R][0], $CellarLocation[$R][1])
  484.         Sleep(400)
  485.         If Int($R) = 1 Then
  486.             $CellarPixel = PixelSearch($CellarLocation[$R][0] - 30, $CellarLocation[$R][1] - 30, _
  487.                     $CellarLocation[$R][0] + 20, $CellarLocation[$R][1] + 20, 0x93D7F9, 8)
  488.  
  489.             If @error Then
  490.                 MouseMove($CellarLocation2[0], $CellarLocation2[1])
  491.                 Sleep(300)
  492.                 $CellarPixel = PixelSearch($CellarLocation2[0] - 30, $CellarLocation2[1] - 30, _
  493.                         $CellarLocation2[0] + 20, $CellarLocation2[1] + 20, 0x93D7F9, 8)
  494.                 If Not @error Then
  495.                     $AltCellarLocation = True
  496.                 EndIf
  497.             EndIf
  498.         Else
  499.             $CellarPixel = PixelSearch($CellarLocation[$R][0] - $CellarOffset[$R], $CellarLocation[$R][1] _
  500.                      - $CellarOffset[$R], $CellarLocation[$R][0] + 4, $CellarLocation[$R][1] + 4, 0x334FB7, 6)
  501.         EndIf
  502.  
  503.         ;Leave the game if the Cellar is not there
  504.         If @error Then
  505.             ConsoleWrite("Did not find the cellar " & @LF)
  506.             Send("{SHIFTDOWN}")
  507.             Sleep(10)
  508.             Click($CharLoc[$R][0], $CharLoc[$R][1])
  509.             Sleep(300)
  510.             Send("{SHIFTUP}")
  511.             ;Cast Voodoo and Grasp of the Dead to ensure safety
  512.             Send("{1}")
  513.             Rest(300)
  514.             Send("{3}")
  515.             Rest(300)
  516.             leaveGame()
  517.             Sleep(12000)
  518.             ContinueLoop
  519.         EndIf
  520.  
  521.         ;Enter the cellar
  522.         ConsoleWrite("Entering the Cellar..." & @LF)
  523.         If $R > 0 And $AltCellar Then
  524.             Click($CellarLocation2[$R][0] - 4, $CellarLocation2[$R][1] - 4)
  525.         Else
  526.             If Not $AltCellarLocation Then
  527.                 Click($CellarLocation[$R][0], $CellarLocation[$R][1])
  528.             Else
  529.                 Click($CellarLocation2[0], $CellarLocation2[1])
  530.             EndIf
  531.         EndIf
  532.  
  533.         If Int($R) == 1 Then
  534.             Sleep(1000 + $ComputerLag)
  535.         Else
  536.             Sleep(3500 + $ComputerLag)
  537.         EndIf
  538.  
  539.         ;Check to see if we died
  540.         If CheckForDeath() Then
  541.             ContinueLoop
  542.         EndIf
  543.  
  544.         ;Inside the celler now - Move to the doorway
  545.         Move($Loc5[$R][0], $Loc5[$R][1])
  546.         Sleep(1500)
  547.         Move($Loc6[$R][0], $Loc6[$R][1])
  548.  
  549.         ;Cast Grasp of the Dead
  550.         MouseMove($CastLoc[$R][0], $CastLoc[$R][1])
  551.         Sleep(300)
  552.         Send("{3}")
  553.         Sleep(350)
  554.         ;Cast Voodoo
  555.         Send("{1}")
  556.         Sleep(350)
  557.  
  558.         ;Kill all the enemies inside
  559.         While 1
  560.  
  561.             $MonsterBar = PixelSearch($MonsterSearch[$R][0], $MonsterSearch[$R][1], _
  562.                     $MonsterSearch[$R][2], $MonsterSearch[$R][3], 0xEE0000, 10)
  563.             If @error Then
  564.                 ConsoleWrite("Didn't find any, attacking to discover potential enemies" & @LF)
  565.                 Attack($MonsterLoc[$R][0], $MonsterLoc[$R][1])
  566.                 Sleep(500)
  567.                 $MonsterBar = PixelSearch($MonsterSearch[$R][0], $MonsterSearch[$R][1], _
  568.                         $MonsterSearch[$R][2], $MonsterSearch[$R][3], 0xEE0000, 10)
  569.                 If @error Then
  570.                     ConsoleWrite("No monsters found - Moving on")
  571.                     ExitLoop
  572.                 EndIf
  573.             EndIf
  574.  
  575.             ;if CheckForNearbyMonsters() Then
  576.             ;send("{4}")
  577.             ;EndIf
  578.  
  579.             For $i = 7 To 0 Step -1
  580.                 Attack($MonsterBar[0], $MonsterBar[1])
  581.                 Sleep(100)
  582.             Next
  583.         WEnd
  584.  
  585.  
  586.         ;Loot the gold and attack anything we missed
  587.         Move($GoldLoot1[$R][0], $GoldLoot1[$R][1])
  588.         Sleep(Random(800, 900))
  589.         AttackNearbyMonsters()
  590.         Move($GoldLoot2[$R][0], $GoldLoot2[$R][1])
  591.         Sleep(Random(400, 500))
  592.         AttackNearbyMonsters()
  593.         Move($GoldLoot3[$R][0], $GoldLoot3[$R][1])
  594.         Sleep(Random(400, 500))
  595.         AttackNearbyMonsters()
  596.  
  597.         ;Loot items
  598.         If $LootRares Then
  599.             $BagFull = LootRares()
  600.             $LootAttemps = 0
  601.             $BagFull = LootLegendaries()
  602.             $LootAttempts = 0
  603.         EndIf
  604.  
  605.         If $LootBlues And $BagFull = False Then
  606.             $LootAttempts = 0
  607.             $BagFull = LootMagic()
  608.         EndIf
  609.  
  610.         If $LootGems Then
  611.             LootGems()
  612.         EndIf
  613.  
  614.         If $LootTomes Then
  615.             LootTomes()
  616.         EndIf
  617.  
  618.         If $LootPotions Then
  619.             LootPotions()
  620.         EndIf
  621.  
  622.         If $LootGold Then
  623.             LootGold()
  624.         EndIf
  625.  
  626.         ;Check to see if we died
  627.         If CheckForDeath() Then
  628.             ContinueLoop
  629.         EndIf
  630.  
  631.         ;Teleport to town
  632.         Send("{t}")
  633.         Sleep(8000)
  634.  
  635.         RepairOrSellItems()
  636.  
  637.         ;Leave the game
  638.         LeaveGame()
  639.         Sleep(1000)
  640.  
  641.     EndIf
  642. WEnd
  643.  
  644. Func CheckForRepair()
  645.     $RepairNeeded = PixelSearch($RepairCheck[$R][0], $RepairCheck[$R][1], $RepairCheck[$R][0] + 5, _
  646.             $RepairCheck[$R][1] + 5, 0xFFE801, 10)
  647.  
  648.     If Not @error Then
  649.         Return True
  650.     Else
  651.         Return False
  652.     EndIf
  653. EndFunc   ;==>CheckForRepair
  654.  
  655.  
  656. Func RepairOrSellItems()
  657.     Local $NeedRepair
  658.     Local $xx
  659.     Local $yy
  660.     Local $sell
  661.     $NeedRepair = CheckForRepair()
  662.     ; Repair the gears when needed
  663.     If ($NeedRepair And $Repair) Or ($BagFull And $SellBlues And $HasBlue) Then
  664.         Move($RepairCoords[$R][0][0], $RepairCoords[$R][0][1])
  665.         Sleep(2000 + $ComputerLag)
  666.         MouseMove($RepairCoords[$R][1][0], $RepairCoords[$R][1][1])
  667.         Sleep(400)
  668.         Click($RepairCoords[$R][1][0], $RepairCoords[$R][1][1])
  669.         Sleep(1300 + $ComputerLag)
  670.         If $NeedRepair And $Repair Then
  671.             Click($RepairCoords[$R][2][0], $RepairCoords[$R][2][1])
  672.             Sleep(Random(700 - 900))
  673.             Click($RepairCoords[$R][3][0], $RepairCoords[$R][3][1])
  674.             Sleep(500)
  675.         EndIf
  676.         ; If the bag is full, sell the blues
  677.         If ($BagFull And $SellBlues And $HasBlue) Then
  678.             Click($SellCoords[$R][0], $SellCoords[$R][1]);
  679.             Sleep(500)
  680.             For $xx = 0 To 8 Step 1
  681.                 For $yy = 0 To 5 Step 1
  682.                     ; An item recently picked up has blue frame arround the slots
  683.                     $sell = PixelSearch($ItemStartCoord0[$R][0] + $xx * $SlotOffset[$R], _
  684.                             $ItemStartCoord0[$R][1] + $yy * $SlotOffset[$R], _
  685.                             $ItemStartCoord0[$R][2] + $xx * $SlotOffset[$R], _
  686.                             $ItemStartCoord0[$R][3] + $yy * $SlotOffset[$R], 0x0000FF, 10)
  687.                     If Not @error Then
  688.                         MouseClick("right", $sell[0], $sell[1])
  689.                     Else
  690.                         ; Otherwise the color of the frame is lighter
  691.                         $sell = PixelSearch($ItemStartCoord1[$R][0] + $xx * $SlotOffset[$R], _
  692.                                 $ItemStartCoord1[$R][1] + $yy * $SlotOffset[$R], _
  693.                                 $ItemStartCoord1[$R][2] + $xx * $SlotOffset[$R], _
  694.                                 $ItemStartCoord1[$R][3] + $yy * $SlotOffset[$R], 0x182A5B, 30)
  695.                         If Not @error Then
  696.                             MouseClick("right", $sell[0], $sell[1])
  697.                         EndIf
  698.                     EndIf
  699.                 Next
  700.             Next
  701.         EndIf
  702.         Sleep(300)
  703.         Send("{esc}")
  704.     EndIf
  705. EndFunc   ;==>RepairOrSellItems
  706.  
  707. Func Terminate()
  708.     Exit 0
  709. EndFunc   ;==>Terminate
  710.  
  711. Func LeaveGame()
  712.     Send("{esc}")
  713.     Sleep(400)
  714.     Click($Leave[$R][0], $Leave[$R][1])
  715. EndFunc   ;==>LeaveGame
  716.  
  717. Func Pause()
  718.     $Paused = Not $Paused
  719.     While $Paused
  720.         Sleep(100)
  721.         ToolTip('Paused... (Press F2 to run it)', 0, 0)
  722.     WEnd
  723.     ToolTip("")
  724. EndFunc   ;==>Pause
  725.  
  726. Func Click($x, $y)
  727.     MouseClick('left', Random($x - 3, $x + 3), Random($y - 3, $y + 3), 1, Random(0, 1))
  728. EndFunc   ;==>Click
  729.  
  730. Func Move($x, $y)
  731.     MouseClick('middle', Random($x - 3, $x + 3), Random($y - 3, $y + 3), 1, Random(0, 1))
  732.     Sleep(Random(1000, 1500))
  733. EndFunc   ;==>Move
  734.  
  735. Func Attack($x, $y)
  736.     MouseClick('right', Random($x - 3, $x + 3), Random($y - 3, $y + 3), 1, Random(0, 1))
  737. EndFunc   ;==>Attack
  738.  
  739. Func Rest($z)
  740.     Sleep(Random($z, $z + 25))
  741. EndFunc   ;==>Rest
  742.  
  743. Func CheckForDeath()
  744.     ConsoleWrite("Checking to see if we died")
  745.     $Death = PixelSearch($DeathBounds[$R][0], $DeathBounds[$R][0], $DeathBounds[$R][0] + 4, _
  746.             $DeathBounds[$R][0] + 4, 0xFFFFFF)
  747.     If Not @error Then
  748.         ConsoleWrite("Died" & @LF)
  749.         LeaveGame()
  750.         Sleep(10000)
  751.         Return True
  752.     Else
  753.         Return False
  754.     EndIf
  755. EndFunc   ;==>CheckForDeath
  756.  
  757. Func CalcDist($x, $y)
  758.     Local $dx = $x - $CharLoc[$R][0]
  759.     Local $dy = $y - $CharLoc[$R][1]
  760.     Return Sqrt($dx ^ 2 + $dy ^ 2)
  761. EndFunc   ;==>CalcDist
  762.  
  763. Func LootMagic()
  764.     Local $gX
  765.     Local $gY
  766.     If _ImageSearchArea($pngLoc[$R] & "item.png", 1, $BagFullCoords[$R][0], $BagFullCoords[$R][1], _
  767.             $BagFullCoords[$R][2], $BagFullCoords[$R][3], $gX, $gY, 120) Then
  768.         Return True
  769.     EndIf
  770.     $Magic = PixelSearch($LootingArea[$R][0], $LootingArea[$R][1], $LootingArea[$R][2], _
  771.             $LootingArea[$R][3], 0x6969FF, 2) ;
  772.     If Not @error Then
  773.         Click($Magic[0] + 5, $Magic[1] + 2)
  774.         Sleep(100 + Round($RunDelayMult[$R] * CalcDist($gX, $gY)))
  775.         If _ImageSearchArea($pngLoc[$R] & "item.png", 1, $BagFullCoords[$R][0], $BagFullCoords[$R][1], _
  776.                 $BagFullCoords[$R][2], $BagFullCoords[$R][3], $gX, $gY, 120) Then
  777.             Return True
  778.         EndIf
  779.         $HasBlue = 1
  780.     EndIf
  781.  
  782.     $LootAttempts += 1
  783.     If ($LootAttempts > 5) Then
  784.         Return
  785.     Else
  786.         If LootMagic() Then
  787.             Return True
  788.         EndIf
  789.     EndIf
  790.     Return False
  791. EndFunc   ;==>LootMagic
  792.  
  793.  
  794. Func LootRares()
  795.     Local $gX
  796.     Local $gY
  797.     If _ImageSearchArea($pngLoc[$R] & "item.png", 1, $BagFullCoords[$R][0], $BagFullCoords[$R][1], _
  798.             $BagFullCoords[$R][2], $BagFullCoords[$R][3], $gX, $gY, 120) Then
  799.         Return True
  800.     EndIf
  801.     $Rare = PixelSearch($LootingArea[$R][0], $LootingArea[$R][1], $LootingArea[$R][2], _
  802.             $LootingArea[$R][3], 0xBBBB00, 2)
  803.     If Not @error Then
  804.         Click($Rare[0] + 5, $Rare[1] + 2)
  805.         Sleep(100 + Round($RunDelayMult[$R] * CalcDist($gX, $gY)))
  806.         If _ImageSearchArea($pngLoc[$R] & "item.png", 1, $BagFullCoords[$R][0], $BagFullCoords[$R][1], _
  807.                 $BagFullCoords[$R][2], $BagFullCoords[$R][3], $gX, $gY, 120) Then
  808.             Return True
  809.         EndIf
  810.     EndIf
  811.  
  812.     $LootAttempts += 1
  813.     If ($LootAttempts > 5) Then
  814.         Return
  815.     Else
  816.         If LootRares() Then
  817.             Return True
  818.         EndIf
  819.     EndIf
  820.     Return False
  821. EndFunc   ;==>LootRares
  822.  
  823.  
  824.  
  825. Func LootLegendaries()
  826.     Local $gX
  827.     Local $gY
  828.     If _ImageSearchArea($pngLoc[$R] & "item.png", 1, $BagFullCoords[$R][0], $BagFullCoords[$R][1], _
  829.             $BagFullCoords[$R][2], $BagFullCoords[$R][3], $gX, $gY, 120) Then
  830.         MsgBox(0, "Oops!", "Your bag is full and you may not want to miss this item")
  831.         terminate()
  832.     EndIf
  833.     $Legendary = PixelSearch($LootingArea[$R][0], $LootingArea[$R][1], $LootingArea[$R][2], _
  834.             $LootingArea[$R][3], 0xBF642F, 2) ;
  835.     If Not @error Then
  836.         Click($Legendary[0] + 5, $Legendary[1] + 2)
  837.         Sleep(100 + Round($RunDelayMult[$R] * CalcDist($gX, $gY)))
  838.         If _ImageSearchArea($pngLoc[$R] & "item.png", 1, $BagFullCoords[$R][0], $BagFullCoords[$R][1], _
  839.                 $BagFullCoords[$R][2], $BagFullCoords[$R][3], $gX, $gY, 120) Then
  840.             ; Will terminate if a legendary is present and the bag is full
  841.             MsgBox(0, "Oops!", "Your bag is full and you may not want to miss this item")
  842.             terminate()
  843.         EndIf
  844.     EndIf
  845.  
  846.     $set = PixelSearch($LootingArea[$R][0], $LootingArea[$R][1], $LootingArea[$R][2], _
  847.             $LootingArea[$R][2], 0x02CE01, 2) ;
  848.     If Not @error Then
  849.         Click($set[0] + 5, $set[1] + 2)
  850.         Sleep(100 + Round($RunDelayMult[$R] * CalcDist($gX, $gY)))
  851.         If _ImageSearchArea($pngLoc[$R] & "item.png", 1, $BagFullCoords[$R][0], $BagFullCoords[$R][1], _
  852.                 $BagFullCoords[$R][2], $BagFullCoords[$R][3], $gX, $gY, 120) Then
  853.             MsgBox(0, "Oops!", "Your bag is full and you may not want to miss this item")
  854.             terminate()
  855.         EndIf
  856.     EndIf
  857.  
  858.     $LootAttempts += 1
  859.     If ($LootAttempts > 3) Then
  860.         Return
  861.     Else
  862.         LootLegendaries()
  863.     EndIf
  864. EndFunc   ;==>LootLegendaries
  865.  
  866. Func LootGems()
  867.     Local $gX = 0
  868.     Local $gY = 0
  869.     MouseMove($IdleCursorCoords[$R][0], $IdleCursorCoords[$R][0])
  870.     While _ImageSearchArea($pngLoc[$R] & "square.png", 1, $LootingArea[$R][0], $LootingArea[$R][1], _
  871.         $LootingArea[$R][2], $LootingArea[$R][3], $gX, $gY, 120)
  872.         MouseClick("left", $gX, $gY)
  873.         Sleep(Round($RunDelayMult[$R] * CalcDist($gX, $gY)))
  874.         If _ImageSearchArea($pngLoc[$R] & "item.png", 1, $BagFullCoords[$R][0], $BagFullCoords[$R][1], _
  875.                 $BagFullCoords[$R][2], $BagFullCoords[$R][3], $gX, $gY, 120) Then
  876.             Return True
  877.         EndIf
  878.         MouseMove($IdleCursorCoords[$R][0], $IdleCursorCoords[$R][0])
  879.         Sleep(100)
  880.     WEnd
  881.     Return False
  882. EndFunc   ;==>LootGems
  883.  
  884. Func LootTomes()
  885.     Local $gX = 0
  886.     Local $gY = 0
  887.     MouseMove($IdleCursorCoords[$R][0], $IdleCursorCoords[$R][0])
  888.     While _ImageSearchArea($pngLoc[$R] & "tome.png", 1, $LootingArea[$R][0], $LootingArea[$R][1], _
  889.         $LootingArea[$R][2], $LootingArea[$R][3], $gX, $gY, 120)
  890.         MouseClick("left", $gX, $gY)
  891.         MouseMove($IdleCursorCoords[$R][0], $IdleCursorCoords[$R][0])
  892.         Sleep(Round($RunDelayMult[$R] * CalcDist($gX, $gY)))
  893.     WEnd
  894. EndFunc   ;==>LootTomes
  895.  
  896. Func LootPotions()
  897.     Local $gX = 0
  898.     Local $gY = 0
  899.     MouseMove($IdleCursorCoords[$R][0], $IdleCursorCoords[$R][0])
  900.     While _ImageSearchArea($pngLoc[$R] & "potion.png", 1, $LootingArea[$R][0], $LootingArea[$R][1], _
  901.         $LootingArea[$R][2], $LootingArea[$R][3], $gX, $gY, 120)
  902.         MouseClick("left", $gX, $gY)
  903.         MouseMove($IdleCursorCoords[$R][0], $IdleCursorCoords[$R][0])
  904.         Sleep(Round($RunDelayMult[$R] * CalcDist($gX, $gY)))
  905.     WEnd
  906. EndFunc   ;==>LootPotions
  907.  
  908. Func LootGold()
  909.     Local $gX = 0
  910.     Local $gY = 0
  911.     Local $cnt = 5
  912.     MouseMove($IdleCursorCoords[$R][0], $IdleCursorCoords[$R][0])
  913.     While _ImageSearchArea($pngLoc[$R] & "gold.png", 1, $LootingArea[$R][0], $LootingArea[$R][1], _
  914.         $LootingArea[$R][2], $LootingArea[$R][3], $gX, $gY, 120) And $cnt
  915.         MouseClick("left", $gX, $gY)
  916.         MouseMove($IdleCursorCoords[$R][0], $IdleCursorCoords[$R][0])
  917.         Sleep(Round($RunDelayMult[$R] * CalcDist($gX, $gY)))
  918.         $cnt -= 1
  919.     WEnd
  920. EndFunc   ;==>LootGold
  921.  
  922. Func AttackNearbyMonsters()
  923.     While 1
  924.         $MonsterData = PixelSearch($CharHitBox[$R][0], $CharHitBox[$R][1], $CharHitBox[$R][2], $CharHitBox[$R][3], 0xEE0000, 10)
  925.         If @error Then
  926.             ExitLoop
  927.         EndIf
  928.  
  929.         Send("{4}")
  930.         Sleep(300)
  931.         For $i = 10 To 0 Step -1
  932.             Attack($MonsterData[0], $MonsterData[1])
  933.             Sleep(100)
  934.         Next
  935.     WEnd
  936. EndFunc   ;==>AttackNearbyMonsters
  937.  
  938. Func CheckForNearbyMonsters()
  939.     $MonsterData = PixelSearch($CharHitBox[$R][0], $CharHitBox[$R][1], $CharHitBox[$R][2], $CharHitBox[$R][3], 0xEE0000, 10)
  940.     If @error Then
  941.         Return False
  942.     Else
  943.         Return True
  944.     EndIf
  945. EndFunc   ;==>CheckForNearbyMonsters
  946.  
  947.  
  948. Func SnareNearbyEnemies()
  949.     $MonsterData = PixelSearch($CharHitBox[$R][0], $CharHitBox[$R][1], $CharHitBox[$R][2], $CharHitBox[$R][3], 0xEE0000, 10)
  950.     If Not @error Then
  951.         MouseMove($MonsterData[0], $MonsterData[1])
  952.         Sleep(350)
  953.         Send("{3}")
  954.         Sleep(250)
  955.     EndIf
  956. EndFunc   ;==>SnareNearbyEnemies
  957.  
  958.  
  959. Func InGameLobby()
  960.     MouseMove($GameLobbyCode[$R][0], $GameLobbyCode[$R][1])
  961.     Sleep(300)
  962.     PixelSearch($GameLobbyCode[$R][0], $GameLobbyCode[$R][1], $GameLobbyCode[$R][0] + 10, $GameLobbyCode[$R][1] + 10, $GameLobbyCode[$R][2], 10)
  963.     If Not @error Then
  964.         Return True
  965.     Else
  966.         Return False
  967.     EndIf
  968. EndFunc   ;==>InGameLobby
  969.  
  970. Func InGameplayScreen()
  971.     PixelSearch($GameScreenCode[$R][0], $GameScreenCode[$R][1], $GameScreenCode[$R][0] + 4, $GameScreenCode[$R][1] + 3, $GameScreenCode[$R][2], 10)
  972.     If Not @error Then
  973.         Return True
  974.     Else
  975.         Return False
  976.     EndIf
  977. EndFunc   ;==>InGameplayScreen
  978.  
  979. Func _ImageSearchArea($findImage, $resultPosition, $x1, $y1, $right, $bottom, ByRef $x, ByRef $y, $tolerance)
  980.     $findImage = "*TRANSBLACK " & $findImage
  981.     If $tolerance > 0 Then $findImage = "*" & $tolerance & " " & $findImage
  982.     If @AutoItX64 Then
  983.         $result = DllCall("ImageSearchDLL_x64.dll", "str", "ImageSearch", "int", $x1, "int", $y1, "int", $right, "int", $bottom, "str", $findImage)
  984.     Else
  985.         $result = DllCall("ImageSearchDLL.dll", "str", "ImageSearch", "int", $x1, "int", $y1, "int", $right, "int", $bottom, "str", $findImage)
  986.     EndIf
  987.     If $result = "0" Then Return 0
  988.  
  989.     ; Otherwise get the x,y location of the match and the size of the image to
  990.     ; compute the centre of search
  991.     $array = StringSplit($result[0], "|")
  992.     If (UBound($array) >= 4) Then
  993.         $x = Int(Number($array[2]))
  994.         $y = Int(Number($array[3]))
  995.         If $resultPosition = 1 Then
  996.             $x = $x + Int(Number($array[4]) / 2)
  997.             $y = $y + Int(Number($array[5]) / 2)
  998.         EndIf
  999.         Return 1
  1000.     EndIf
  1001. EndFunc   ;==>_ImageSearchArea
  1002.  
  1003. Func ActivateGUI()
  1004.  
  1005.     ;setup the UI
  1006.     $Waiting = True
  1007.  
  1008.     $Form1 = GUICreate("D3 Witch Doctor bot by Avatar88343 and Andygongyb", 500, 320, -1, -1)
  1009.  
  1010.     GUICtrlCreateLabel("Warning: the script is for education only, not approved for any form of commercial use", _
  1011.             25, 30, 550, -1)
  1012.  
  1013.     GUICtrlCreateLabel("Hotkeys:" & @CRLF & @TAB & "Terminate:" & @TAB & "SHIFT + \" & @CRLF _
  1014.              & @TAB & "Pause:" & @TAB & @TAB & "F2", 25, 50, 550, -1)
  1015.  
  1016.     GUICtrlCreateLabel("Game Resolution", 25, 100, 100, -1)
  1017.     $ResCombo = GUICtrlCreateCombo("", 25, 115, 200, -1)
  1018.     GUICtrlSetData($ResCombo, "1920 x 1080|800 x 600", "Select your Res")
  1019.  
  1020.     GUICtrlCreateLabel("Character run speed (for 800x600)", 275, 100, 200, -1)
  1021.     $RunInput = GUICtrlCreateInput("0", 275, 115, 200, -1)
  1022.  
  1023.     $LootRareCheck = GUICtrlCreateCheckbox("Loot rares/legs/sets", 25, 160)
  1024.     GUICtrlSetState($LootRareCheck, $GUI_CHECKED)
  1025.  
  1026.     $LootBluesCheck = GUICtrlCreateCheckbox("Loot blues", 150, 160)
  1027.     GUICtrlSetState($LootBluesCheck, $GUI_CHECKED)
  1028.  
  1029.     $LootGemsCheck = GUICtrlCreateCheckbox("Loot gems", 275, 160)
  1030.     GUICtrlSetState($LootGemsCheck, $GUI_CHECKED)
  1031.  
  1032.     $LootPotionsCheck = GUICtrlCreateCheckbox("Loot potions", 400, 160)
  1033.     GUICtrlSetState($LootPotionsCheck, $GUI_CHECKED)
  1034.  
  1035.     $LootTomesCheck = GUICtrlCreateCheckbox("Loot tomes of secret", 25, 190)
  1036.     GUICtrlSetState($LootTomesCheck, $GUI_CHECKED)
  1037.  
  1038.     $LootGoldCheck = GUICtrlCreateCheckbox("Collect the gold carefully (slower)", 275, 190)
  1039.     GUICtrlSetState($LootGoldCheck, $GUI_CHECKED)
  1040.  
  1041.     $RepairCheckbox = GUICtrlCreateCheckbox("Repair gears when needed", 25, 220)
  1042.     GUICtrlSetState($RepairCheckbox, $GUI_CHECKED)
  1043.  
  1044.     $SellBluesCheckbox = GUICtrlCreateCheckbox("Sell blue item when the bag is full", 275, 220)
  1045.     GUICtrlSetState($SellBluesCheckbox, $GUI_CHECKED)
  1046.  
  1047.     $StartButton = GUICtrlCreateButton("Start", 175, 260, 150, 33)
  1048.  
  1049.     GUISetState(@SW_SHOW)
  1050.  
  1051.     ;Wait for them to press start
  1052.     While $Waiting
  1053.         $Action = GUIGetMsg()
  1054.  
  1055.         If $Action = $GUI_EVENT_CLOSE Then Terminate()
  1056.         If $Action = $StartButton Then ExitLoop
  1057.  
  1058.         Sleep(50)
  1059.     WEnd
  1060.  
  1061.     ;Get the values
  1062.     $SelectedRes = GUICtrlRead($ResCombo)
  1063.     If $SelectedRes = "1920 x 1080" Then
  1064.         $R = 0
  1065.     ElseIf $SelectedRes = "800 x 600" Then
  1066.         $R = 1
  1067.     Else
  1068.         MsgBox(0, "Error", "You did not select a resolution! Try again")
  1069.         Terminate()
  1070.     EndIf
  1071.  
  1072.     $RunSpeed = Int(GUICtrlRead($RunInput))
  1073.     $LootRares = GUICtrlRead($LootRareCheck) = $GUI_CHECKED
  1074.     $LootBlues = GUICtrlRead($LootBluesCheck) = $GUI_CHECKED
  1075.     $LootGems = GUICtrlRead($LootGemsCheck) = $GUI_CHECKED
  1076.     $LootPotions = GUICtrlRead($LootPotionsCheck) = $GUI_CHECKED
  1077.     $LootTomes = (GUICtrlRead($LootTomesCheck) = $GUI_CHECKED) And (Not $LootBlues)
  1078.     $LootGold = GUICtrlRead($LootGoldCheck) = $GUI_CHECKED
  1079.     $Repair = GUICtrlRead($RepairCheckbox) = $GUI_CHECKED
  1080.     $SellBlues = (GUICtrlRead($SellBluesCheckbox) = $GUI_CHECKED) And $LootBlues
  1081.  
  1082.     GUISetState(@SW_HIDE)
  1083. EndFunc   ;==>ActivateGUI
Add Comment
Please, Sign In to add comment