Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

Witch Doctor Farming Bot - Act 1 cellar (0.5)

By: a guest on Jun 15th, 2012  |  syntax: AutoIt  |  size: 31.42 KB  |  hits: 130  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. ActivateGUI()
  139.  
  140. ;Check for people that can't read instructions
  141. If Int($R) < 0 Or Int($R) > 1 Then
  142.         MsgBox(4096, "A wild illiterate appears appears!", "Aha! I caught you! You did not read the instructions. You need to configure the bot!")
  143.         terminate()
  144. EndIf
  145.  
  146.  
  147. ;Clculate run speed
  148. Global $RunTime = 30 * (100 - $RunSpeed) + 2000 ;Length of time to run in 800x600
  149.  
  150. ;All locations are N dimensional arrays. [0][x] is for 1080P and [1][x] is for 800x600
  151. ;1080P
  152.  
  153.  
  154. ;1920x1080
  155. $pngLoc[0] = "F:\Program Files (x86)\Diablo III\pics\1920x1080\" ; Location of the .PNGs (NO SUBFOLDERS - ALL PNGS GO HERE)
  156. $Resume[0][0] = 319
  157. $Resume[0][1] = 416
  158. $GameLobbyCode[0][0] = 319
  159. $GameLobbyCode[0][1] = 416
  160. $GameLobbyCode[0][2] = 4065536
  161. $GameScreenCode[0][0] = 1119
  162. $GameScreenCode[0][1] = 1044
  163. $GameScreenCode[0][2] = 0xDEFDFE
  164. $LostConnectionOkBtn[0][0] = 957
  165. $LostConnectionOkBtn[0][1] = 630
  166. $LostConnectionText0[0][0] = 764
  167. $LostConnectionText0[0][1] = 493
  168. $LostConnectionText0[0][2] = 843
  169. $LostConnectionText0[0][3] = 521
  170. $LostConnectionText1[0][0] = 779
  171. $LostConnectionText1[0][1] = 507
  172. $LostConnectionText1[0][2] = 853
  173. $LostConnectionText1[0][3] = 525
  174. $CharLoc[0][0] = 944
  175. $CharLoc[0][1] = 507
  176. $CastLoc[0][0] = 600
  177. $CastLoc[0][1] = 300
  178. $SellCoords[0][0] = 517
  179. $SellCoords[0][1] = 238
  180. $SlotOffset[0] = 48
  181. $ItemStartCoord0[0][0] = 1460
  182. $ItemStartCoord0[0][1] = 631
  183. $ItemStartCoord0[0][2] = 1462
  184. $ItemStartCoord0[0][3] = 633
  185. $ItemStartCoord1[0][0] = 1460
  186. $ItemStartCoord1[0][1] = 625
  187. $ItemStartCoord1[0][2] = 1468
  188. $ItemStartCoord1[0][3] = 632
  189. $BagFullCoords[0][0] = 1067
  190. $BagFullCoords[0][1] = 129
  191. $BagFullCoords[0][2] = 1116
  192. $BagFullCoords[0][3] = 155
  193. $IdleCursorCoords[0][0] = 400
  194. $IdleCursorCoords[0][1] = 300
  195. $RunDelayMult[0] = 1.5
  196.  
  197. ;800x600
  198. $pngLoc[1] = "F:\Program Files (x86)\Diablo III\pics\800x600\" ; Need people to make those pics
  199. $Resume[1][0] = 174
  200. $Resume[1][1] = 232
  201. $GameLobbyCode[1][0] = 174
  202. $GameLobbyCode[1][1] = 232
  203. $GameLobbyCode[1][2] = 4262400
  204. $GameScreenCode[1][0] = 486
  205. $GameScreenCode[1][1] = 578
  206. $GameScreenCode[1][2] = 0x6C9BFF
  207. ; Need people working on the following coordinates
  208. $LostConnectionOkBtn[1][0] = 0
  209. $LostConnectionOkBtn[1][1] = 0
  210. $LostConnectionText0[1][0] = 0
  211. $LostConnectionText0[1][1] = 0
  212. $LostConnectionText0[1][2] = 0
  213. $LostConnectionText0[1][3] = 0
  214. $LostConnectionText1[1][0] = 0
  215. $LostConnectionText1[1][1] = 0
  216. $LostConnectionText1[1][2] = 0
  217. $LostConnectionText1[1][3] = 0
  218. $CharLoc[1][0] = 0
  219. $CharLoc[1][0] = 0
  220. $CastLoc[1][0] = 0
  221. $CastLoc[1][1] = 0
  222. $SellCoords[1][0] = 0
  223. $SellCoords[1][1] = 0
  224. $SlotOffset[1] = 0
  225. $ItemStartCoord0[1][0] = 0
  226. $ItemStartCoord0[1][1] = 0
  227. $ItemStartCoord0[1][2] = 0
  228. $ItemStartCoord0[1][3] = 0
  229. $ItemStartCoord1[1][0] = 0
  230. $ItemStartCoord1[1][1] = 0
  231. $ItemStartCoord1[1][2] = 0
  232. $ItemStartCoord1[1][3] = 0
  233. $BagFullCoords[1][0] = 0
  234. $BagFullCoords[1][1] = 0
  235. $BagFullCoords[1][2] = 0
  236. $BagFullCoords[1][3] = 0
  237. $IdleCursorCoords[1][0] = 0
  238. $IdleCursorCoords[1][1] = 0
  239. $RunDelayMult[1] = 0
  240.  
  241.  
  242. ;1920x1080
  243. $Leave[0][0] = 969
  244. $Leave[0][1] = 582
  245.  
  246. ;800x600
  247. $Leave[1][0] = 397
  248. $Leave[1][1] = 322
  249.  
  250. ;1920x1080
  251. $Loc1[0][0] = 500 ;First movement
  252. $Loc1[0][1] = 250
  253. $Loc2[0][0] = 1 ;Second movement
  254. $Loc2[0][1] = 370
  255. $Loc3[0][0] = 400 ;Third Movement
  256. $Loc3[0][1] = 600
  257.  
  258. ;800x600
  259. $Loc1[1][0] = 8 ;First movement
  260. $Loc1[1][1] = 146
  261. $Loc2[1][0] = 7 ;Second movement
  262. $Loc2[1][1] = 300
  263. $Loc3[1][0] = 8 ;Third Movement
  264. $Loc3[1][1] = 300
  265.  
  266. ;1080P
  267. $CellarLocation[0][0] = 307 ;Cellar door location
  268. $CellarLocation[0][1] = 74
  269. ;800x600
  270. $CellarLocation[1][0] = 499 ;Cellar door location
  271. $CellarLocation[1][1] = 148
  272. $CellarLocation2[0] = 439
  273. $CellarLocation2[1] = 145
  274. $AltCellarLocation = False
  275.  
  276. ;Cellar offset
  277. $CellarOffset[0] = 33;
  278. $CellarOffset[1] = 10;
  279.  
  280. ;1080P
  281. $Loc5[0][0] = 116 ;Walk down hallway
  282. $Loc5[0][1] = 986
  283. $Loc6[0][0] = 776 ;enter hallway
  284. $Loc6[0][1] = 328
  285. ;800x600
  286. $Loc5[1][0] = 3 ;Walk down hallway
  287. $Loc5[1][1] = 504
  288. $Loc6[1][0] = 255 ;enter hallway
  289. $Loc6[1][1] = 190
  290.  
  291. ;1080P
  292. $MonsterLoc[0][0] = 577
  293. $MonsterLoc[0][1] = 183
  294. ;800x600
  295. $MonsterLoc[1][0] = 188
  296. $MonsterLoc[1][1] = 111
  297.  
  298. ;1920x1080
  299. $MonsterSearch[0][0] = 162
  300. $MonsterSearch[0][1] = 29
  301. $MonsterSearch[0][2] = 1248
  302. $MonsterSearch[0][3] = 446
  303. ;800x600
  304. $MonsterSearch[1][0] = 40
  305. $MonsterSearch[1][1] = 53
  306. $MonsterSearch[1][2] = 424
  307. $MonsterSearch[1][3] = 191
  308.  
  309. ;1920x1080
  310. $GoldLoot1[0][0] = 402
  311. $GoldLoot1[0][1] = 306
  312. $GoldLoot2[0][0] = 1260
  313. $GoldLoot2[0][1] = 351
  314. $GoldLoot3[0][0] = 911
  315. $GoldLoot3[0][1] = 694
  316. ;800x600
  317. $GoldLoot1[1][0] = 96
  318. $GoldLoot1[1][1] = 181
  319. $GoldLoot2[1][0] = 560
  320. $GoldLoot2[1][1] = 191
  321. $GoldLoot3[1][0] = 349
  322. $GoldLoot3[1][1] = 418
  323.  
  324. ;1080P
  325. $LootingArea[0][0] = 500
  326. $LootingArea[0][1] = 100
  327. $LootingArea[0][2] = 1600
  328. $LootingArea[0][3] = 700
  329. ;800x600
  330. $LootingArea[1][0] = 75
  331. $LootingArea[1][1] = 90
  332. $LootingArea[1][2] = 630
  333. $LootingArea[1][3] = 400
  334.  
  335. ;1080P
  336. $CharHitBox[0][0] = 790
  337. $CharHitBox[0][1] = 315
  338. $CharHitBox[0][2] = 1200
  339. $CharHitBox[0][3] = 730
  340. ;800x600
  341. $CharHitBox[1][0] = 304
  342. $CharHitBox[1][1] = 190
  343. $CharHitBox[1][2] = 468
  344. $CharHitBox[1][3] = 323
  345.  
  346. ;1080P
  347. $DeathBounds[0][0] = 538
  348. $DeathBounds[0][1] = 335
  349. ;800x600
  350. $DeathBounds[1][0] = 210
  351. $DeathBounds[1][1] = 180
  352.  
  353. ;1080P
  354. $RepairCoords[0][0][0] = 1690
  355. $RepairCoords[0][0][1] = 102
  356. $RepairCoords[0][1][0] = 930
  357. $RepairCoords[0][1][1] = 136
  358. $RepairCoords[0][2][0] = 517
  359. $RepairCoords[0][2][1] = 483
  360. $RepairCoords[0][3][0] = 223
  361. $RepairCoords[0][3][1] = 592
  362. ;800x600
  363. $RepairCoords[1][0][0] = 691
  364. $RepairCoords[1][0][1] = 88
  365. $RepairCoords[1][1][0] = 505
  366. $RepairCoords[1][1][1] = 52
  367. $RepairCoords[1][2][0] = 282
  368. $RepairCoords[1][2][1] = 261
  369. $RepairCoords[1][3][0] = 157
  370. $RepairCoords[1][3][1] = 329
  371.  
  372. ;1080P
  373. $RepairCheck[0][0] = 1507
  374. $RepairCheck[0][1] = 36
  375. ;800x600
  376. $RepairCheck[1][0] = 573
  377. $RepairCheck[1][1] = 21
  378.  
  379. Opt('MouseCoordMode', 2)
  380. Opt('PixelCoordMode', 2)
  381. HotKeySet("|", "Terminate")
  382. HotKeySet('{F2}', 'Pause')
  383. Global $Paused
  384.  
  385. ;bot starts paused. press space to start.
  386. Pause()
  387.  
  388. ;Finding loot takes time. We don't want to overdo it
  389. $LootAttempts = 0
  390. $GemLootAttempts = 0
  391.  
  392. Sleep(214) ; Please put a random small number here which will confuse Wardon's harsh function
  393.  
  394. WinActivate('Diablo III')
  395. While 1
  396.         If WinActive('Diablo III') Then
  397.  
  398.                 Local $gX
  399.                 Local $gY
  400.  
  401.                 $AltCellarLocation = False
  402.                 $LootAttempts = 0
  403.                 $GemLootAttempts = 0
  404.                 $BagFull = False
  405.  
  406.                 ;Make sure that we are in the character selection screen ( we are looking at a spot in the Resume game button)
  407.                 For $i = 15 To 0 Step -1
  408.                         If InGameLobby() Then
  409.                                 ExitLoop
  410.                         EndIf
  411.  
  412.                         Sleep(600)
  413.                         If _ImageSearchArea($pngLoc[$R] & "game.png", 1, $LostConnectionText0[$R][0], _
  414.                                         $LostConnectionText0[$R][1], $LostConnectionText0[$R][2], _
  415.                                         $LostConnectionText0[$R][3], $gX, $gY, 90) _
  416.                                         Or _ImageSearchArea($pngLoc[$R] & "therewas.png", 1, $LostConnectionText1[$R][0], _
  417.                                         $LostConnectionText1[$R][1], $LostConnectionText1[$R][2], _
  418.                                         $LostConnectionText1[$R][3], $gX, $gY, 90) Then
  419.                                 ; check if we lost connection
  420.                                 Click($LostConnectionOkBtn[$R][0], $LostConnectionOkBtn[$R][1])
  421.                                 ContinueLoop
  422.                         EndIf
  423.                         If $i == 1 Then
  424.                                 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)
  425.                                 Terminate()
  426.                         EndIf
  427.                 Next
  428.  
  429.                 ;Resume the game
  430.                 Click($Resume[$R][0], $Resume[$R][1])
  431.  
  432.                 ;Make sure that we are in the game
  433.                 For $i = 12 To 0 Step -1
  434.                         If InGameplayScreen() Then
  435.                                 ExitLoop
  436.                         EndIf
  437.  
  438.                         Sleep(1000)
  439.                         If $i == 1 Then
  440.                                 MsgBox(4096, "Error Starting the Game", "The game did not properly load...Are you using English language? Do not use custom themes!", 50)
  441.                                 Terminate()
  442.                         EndIf
  443.                 Next
  444.  
  445.  
  446.                 Rest(200)
  447.                 Send("{2}")
  448.                 Rest(400)
  449.  
  450.                 ;Custom running for the 800x600. Sometimes I wonder if it's faster to just buy everyone a 1080P monitor...
  451.                 If Int($R) == 1 Then
  452.                         MouseMove(11, 220)
  453.                         Sleep(400)
  454.                         Send("{4}")
  455.                         MouseDown("middle")
  456.                         Sleep($RunTime)
  457.  
  458.                         MouseUp("middle")
  459.                         Sleep(2000)
  460.  
  461.                         #cs $CellarIcon = PixelSearch(630, 70, 741, 149, 0x71341A, 5)
  462.                                 if not @error then
  463.                                 ConsoleWrite("Foundtheseller" & @LF)
  464.  
  465.                                 EndIf
  466.                         #ce
  467.  
  468.                 Else
  469.                         Move($Loc1[$R][0], $Loc1[$R][1])
  470.                         Sleep(200)
  471.                         Send("{4}")
  472.                         Sleep(500)
  473.                         Move($Loc2[$R][0], $Loc2[$R][1])
  474.                         Sleep(1100)
  475.                         Move($Loc3[$R][0], $Loc3[$R][1])
  476.                 EndIf
  477.  
  478.  
  479.                 ;Check to see if the cellar is there ```````
  480.                 MouseMove($CellarLocation[$R][0], $CellarLocation[$R][1])
  481.                 Sleep(400)
  482.                 If Int($R) = 1 Then
  483.                         $CellarPixel = PixelSearch($CellarLocation[$R][0] - 30, $CellarLocation[$R][1] - 30, _
  484.                                         $CellarLocation[$R][0] + 20, $CellarLocation[$R][1] + 20, 0x93D7F9, 8)
  485.  
  486.                         If @error Then
  487.                                 MouseMove($CellarLocation2[0], $CellarLocation2[1])
  488.                                 Sleep(300)
  489.                                 $CellarPixel = PixelSearch($CellarLocation2[0] - 30, $CellarLocation2[1] - 30, _
  490.                                                 $CellarLocation2[0] + 20, $CellarLocation2[1] + 20, 0x93D7F9, 8)
  491.                                 If Not @error Then
  492.                                         $AltCellarLocation = True
  493.                                 EndIf
  494.                         EndIf
  495.                 Else
  496.                         $CellarPixel = PixelSearch($CellarLocation[$R][0] - $CellarOffset[$R], $CellarLocation[$R][1] _
  497.                                          - $CellarOffset[$R], $CellarLocation[$R][0] + 4, $CellarLocation[$R][1] + 4, 0x334FB7, 6)
  498.                 EndIf
  499.  
  500.                 ;Leave the game if the Cellar is not there
  501.                 If @error Then
  502.                         ConsoleWrite("Did not find the cellar " & @LF)
  503.                         Send("{SHIFTDOWN}")
  504.                         Sleep(10)
  505.                         Click($CharLoc[$R][0], $CharLoc[$R][1])
  506.                         Sleep(50)
  507.                         Send("{SHIFTUP}")
  508.                         ;Cast Voodoo and Grasp of the Dead to ensure safety
  509.                         Send("{1}")
  510.                         Rest(300)
  511.                         Send("{3}")
  512.                         Rest(300)
  513.                         leaveGame()
  514.                         Sleep(12000)
  515.                         ContinueLoop
  516.                 EndIf
  517.  
  518.                 ;Enter the cellar
  519.                 ConsoleWrite("Entering the Cellar..." & @LF)
  520.                 If $R > 0 And $AltCellar Then
  521.                         Click($CellarLocation2[$R][0] - 4, $CellarLocation2[$R][1] - 4)
  522.                 Else
  523.                         If Not $AltCellarLocation Then
  524.                                 Click($CellarLocation[$R][0], $CellarLocation[$R][1])
  525.                         Else
  526.                                 Click($CellarLocation2[0], $CellarLocation2[1])
  527.                         EndIf
  528.                 EndIf
  529.  
  530.                 If Int($R) == 1 Then
  531.                         Sleep(500 + $ComputerLag)
  532.                 Else
  533.                         Sleep(2500 + $ComputerLag)
  534.                 EndIf
  535.  
  536.                 ;Check to see if we died
  537.                 If CheckForDeath() Then
  538.                         ContinueLoop
  539.                 EndIf
  540.  
  541.                 ;Inside the celler now - Move to the doorway
  542.                 Move($Loc5[$R][0], $Loc5[$R][1])
  543.                 Sleep(1400)
  544.                 Move($Loc6[$R][0], $Loc6[$R][1])
  545.                 Sleep(300)
  546.                 ;Cast Voodoo
  547.                 Send("{1}")
  548.  
  549.                 ;Cast Grasp of the Dead
  550.                 MouseMove($CastLoc[$R][0], $CastLoc[$R][1])
  551.                 Send("{3}")
  552.  
  553.                 ;Kill all the enemies inside
  554.                 While 1
  555.  
  556.                         $MonsterBar = PixelSearch($MonsterSearch[$R][0], $MonsterSearch[$R][1], _
  557.                                         $MonsterSearch[$R][2], $MonsterSearch[$R][3], 0xEE0000, 10)
  558.                         If @error Then
  559.                                 ConsoleWrite("Didn't find any, attacking to discover potential enemies" & @LF)
  560.                                 Attack($MonsterLoc[$R][0], $MonsterLoc[$R][1])
  561.                                 Sleep(500)
  562.                                 $MonsterBar = PixelSearch($MonsterSearch[$R][0], $MonsterSearch[$R][1], _
  563.                                                 $MonsterSearch[$R][2], $MonsterSearch[$R][3], 0xEE0000, 10)
  564.                                 If @error Then
  565.                                         ConsoleWrite("No monsters found - Moving on")
  566.                                         ExitLoop
  567.                                 EndIf
  568.                         EndIf
  569.  
  570.                         ;if CheckForNearbyMonsters() Then
  571.                         ;send("{4}")
  572.                         ;EndIf
  573.  
  574.                         For $i = 7 To 0 Step -1
  575.                                 Attack($MonsterBar[0], $MonsterBar[1])
  576.                                 Sleep(100)
  577.                         Next
  578.                 WEnd
  579.  
  580.  
  581.                 ;Loot the gold and attack anything we missed
  582.                 Move($GoldLoot1[$R][0], $GoldLoot1[$R][1])
  583.                 Sleep(Random(800, 900))
  584.                 AttackNearbyMonsters()
  585.                 Move($GoldLoot2[$R][0], $GoldLoot2[$R][1])
  586.                 Sleep(Random(400, 500))
  587.                 AttackNearbyMonsters()
  588.                 Move($GoldLoot3[$R][0], $GoldLoot3[$R][1])
  589.                 Sleep(Random(400, 500))
  590.                 AttackNearbyMonsters()
  591.  
  592.                 ;Loot items
  593.                 If $LootRares Then
  594.                         $BagFull = LootRares()
  595.                         $LootAttemps = 0
  596.                         $BagFull = LootLegendaries()
  597.                         $LootAttempts = 0
  598.                 EndIf
  599.  
  600.                 If $LootBlues And $BagFull = False Then
  601.                         $LootAttempts = 0
  602.                         $BagFull = LootMagic()
  603.                 EndIf
  604.  
  605.                 If $LootGems Then
  606.                         LootGems()
  607.                 EndIf
  608.  
  609.                 If $LootGold Then
  610.                         LootGold()
  611.                 EndIf
  612.  
  613.                 If $LootTomes Then
  614.                         LootTomes()
  615.                 EndIf
  616.  
  617.                 If $LootPotions Then
  618.                         LootPotions()
  619.                 EndIf
  620.  
  621.                 ;Check to see if we died
  622.                 If CheckForDeath() Then
  623.                         ContinueLoop
  624.                 EndIf
  625.  
  626.                 ;Teleport to town
  627.                 Send("{t}")
  628.                 Sleep(8000)
  629.  
  630.                 RepairOrSellItems()
  631.  
  632.                 ;Leave the game
  633.                 LeaveGame()
  634.                 Sleep(1000)
  635.  
  636.         EndIf
  637. WEnd
  638.  
  639. Func CheckForRepair()
  640.         $RepairNeeded = PixelSearch($RepairCheck[$R][0], $RepairCheck[$R][1], $RepairCheck[$R][0] + 5, _
  641.                         $RepairCheck[$R][1] + 5, 0xFFE801, 10)
  642.  
  643.         If Not @error Then
  644.                 Return True
  645.         Else
  646.                 Return False
  647.         EndIf
  648. EndFunc   ;==>CheckForRepair
  649.  
  650.  
  651. Func RepairOrSellItems()
  652.         Local $NeedRepair
  653.         Local $xx
  654.         Local $yy
  655.         Local $sell
  656.         $NeedRepair = CheckForRepair()
  657.         ; Repair the gears when needed
  658.         If ($NeedRepair And $Repair) Or ($BagFull And $SellBlues) Then
  659.                 Move($RepairCoords[$R][0][0], $RepairCoords[$R][0][1])
  660.                 Sleep(2000 + $ComputerLag)
  661.                 MouseMove($RepairCoords[$R][1][0], $RepairCoords[$R][1][1])
  662.                 Sleep(400)
  663.                 Click($RepairCoords[$R][1][0], $RepairCoords[$R][1][1])
  664.                 Sleep(1300 + $ComputerLag)
  665.                 If $NeedRepair And $Repair Then
  666.                         Click($RepairCoords[$R][2][0], $RepairCoords[$R][2][1])
  667.                         Sleep(Random(700 - 900))
  668.                         Click($RepairCoords[$R][3][0], $RepairCoords[$R][3][1])
  669.                         Sleep(500)
  670.                 EndIf
  671.                 ; If the bag is full, sell the blues
  672.                 If ($BagFull And $SellBlues) Then
  673.                         Sleep(300)
  674.                         Click($SellCoords[$R][0], $SellCoords[$R][1]);
  675.                         Sleep(300)
  676.                         For $xx = 0 To 8 Step 1
  677.                                 For $yy = 0 To 5 Step 1
  678.                                         ; An item recently picked up has blue frame arround the slots
  679.                                         $sell = PixelSearch($ItemStartCoord0[$R][0] + $xx * $SlotOffset[$R], _
  680.                                                         $ItemStartCoord0[$R][1] + $yy * $SlotOffset[$R], _
  681.                                                         $ItemStartCoord0[$R][2] + $xx * $SlotOffset[$R], _
  682.                                                         $ItemStartCoord0[$R][3] + $yy * $SlotOffset[$R], 0x0000FF, 10)
  683.                                         If Not @error Then
  684.                                                 MouseClick("right", $sell[0], $sell[1])
  685.                                         Else
  686.                                                 ; Otherwise the color of the frame is lighter
  687.                                                 $sell = PixelSearch($ItemStartCoord1[$R][0] + $xx * $SlotOffset[$R], _
  688.                                                                 $ItemStartCoord1[$R][1] + $yy * $SlotOffset[$R], _
  689.                                                                 $ItemStartCoord1[$R][2] + $xx * $SlotOffset[$R], _
  690.                                                                 $ItemStartCoord1[$R][3] + $yy * $SlotOffset[$R], 0x182A5B, 30)
  691.                                                 If Not @error Then
  692.                                                         MouseClick("right", $sell[0], $sell[1])
  693.                                                 EndIf
  694.                                         EndIf
  695.                                 Next
  696.                         Next
  697.                 EndIf
  698.                 Sleep(300)
  699.                 Send("{esc}")
  700.         EndIf
  701. EndFunc   ;==>RepairOrSellItems
  702.  
  703. Func Terminate()
  704.         Exit 0
  705. EndFunc   ;==>Terminate
  706.  
  707. Func LeaveGame()
  708.         Send("{esc}")
  709.         Sleep(400)
  710.         Click($Leave[$R][0], $Leave[$R][1])
  711. EndFunc   ;==>LeaveGame
  712.  
  713. Func Pause()
  714.         $Paused = Not $Paused
  715.         While $Paused
  716.                 Sleep(100)
  717.                 ToolTip('Paused... (Press F2 to run it)', 0, 0)
  718.         WEnd
  719.         ToolTip("")
  720. EndFunc   ;==>Pause
  721.  
  722. Func Click($x, $y)
  723.         MouseClick('left', Random($x - 3, $x + 3), Random($y - 3, $y + 3), 1, Random(0, 1))
  724.         Sleep(Random(1000, 1500))
  725. EndFunc   ;==>Click
  726.  
  727. Func Move($x, $y)
  728.         MouseClick('middle', Random($x - 3, $x + 3), Random($y - 3, $y + 3), 1, Random(0, 1))
  729.         Sleep(Random(1000, 1500))
  730. EndFunc   ;==>Move
  731.  
  732. Func Attack($x, $y)
  733.         MouseClick('right', Random($x - 3, $x + 3), Random($y - 3, $y + 3), 1, Random(0, 1))
  734. EndFunc   ;==>Attack
  735.  
  736. Func Rest($z)
  737.         Sleep(Random($z, $z + 25))
  738. EndFunc   ;==>Rest
  739.  
  740. Func CheckForDeath()
  741.         ConsoleWrite("Checking to see if we died")
  742.         $Death = PixelSearch($DeathBounds[$R][0], $DeathBounds[$R][0], $DeathBounds[$R][0] + 4, _
  743.                         $DeathBounds[$R][0] + 4, 0xFFFFFF)
  744.         If Not @error Then
  745.                 ConsoleWrite("Died" & @LF)
  746.                 LeaveGame()
  747.                 Sleep(10000)
  748.                 Return True
  749.         Else
  750.                 Return False
  751.         EndIf
  752. EndFunc   ;==>CheckForDeath
  753.  
  754. Func CalcDist($x, $y)
  755.         Local $dx = $x - $CharLoc[$R][0]
  756.         Local $dy = $y - $CharLoc[$R][1]
  757.         Return Sqrt($dx ^ 2 + $dy ^ 2)
  758. EndFunc   ;==>CalcDist
  759.  
  760. Func LootMagic()
  761.         Local $gX
  762.         Local $gY
  763.         $Magic = PixelSearch($LootingArea[$R][0], $LootingArea[$R][1], $LootingArea[$R][2], _
  764.                         $LootingArea[$R][3], 0x6969FF, 4) ;
  765.         If Not @error Then
  766.                 Click($Magic[0] + 5, $Magic[1] + 2)
  767.                 Sleep(Round($RunDelayMult[$R] * CalcDist($gX, $gY)))
  768.                 If _ImageSearchArea($pngLoc[$R] & "item.png", 1, $BagFullCoords[$R][0], $BagFullCoords[$R][1], _
  769.                                 $BagFullCoords[$R][2], $BagFullCoords[$R][3], $gX, $gY, 90) Then
  770.                         Return True
  771.                 EndIf
  772.         EndIf
  773.  
  774.         $LootAttempts += 1
  775.         If ($LootAttempts > 5) Then
  776.                 Return
  777.         Else
  778.                 If LootMagic() Then
  779.                         Return True
  780.                 EndIf
  781.         EndIf
  782.         Return False
  783. EndFunc   ;==>LootMagic
  784.  
  785.  
  786. Func LootRares()
  787.         Local $gX
  788.         Local $gY
  789.         $Rare = PixelSearch($LootingArea[$R][0], $LootingArea[$R][1], $LootingArea[$R][2], _
  790.                         $LootingArea[$R][3], 0xBBBB00, 4)
  791.         If Not @error Then
  792.                 Click($Rare[0] + 5, $Rare[1] + 2)
  793.                 Sleep(Round($RunDelayMult[$R] * CalcDist($gX, $gY)))
  794.                 If _ImageSearchArea($pngLoc[$R] & "item.png", 1, $BagFullCoords[$R][0], $BagFullCoords[$R][1], _
  795.                                 $BagFullCoords[$R][2], $BagFullCoords[$R][3], $gX, $gY, 90) Then
  796.                         Return True
  797.                 EndIf
  798.         EndIf
  799.  
  800.         $LootAttempts += 1
  801.         If ($LootAttempts > 5) Then
  802.                 Return
  803.         Else
  804.                 If LootRares() Then
  805.                         Return True
  806.                 EndIf
  807.         EndIf
  808.         Return False
  809. EndFunc   ;==>LootRares
  810.  
  811.  
  812.  
  813. Func LootLegendaries()
  814.         Local $gX
  815.         Local $gY
  816.         $Legendary = PixelSearch($LootingArea[$R][0], $LootingArea[$R][1], $LootingArea[$R][2], _
  817.                         $LootingArea[$R][3], 0xBF642F, 2) ;
  818.         If Not @error Then
  819.                 Click($Legendary[0] + 5, $Legendary[1] + 2)
  820.                 Sleep(Round($RunDelayMult[$R] * CalcDist($gX, $gY)))
  821.                 If _ImageSearchArea($pngLoc[$R] & "item.png", 1, $BagFullCoords[$R][0], $BagFullCoords[$R][1], _
  822.                                 $BagFullCoords[$R][2], $BagFullCoords[$R][3], $gX, $gY, 90) Then
  823.                         ; Will terminate if a legendary is present and the bag is full
  824.                         MsgBox(0, "Oops!", "Your bag is full and you may not want to miss this item")
  825.                         terminate()
  826.                 EndIf
  827.         EndIf
  828.  
  829.         $set = PixelSearch($LootingArea[$R][0], $LootingArea[$R][1], $LootingArea[$R][2], _
  830.                         $LootingArea[$R][2], 0x02CE01, 2) ;
  831.         If Not @error Then
  832.                 Click($set[0] + 5, $set[1] + 2)
  833.                 Sleep(Round($RunDelayMult[$R] * CalcDist($gX, $gY)))
  834.                 If _ImageSearchArea($pngLoc[$R] & "item.png", 1, $BagFullCoords[$R][0], $BagFullCoords[$R][1], _
  835.                                 $BagFullCoords[$R][2], $BagFullCoords[$R][3], $gX, $gY, 90) Then
  836.                         MsgBox(0, "Oops!", "Your bag is full and you may not want to miss this item")
  837.                         terminate()
  838.                 EndIf
  839.         EndIf
  840.  
  841.         $LootAttempts += 1
  842.         If ($LootAttempts > 3) Then
  843.                 Return
  844.         Else
  845.                 LootLegendaries()
  846.         EndIf
  847. EndFunc   ;==>LootLegendaries
  848.  
  849. Func LootGems()
  850.         Local $gX = 0
  851.         Local $gY = 0
  852.         MouseMove($IdleCursorCoords[$R][0], $IdleCursorCoords[$R][0])
  853.         While _ImageSearchArea($pngLoc[$R] & "square.png", 1, 0, 0, @DesktopWidth, @DesktopHeight, $gX, $gY, 90)
  854.                 MouseClick("left", $gX, $gY)
  855.                 Sleep(Round($RunDelayMult[$R] * CalcDist($gX, $gY)))
  856.                 If _ImageSearchArea($pngLoc[$R] & "item.png", 1, $BagFullCoords[$R][0], $BagFullCoords[$R][1], _
  857.                                 $BagFullCoords[$R][2], $BagFullCoords[$R][3], $gX, $gY, 90) Then
  858.                         Return True
  859.                 EndIf
  860.                 MouseMove($IdleCursorCoords[$R][0], $IdleCursorCoords[$R][0])
  861.                 Sleep(100)
  862.         WEnd
  863.         Return False
  864. EndFunc   ;==>LootGems
  865.  
  866. Func LootGold()
  867.         Local $gX = 0
  868.         Local $gY = 0
  869.         MouseMove($IdleCursorCoords[$R][0], $IdleCursorCoords[$R][0])
  870.         While _ImageSearchArea($pngLoc[$R] & "gold.png", 1, 0, 0, @DesktopWidth, @DesktopHeight, $gX, $gY, 90)
  871.                 MouseClick("left", $gX, $gY)
  872.                 MouseMove($IdleCursorCoords[$R][0], $IdleCursorCoords[$R][0])
  873.                 Sleep(Round($RunDelayMult[$R] * CalcDist($gX, $gY)))
  874.         WEnd
  875. EndFunc   ;==>LootGold
  876.  
  877. Func LootTomes()
  878.         Local $gX = 0
  879.         Local $gY = 0
  880.         MouseMove($IdleCursorCoords[$R][0], $IdleCursorCoords[$R][0])
  881.         While _ImageSearchArea($pngLoc[$R] & "tome.png", 1, 0, 0, @DesktopWidth, @DesktopHeight, $gX, $gY, 90)
  882.                 MouseClick("left", $gX, $gY)
  883.                 MouseMove($IdleCursorCoords[$R][0], $IdleCursorCoords[$R][0])
  884.                 Sleep(Round($RunDelayMult[$R] * CalcDist($gX, $gY)))
  885.         WEnd
  886. EndFunc   ;==>LootTomes
  887.  
  888. Func LootPotions()
  889.         Local $gX = 0
  890.         Local $gY = 0
  891.         MouseMove($IdleCursorCoords[$R][0], $IdleCursorCoords[$R][0])
  892.         While _ImageSearchArea($pngLoc[$R] & "potion.png", 1, 0, 0, @DesktopWidth, @DesktopHeight, $gX, $gY, 90)
  893.                 MouseClick("left", $gX, $gY)
  894.                 MouseMove($IdleCursorCoords[$R][0], $IdleCursorCoords[$R][0])
  895.                 Sleep(Round($RunDelayMult[$R] * CalcDist($gX, $gY)))
  896.         WEnd
  897. EndFunc   ;==>LootPotions
  898.  
  899. Func AttackNearbyMonsters()
  900.         While 1
  901.                 $MonsterData = PixelSearch($CharHitBox[$R][0], $CharHitBox[$R][1], $CharHitBox[$R][2], $CharHitBox[$R][3], 0xEE0000, 10)
  902.                 If @error Then
  903.                         ExitLoop
  904.                 EndIf
  905.  
  906.                 Send("{4}")
  907.                 Sleep(300)
  908.                 For $i = 10 To 0 Step -1
  909.                         Attack($MonsterData[0], $MonsterData[1])
  910.                         Sleep(100)
  911.                 Next
  912.         WEnd
  913. EndFunc   ;==>AttackNearbyMonsters
  914.  
  915. Func CheckForNearbyMonsters()
  916.         $MonsterData = PixelSearch($CharHitBox[$R][0], $CharHitBox[$R][1], $CharHitBox[$R][2], $CharHitBox[$R][3], 0xEE0000, 10)
  917.         If @error Then
  918.                 Return False
  919.         Else
  920.                 Return True
  921.         EndIf
  922. EndFunc   ;==>CheckForNearbyMonsters
  923.  
  924.  
  925. Func SnareNearbyEnemies()
  926.         $MonsterData = PixelSearch($CharHitBox[$R][0], $CharHitBox[$R][1], $CharHitBox[$R][2], $CharHitBox[$R][3], 0xEE0000, 10)
  927.         If Not @error Then
  928.                 MouseMove($MonsterData[0], $MonsterData[1])
  929.                 Sleep(350)
  930.                 Send("{3}")
  931.                 Sleep(250)
  932.         EndIf
  933. EndFunc   ;==>SnareNearbyEnemies
  934.  
  935.  
  936. Func InGameLobby()
  937.         MouseMove($GameLobbyCode[$R][0], $GameLobbyCode[$R][1])
  938.         Sleep(300)
  939.         PixelSearch($GameLobbyCode[$R][0], $GameLobbyCode[$R][1], $GameLobbyCode[$R][0] + 10, $GameLobbyCode[$R][1] + 10, $GameLobbyCode[$R][2], 10)
  940.         If Not @error Then
  941.                 Return True
  942.         Else
  943.                 Return False
  944.         EndIf
  945. EndFunc   ;==>InGameLobby
  946.  
  947. Func InGameplayScreen()
  948.         PixelSearch($GameScreenCode[$R][0], $GameScreenCode[$R][1], $GameScreenCode[$R][0] + 4, $GameScreenCode[$R][1] + 3, $GameScreenCode[$R][2], 10)
  949.         If Not @error Then
  950.                 Return True
  951.         Else
  952.                 Return False
  953.         EndIf
  954. EndFunc   ;==>InGameplayScreen
  955.  
  956. Func _ImageSearchArea($findImage, $resultPosition, $x1, $y1, $right, $bottom, ByRef $x, ByRef $y, $tolerance)
  957.         $findImage = "*TRANSBLACK " & $findImage
  958.         If $tolerance > 0 Then $findImage = "*" & $tolerance & " " & $findImage
  959.         $result = DllCall("ImageSearchDLL_x64.dll", "str", "ImageSearch", "int", $x1, "int", $y1, "int", $right, "int", $bottom, "str", $findImage)
  960.         If $result = "0" Then Return 0
  961.  
  962.         ; Otherwise get the x,y location of the match and the size of the image to
  963.         ; compute the centre of search
  964.         $array = StringSplit($result[0], "|")
  965.         If (UBound($array) >= 4) Then
  966.                 $x = Int(Number($array[2]))
  967.                 $y = Int(Number($array[3]))
  968.                 If $resultPosition = 1 Then
  969.                         $x = $x + Int(Number($array[4]) / 2)
  970.                         $y = $y + Int(Number($array[5]) / 2)
  971.                 EndIf
  972.                 Return 1
  973.         EndIf
  974. EndFunc   ;==>_ImageSearchArea
  975.  
  976. Func ActivateGUI()
  977.  
  978.         ;setup the UI
  979.         $Waiting = True
  980.  
  981.         $Form1 = GUICreate("D3 Witch Doctor bot by Avatar88343 and Andygongyb", 500, 320, -1, -1)
  982.  
  983.         GUICtrlCreateLabel("Warning: the script is for education only, not approved for any form of commercial use", _
  984.                         25, 30, 550, -1)
  985.  
  986.         GUICtrlCreateLabel("Hotkeys:" & @CRLF & @TAB & "Terminate:" & @TAB & "SHIFT + \" & @CRLF _
  987.                          & @TAB & "Pause:" & @TAB & @TAB & "F2", 25, 50, 550, -1)
  988.  
  989.         GUICtrlCreateLabel("Game Resolution", 25, 100, 100, -1)
  990.         $ResCombo = GUICtrlCreateCombo("", 25, 115, 200, -1)
  991.         GUICtrlSetData($ResCombo, "1920 x 1080|800 x 600", "Select your Res")
  992.  
  993.         GUICtrlCreateLabel("Character run speed (for 800x600)", 275, 100, 200, -1)
  994.         $RunInput = GUICtrlCreateInput("0", 275, 115, 200, -1)
  995.  
  996.         $LootRareCheck = GUICtrlCreateCheckbox("Loot rares/legs/sets", 25, 160)
  997.         GUICtrlSetState($LootRareCheck, $GUI_CHECKED)
  998.  
  999.         $LootBluesCheck = GUICtrlCreateCheckbox("Loot blues", 150, 160)
  1000.         GUICtrlSetState($LootBluesCheck, $GUI_CHECKED)
  1001.  
  1002.         $LootGemsCheck = GUICtrlCreateCheckbox("Loot gems", 275, 160)
  1003.         GUICtrlSetState($LootGemsCheck, $GUI_CHECKED)
  1004.  
  1005.         $LootPotionsCheck = GUICtrlCreateCheckbox("Loot potions", 400, 160)
  1006.         GUICtrlSetState($LootPotionsCheck, $GUI_CHECKED)
  1007.  
  1008.         $LootTomesCheck = GUICtrlCreateCheckbox("Loot tomes of secret", 25, 190)
  1009.         GUICtrlSetState($LootTomesCheck, $GUI_CHECKED)
  1010.  
  1011.         $LootGoldCheck = GUICtrlCreateCheckbox("Collect the gold carefully (slower)", 275, 190)
  1012.         GUICtrlSetState($LootGoldCheck, $GUI_CHECKED)
  1013.  
  1014.         $RepairCheckbox = GUICtrlCreateCheckbox("Repair gears when needed", 25, 220)
  1015.         GUICtrlSetState($RepairCheckbox, $GUI_CHECKED)
  1016.  
  1017.         $SellBluesCheckbox = GUICtrlCreateCheckbox("Sell blue item when the bag is full", 275, 220)
  1018.         GUICtrlSetState($SellBluesCheckbox, $GUI_CHECKED)
  1019.  
  1020.         $StartButton = GUICtrlCreateButton("Start", 175, 260, 150, 33)
  1021.  
  1022.         GUISetState(@SW_SHOW)
  1023.  
  1024.         ;Wait for them to press start
  1025.         While $Waiting
  1026.                 $Action = GUIGetMsg()
  1027.  
  1028.                 If $Action = $GUI_EVENT_CLOSE Then Terminate()
  1029.                 If $Action = $StartButton Then ExitLoop
  1030.  
  1031.                 Sleep(50)
  1032.         WEnd
  1033.  
  1034.         ;Get the values
  1035.         $SelectedRes = GUICtrlRead($ResCombo)
  1036.         If $SelectedRes = "1920 x 1080" Then
  1037.                 $R = 0
  1038.         ElseIf $SelectedRes = "800 x 600" Then
  1039.                 $R = 1
  1040.         Else
  1041.                 MsgBox(0, "Error", "You did not select a resolution! Try again")
  1042.                 Terminate()
  1043.         EndIf
  1044.  
  1045.         $RunSpeed = Int(GUICtrlRead($RunInput))
  1046.         $LootRares = GUICtrlRead($LootRareCheck) = $GUI_CHECKED
  1047.         $LootBlues = GUICtrlRead($LootBluesCheck) = $GUI_CHECKED
  1048.         $LootGems = GUICtrlRead($LootGemsCheck) = $GUI_CHECKED
  1049.         $LootPotions = GUICtrlRead($LootPotionsCheck) = $GUI_CHECKED
  1050.         $LootTomes = GUICtrlRead($LootTomesCheck) = $GUI_CHECKED
  1051.         $LootGold = GUICtrlRead($LootGoldCheck) = $GUI_CHECKED
  1052.         $Repair = GUICtrlRead($RepairCheckbox) = $GUI_CHECKED
  1053.         $SellBlues = (GUICtrlRead($SellBluesCheckbox) = $GUI_CHECKED) And $LootBlues
  1054.  
  1055.         GUISetState(@SW_HIDE)
  1056. EndFunc   ;==>ActivateGUI