Shakesphere

Sacred Seasons Bot v1.1

Aug 20th, 2011
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 73.01 KB | None | 0 0
  1. ; Sacred seasons bot / grind script v0.957 (02/10/2011)
  2. ; http://madscripter.wordpress.com
  3. ; v0.002 - attacks all in Tsulas and BW A3 - 08/27/2010
  4. ; v0.003 - put in your own coordinates and it should work on SS and Kong
  5. ; v0.004 - added UW E4
  6. ; v0.005 - code cleanup - added UW D2
  7. ; v0.006 - first attempt at generic dungeon grinder
  8. ; v0.007 - added UW F4
  9. ; v0.008 - generic grinder working well - lets try entire arena grind!
  10. ; v0.009 - cleaning up code - ff arena grind works
  11. ; v0.010 - SVA arena grind works
  12. ; v0.011 - changes I made for arena grind didn't work with dungeon grind
  13. ;          fixed
  14. ;          generic grinder didn't work at all
  15. ;          fixed - but only lightly tested
  16. ; v0.012 - adding BRA grind and making BRA repeat after you die
  17. ; v0.013 - making SVA repeat after you die (gotta level my alt!)
  18. ; v0.014 - added FF repeat after you die - I'm not sure why you would want
  19. ;          to do that but oh well - also some code cleanup (09/01/10)
  20. ; v0.015 - added BWA grind and repeat
  21. ; v0.016 - added more safeguards against server delay in displaying
  22. ;          battle and exit pads
  23. ; v0.017 - not sure previous fixes work but adding DFA anyway
  24. ; v0.018 - added display timer to show how long each iteration took -
  25. ;          good for figuring out how much XP/min you're getting (09/02)
  26. ; v0.019 - removing some death checks and seeing if it still works -
  27. ;          found a tricky bug that would hang program while walking across map
  28. ; v0.020 - Trying to calculate XP/Min stats for each grind choice
  29. ; v0.021 - still getting XP/Min stats
  30. ; v0.022 - added CWA, UWA,
  31. ; v0.023 - added WaitForPads to dungeon grinds
  32. ; v0.024 - adding HP checking to Tsulas
  33. ; v0.025 - adding HP checking to UW_D2 - no improvement
  34. ; v0.026 - testing attack speed improvements
  35. ; v0.027 - tracked down a bug - might be coincidence but I think SS changed
  36. ;          something to try and stop my script - fixed!
  37. ; v0.900 - automatically finds window coordinates
  38. ; v0.901 - starting work on GUI
  39. ; v0.902 - displays window coordinates - allows update
  40. ; v0.903 - fixing 902
  41. ; v0.904 - updated coordinates - testing
  42. ; v0.905 - redoing all coordinates
  43. ; v0.906 - more GUI work
  44. ; v0.907 - fixing window coordinates
  45. ; v0.908 - redoing find battle menu code
  46. ; v0.909 - adding low level character grind - not working well yet
  47. ; v0.910 - Adding UW A3, B4, A4
  48. ; v0.911 - making Arena grinds repeat when finished
  49. ; v0.912 - small update to newbie grind
  50. ; v0.913 - bugfixes to arena grind (only on DFA) - redid death check
  51. ;          redid battle icon find and exit find
  52. ; v0.914 - testing new death check on BRA
  53. ; v0.915 - minor change in waitforpads - less color sensitive
  54. ; v0.916 - minor update to stats display
  55. ; v0.917 - additional checks so it will never click below the game area
  56. ;          added -119 to $bottomRight[1]
  57. ; v0.918 - replacing deathcheck in all arenas
  58. ; v0.919 - fixing arena grinds repeat
  59. ; v0.920 - putting DFA fixes in all arenas
  60. ; v0.921 - rewrite/consolidation of arena code
  61. ; v0.922 - updating newbie grind
  62. ; v0.923 - redoing arena room exits
  63. ; v0.924 - undoing some 923 changes
  64. ; v0.925 - newbie grind update - repeating one battle in BR A2
  65. ; v0.926 - fixing generic
  66. ; v0.927 - I broke waitforpads - hopefully fixed it now
  67. ; v0.928 - Oops - I broke arena repeat - this should fix it
  68. ; v0.928 - cataloging battle coordinates
  69. ; v0.929 - adding Underworld C2
  70. ; v0.930 - arena exits only worked on ss site, fixed
  71. ; v0.931 - one line change in findattack2
  72. ; v0.932 - trying to add astral travel III buff, fixed error in UW_C2
  73. ; v0.933 - updating GUI - trying to add buffs
  74. ; v0.934 - can select limit on times spell is cast
  75. ; v0.935 - (12/03) checks to see if you clicked on a friend - lets multi-bot!
  76. ; v0.936 - (12/04) fixing errors from 935
  77. ; v0.937 - (12/06) 'turbo' mode option - gets rid of most pauses in bot
  78. ;        - may negatively affect stability
  79. ; v0.938 - (12/06) changed text in 'maximum times to cast spell'
  80. ;        - 0 for unlimited didn't work and probably isn't even useful
  81. ; v0.939 - change in timer so it starts after GUI selections
  82. ; v0.940 - modified battle order in DD_E3, UW_C2,
  83. ; v0.941 - (12/12) adding attack spell option
  84. ; v0.942 - (12/12) first attempt at auto-heal spells
  85. ; v0.943 - (12/13) making hp and spell level selectable
  86. ; v0.944 - (12/20) repeating attacks when it hangs
  87. ; v0.945 - (12/26) going after bugs - more fixes for hanging while attacking
  88. ; v0.946 - (12/26) fixes for server delay in waiting for pads to appear
  89. ; v0.947 - (01/12) fixing Grimalkin issues in BRA
  90. ; v0.948 - (01/28) additional battle pad check in arenas for server delay
  91. ; v0.949 - (01/28) fix for trying to exit battles too soon
  92. ;          usually caused by Barrier Golem explosions
  93. ; v0.950 - (01/28) added small delay in findattack2
  94. ;                  should help with stability
  95. ; v0.951 - (01/28) fixed small error in DD_A5
  96. ; v0.952 - (02/02) adding more character click checks
  97. ;      fixed click checks in dungeonpad
  98. ;          added checks for moving away from dungeon and other spots
  99. ; v0.953 - for multi-botting - checks to see if battle is already done
  100. ; v0.954 - if battle doesn't start after a few seconds - maybe bot didn't
  101. ;          click on battle pad - so it clicks it again
  102. ; v0.955 - (02/09) updates to fix coordinates on new Sacred Seasons site
  103. ; v0.956 - (02/10) finally fixing XP amounts for dungeons
  104. ;    - started work on PGA (and realized I haven't unlocked it yet)
  105. ;        - finally fixed the last section of the newbie grind
  106. ; v0.957 - (02/10) tidying up the code - hope I didn't break anything
  107. ; v1.0 - Done the co-ordinates finder successfully works
  108. ; v1.1 - New & Improved Attack Grid and functioning
  109. ;
  110. ;
  111. ; todo - PGA - add silver info, finish checking XP info
  112. ; CWA and UWA might not be working right now - (11/06/10)
  113. ;    - will examine more later
  114. ;
  115. ; Misc documentation:
  116. ; This is a work in progress - lots of ugly code, commented debugging
  117. ; code and other nonsense.
  118. ;
  119. ; For arena runs - checking to see if you died occurs in multiple places and
  120. ; can result in multiple 'you died!' messages once you actually die.  It's
  121. ; not a bug - it's a feature.  Comment them out if they annoy you.
  122. ;
  123. ; I'm thinking that running arenas is less conspicuous than running a
  124. ; dungeon over and over.  Figuring out which arena gets you the best XP/min
  125. ; is up to you.  But make sure you can finish the first room of the arena
  126. ; or else the script will bomb.  I should fix that - but it's a low
  127. ; priority right now.
  128. ;
  129. ; Script will calculate and display XP/Min that you are getting.
  130. ; These numbers assume that you are grinding solo - if not, the numbers
  131. ; are wrong.  Also, numbers will be completely wrong if you are using
  132. ; the generic dungeon grind function.
  133. ;
  134. ; There are many ways to slightly increase the speed of this script but I
  135. ; went for stability instead of speed.  It still glitches sometimes but its
  136. ; also run for over 10 hours unattended - your mileage may vary
  137. ;
  138. ; This is an AutoIT3 script
  139. ; Get AutoIT at http://www.autoitscript.com/autoit3/index.shtml
  140. ;
  141. ; As the script runs, it will pop up a window telling you how many times it
  142. ; has run that section and how long it took.  This is purely informative and
  143. ; can be commented out if you don't like it.
  144.  
  145. Global $topLeft[2]
  146. Global $bottomRight[2]
  147.  
  148. Global $paused
  149. HotKeySet("{ESC}", "Terminate")
  150. HotKeySet("{PAUSE}","_pause")
  151.  
  152. Func _pause()
  153.   $paused = NOT $paused
  154.   While $paused
  155.        Sleep(100)
  156.   Wend
  157. EndFunc
  158.  
  159. Global $coord[2]
  160. Global $coord2[2]
  161. Global $exitCoord[2]
  162. Global $ArenaCoord[2]
  163. Global $battleCoord[2]
  164. Global $genericCoord[2]
  165. Global $GenericEntrance[2]
  166. Global $newGenCoord[2]
  167. Global $waitCoord[2]
  168. Global $TotalRunCount
  169. Global $AttackColor1
  170. Global $AttackColor2
  171. Global $BlankColor1
  172. Global $BlankPixel
  173.     ; checks HP for Tsulas2 grind - about 66%
  174. Global $BlankPixel2
  175.     ; checks HP for NewbGrind - about 90%
  176. Global $BlankPixel3
  177.     ; checks HP for NewbGrind - about 99%
  178. Global $xCoord
  179. Global $yCoord
  180. Global $AttackLoop
  181. Global $AttackPixel
  182. Global $AttackPixelCount
  183. Global $BattleCheckSum
  184. Global $DungeonCheckSum
  185. Global $xPos
  186. Global $yPos
  187. Global $checkPixel
  188. Global $battleCheck
  189. Global $GenericContinue
  190. Global $ArenaContinue
  191. Global $NumberOfBattles
  192. Global $TsulasHP
  193. Global $TotalXP
  194. Global $EntireXP
  195. Global $startTime
  196. Global $entireTime
  197. Global $timeElapsed
  198. Global $CheckTimer
  199. ; CWA
  200. Global $CWACoord[2]
  201. Global $CWAContinue
  202. Global $NewCWACoord[2]
  203. ; UWA
  204. Global $UWACoord[2]
  205. Global $UWAContinue
  206. Global $NewUWACoord[2]
  207. ; Death check
  208. Global $DeathColor
  209. Global $DeathPixel
  210.  
  211. Global $ArenaXP[10][100]
  212.  
  213. ; FF, SVA, BWA, DFA, BRA, CWA, UWA, PGA, BI3
  214. Global $ArenaNumberOfBattles[10]=[0,96,96,97,94,89,22,33,87,33]
  215. ; FFXP - correct values and placement
  216. Global $FFXP[97]=[0,21,1,11,14,4,40,12,20,24,44,150,12,28,17,150,151,2,10,24,10,10,182,36,158,42,3,15,37,27,44,15,300,152,23,38,27,19,39,160,24,22,199,13,29,47,15,24,12,311,28,33,25,20,39,18,45,60,72,51,60,200,56,210,150,80,80,66,66,440,120,105,60,110,147,40,105,150,360,95,155,180,120,160,120,66,150,132,190,74,32,100,110,70,76,126,540]
  217. ; SVAXP - correct values and placement
  218. Global $SVAXP[97]=[0,72,75,90,40,117,66,76,87,111,156,66,90,60,120,190,99,213,180,50,240,130,190,244,224,50,105,150,19,100,270,330,180,80,205,150,88,149,179,386,501,320,243,510,305,350,225,510,895,380,320,330,570,450,610,190,400,900,900,910,430,1065,520,900,390,745,1500,1530,1950,1100,1700,830,1180,1300,1760,452,2400,800,3075,1950,1100,1315,930,1350,3060,1315,1250,1550,830,1350,2925,4,950,490,980,1425,160]
  219. ; BWAXP - correct values and placement
  220. Global $BWAXP[98]=[0,110,110,150,140,70,100,180,200,320,99,80,220,100,270,270,550,1750,825,938,1360,54,397,1375,150,1845,1800,180,775,300,1300,2138,900,1300,830,1200,450,921,475,2000,600,950,1350,998,65,160,465,240,650,490,80,1560,1720,1130,400,1695,500,160,80,1260,1560,500,480,2400,1300,690,2720,1490,1380,500,2235,500,1440,2980,1050,1440,720,1220,500,1490,2160,1220,2235,500,1000,3450,2930,1360,3480,1200,1560,3120,2400,1000,2340,2160,2235,3000]
  221. ; DFAXP - correct values and placement
  222. Global $DFAXP[95]=[0,300,205,102,305,535,410,525,494,220,540,700,170,230,190,180,422,430,265,500,750,735,285,740,355,855,975,765,780,745,1020,1410,1175,675,287,305,1600,520,856,375,825,1249,1540,1234,1825,1005,1145,1430,330,725,1665,1360,1300,870,610,970,1310,1290,1285,3260,2875,906,7200,270,1979,2660,1320,3342,1194,1756,2046,4076,7426,992,4450,504,5972,2912,6916,2200,5432,968,6363,1300,3300,3257,1761,5824,7524,4354,6614,12848,7624,3801,11452]
  223. ; BRAXP - correct values - placement checked to here ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
  224. Global $BRAXP[90]=[0,905,605,1150,280,3020,950,500,2390,1800,4125,730,3725,2340,465,3014,2016,2634,1920,3008,1560,2218,3240,1500,828,4410,1512,3020,450,1756,360,1844,2994,992,1560,2040,1386,500,3588,1630,1331,700,585,4278,1264,3584,7155,2528,306,2235,3534,4002,3792,5724,3400,3792,90,4416,270,3830,4293,2862,1996,6075,5924,6140,2862,4342,1245,5602,8476,2994,1242,5528,9204,7119,3764,15056,5500,4308,2307,10596,15518,11292,11340,6000,12132,5184,9030,6792]
  225. ; CWAXP - correct values - placement not checked
  226. Global $CWAXP[23]=[0,1800,1800,1800,6350,5950,5850,7000,6700,6200,6700,7500,7850,7250,8000,12500,12500,15500,13333,13333,4444,9222,3472]
  227. ; UWAXP - correct values - placement not checked
  228. Global $UWAXP[34]=[0,2373,2373,2373,2373,2373,2373,2373,2373,2373,2373,7573,10400,13000,13000,15600,7573,10606,9574,10606,11514,6807,11200,11200,12432,8433,14000,16800,19000,25000,26400,14000,9464,36032]
  229. ; PGAXP - correct values - placement not checked
  230. Global $PGAXP[88]=[0,4800,3800,7884,8164,5210,7064,6400,2000,7000,10898,11146,7350,2600,5950,8850,9100,10100,8900,6900,11264,8100,6400,7500,8500,6273,5824,5996,6160,9900,11250,13400,13400,13600,8800,6650,8973,7673,13400,13110,16044,15664,8776,13368,13408,12465,14514,9941,10785,15947,12114,12233,14467,7885,20406,17318,14383,12088,15320,18066,15905,13379,13138,15980,14033,13300,16550,18227,15021,15236,11643,14526,13879,14537,19600,17707,18637,17386,25338,30117,12956,17530,15747,30888,32238,45038,56138,62138]
  231.  
  232. Global $guiExit
  233.  
  234. Global $ArenaExit[15]=[0, 225, 90, 130, 401, 417, 186, 586, 126, 705, 185, 705, 450, 633, 102]
  235. Global $ArenaRoomCount
  236. Global $BuffCoords[43]=[0, 86, 219, 86, 240, 86, 263, 86, 287, 86, 308, 86, 331, 233, 219, 233, 240, 233, 263, 233, 287, 233, 308, 233, 331, 379, 219, 379, 240, 379, 263, 379, 287, 379, 308, 379, 331, 526, 219, 526, 240, 526, 263]
  237.  
  238. Global $grind_choice
  239.  
  240. Global $battleTextFind[2]
  241. Global $BattleFound
  242. $AttackColor1 = Dec("FFFFFF")
  243. $AttackColor2 = Dec("FFFEFF")
  244. $BlankColor1 = Dec("333333")
  245. $BattleTextColor = 0xFFFFFF
  246. $PadColor1 = 0xFC4744
  247. $PadColor2 = 0xFD4743
  248. $ExitColor1 = 0xF8F6EA
  249. $DeathColor = Dec("86A89C")
  250. $UWEXitColor1 = 0x6DFCF6
  251.  
  252. Opt("WinTitleMatchMode", 2)
  253.  
  254. ;IE7/8
  255. WinActivate("[CLASS:IEFrame]", "")
  256. ;Firefox3
  257. WinActivate("CLASS:MozillaUIWindowClass]", "")
  258. ;Firefox4
  259. WinActivate("[CLASS:MozillaWindowClass]", "")
  260. ;Opera
  261. WinActivate("[CLASS:aPluginWinClass]", "")
  262. ;Opera
  263. WinActivate("[CLASS:OperaWindowClass]", "")
  264. ;Chrome
  265. WinActivate("[CLASS:Chrome_WidgetWin_0]", "")
  266.  
  267. WinGetPos(" [CLASS:NativeWindowClass] ", "")
  268.  
  269. ; generic coordinate finder
  270. $GCF1 = PixelSearch(1, 1, 2000, 2000, 0x333333, 10)
  271. $topLeft[0] = 10
  272. $topLeft[1] = 87
  273. $bottomRight[0] = $topLeft[0] + 739
  274. $bottomRight[1] = $topLeft[1] + 599
  275.  
  276. ;populate XP values
  277. For $xloop = 1 to 96
  278.     $ArenaXP[1][$xloop]=$FFXP[$xloop]
  279. Next
  280.  
  281. For $xloop = 1 to 96
  282.     $ArenaXP[2][$xloop]=$SVAXP[$xloop]
  283. Next
  284.  
  285. For $xloop = 1 to 97
  286.     $ArenaXP[3][$xloop]=$BWAXP[$xloop]
  287. Next
  288.  
  289. For $xloop = 1 to 94
  290.     $ArenaXP[4][$xloop]=$DFAXP[$xloop]
  291. Next
  292.  
  293. For $xloop = 1 to 89
  294.     $ArenaXP[5][$xloop]=$BRAXP[$xloop]
  295. Next
  296.  
  297. For $xloop = 1 to 22
  298.     $ArenaXP[6][$xloop]=$CWAXP[$xloop]
  299. Next
  300.  
  301. For $xloop = 1 to 33
  302.     $ArenaXP[7][$xloop]=$UWAXP[$xloop]
  303. Next
  304.  
  305. For $xloop = 1 to 87
  306.     $ArenaXP[8][$xloop]=$PGAXP[$xloop]
  307. Next
  308.  
  309.  
  310. $TotalRunCount=0
  311.  
  312. $screenWidth = $bottomRight[0] - $topLeft[0]
  313. $screenHeight = $bottomRight[1] - $topLeft[1]
  314.  
  315. $repeatagain = 1
  316.  
  317. ; GUI starts here
  318. #include <GUIConstantsEx.au3>
  319. #include <EditConstants.au3>
  320.  
  321. GUICreate("Sacred Seasons bot", 800, 600)
  322.  
  323. GUICtrlCreateLabel("Top Left", 10, 10)
  324. $InputSize1 = GUICtrlCreateInput($topLeft[0], 10, 25, 100, 20)
  325. GUICtrlCreateLabel("Top Left", 140, 10)
  326. $InputSize2 = GUICtrlCreateInput($topLeft[1], 140, 25, 100, 20)
  327. GUICtrlCreateLabel("Bottom Right", 10, 50)
  328. $InputSize3 = GUICtrlCreateInput($bottomRight[0], 10, 65, 100, 20)
  329. GUICtrlCreateLabel("Bottom Right", 140, 50)
  330. $InputSize4 = GUICtrlCreateInput($bottomRight[1], 140, 65, 100, 20)
  331. GUICtrlCreateLabel("Window width", 10, 90)
  332. $InputSize5 = GUICtrlCreateInput($screenWidth, 10, 105, 100, 20, $ES_READONLY)
  333. GUICtrlCreateLabel("Window height", 140, 90)
  334. $InputSize6 = GUICtrlCreateInput($screenHeight, 140, 105, 100, 20, $ES_READONLY)
  335.  
  336. GUICtrlCreateLabel("The above coordinates are what the script found automatically.  If the values are zero or blank, you need to enter the values yourself using AutoIT Window Info." &    @CRLF & "The width should be 740 and the height should be 600.  (Automatically finding the coordinates should work in all browsers - IE7, IE8, Firefox 3, and Firefox 4, Opera, and Chrome.  If it doesn't work - please let me know.)", 10, 145, 260, 120)
  337.  
  338. GUICtrlCreateLabel("Make sure that Sacred Seasons is underneath this window, the coordinates are correct, select a section to grind and press continue.", 200, 510, 400, 40)
  339.  
  340. $ContinueButton1 = GUICtrlCreateButton("Continue", 300, 550, 100)
  341.  
  342. GUICtrlCreateGroup("Select a option to grind:", 310, 10, 480, 250)
  343.  
  344. $choice_1 = GUICtrlCreateRadio("Newbie Grind", 330, 25, 210, 20)
  345. $choice_2 = GUICtrlCreateRadio("Bleakwoods D4 (Tsulas)", 330, 45, 210, 20)
  346. $choice_3 = GUICtrlCreateRadio("Bleakwoods A3 (Flo)", 330, 65, 210, 20)
  347. $choice_4 = GUICtrlCreateRadio("Dunes F1 (Snakes)", 330, 105, 210, 20)
  348. $choice_5 = GUICtrlCreateRadio("Underworld D2 (Worm/Octogum/Frogs)", 330, 125, 210, 20)
  349. $choice_6 = GUICtrlCreateRadio("Underworld F4 (Charlotte / Choppers)", 330, 145, 210, 20)
  350. $choice_7 = GUICtrlCreateRadio("Underworld A3 (Green Dragons / Bubblers)", 330, 165, 240, 20)
  351. $choice_8 = GUICtrlCreateRadio("Dunes E3 (Mumma)", 330, 185, 210, 20)
  352. $choice_9 = GUICtrlCreateRadio("Underworld C2", 330, 205, 210, 20)
  353. $choice_10 = GUICtrlCreateRadio("Generic", 330, 225, 210, 20)
  354. $choice_11 = GUICtrlCreateRadio("Arena - FF", 600, 25, 180, 20)
  355. $choice_12 = GUICtrlCreateRadio("Arena - SVA", 600, 45, 180, 20)
  356. $choice_13 = GUICtrlCreateRadio("Arena - BWA", 600, 65, 180, 20)
  357. $choice_14 = GUICtrlCreateRadio("Arena - DFA", 600, 85, 180, 20)
  358. $choice_15 = GUICtrlCreateRadio("Arena - BRA", 600, 105, 180, 20)
  359. $choice_16 = GUICtrlCreateRadio("Arena - CWA", 600, 125, 180, 20)
  360. $choice_17 = GUICtrlCreateRadio("Arena - UWA", 600, 145, 180, 20)
  361. $choice_18 = GUICtrlCreateRadio("Dunes D3 (Scrabs)", 330, 85, 240, 20)
  362.  
  363. $choice_text = GUICtrlCreateLabel("", 310, 270, 450, 60)
  364.  
  365. $grind_choice = 0
  366.  
  367. $BuffBox = GUICtrlCreateCheckbox("Check to use buff at start of battle", 10, 325, 200, 20)
  368.  
  369. GUICtrlCreateLabel("Buff Spell to use first in battle (1 - 21) ", 55, 355)
  370. $BuffSpell1 = GUICtrlCreateInput("", 10, 350, 40, 20)
  371. GUICtrlCreateLabel("Maximum times to cast spell", 55, 380)
  372. $BuffCast1 = GUICtrlCreateInput("0", 10, 375, 40, 20)
  373.  
  374. $AttackBox = GUICtrlCreateCheckbox("Check to use attack at start of battle", 260, 325, 200, 20)
  375.  
  376. GUICtrlCreateLabel("Attack Spell to use first in battle (1 - 21) ", 305, 355)
  377. $AttackSpell1 = GUICtrlCreateInput("", 260, 350, 40, 20)
  378. GUICtrlCreateLabel("Maximum times to cast spell", 305, 380)
  379. $AttackCast1 = GUICtrlCreateInput("0", 260, 375, 40, 20)
  380.  
  381. $HealBox = GUICtrlCreateCheckbox("Check to use healing spell when HP is low", 510, 325, 250, 20)
  382.  
  383. GUICtrlCreateLabel("Healing spell to use in battle (1 - 21) ", 555, 355)
  384. $HealSpell1 = GUICtrlCreateInput("", 510, 350, 40, 20)
  385. GUICtrlCreateLabel("Cast spell when HP falls below %", 555, 380)
  386. $HealHPCast1 = GUICtrlCreateInput("33", 510, 375, 40, 20)
  387. GUICtrlCreateLabel("Only cast when SP is above %", 555, 405)
  388. $HealSPCast1 = GUICtrlCreateInput("33", 510, 400, 40, 20)
  389.  
  390. $TurboBox = GUICtrlCreateCheckBox("Check to use 'turbo' mode - can speed up script but may affect stability", 10, 450, 400, 20)
  391.  
  392. GUICtrlCreateGroup("", -99, -99, 1, 1)
  393.  
  394. GUISetState(@SW_SHOW)
  395.  
  396. While $guiExit <> 1
  397.     $msg = GUIGetMsg()
  398.     If $msg = $GUI_EVENT_CLOSE Then
  399.         Exit
  400.     EndIF
  401.     If $msg = $InputSize1 Then
  402.         $topLeft[0] = GUICtrlRead($InputSize1)
  403.         $screenWidth = $bottomRight[0] - $topLeft[0]
  404.         $screenHeight = $bottomRight[1] - $topLeft[1]
  405.         GUICtrlSetData($InputSize5, $screenWidth)
  406.     EndIf
  407.     If $msg = $InputSize2 Then
  408.         $topLeft[1] = GUICtrlRead($InputSize2)
  409.         $screenWidth = $bottomRight[0] - $topLeft[0]
  410.         $screenHeight = $bottomRight[1] - $topLeft[1]
  411.         GUICtrlSetData($InputSize6, $screenHeight)
  412.     EndIf
  413.     If $msg = $InputSize3 Then
  414.         $bottomRight[0] = GUICtrlRead($InputSize3)
  415.         $screenWidth = $bottomRight[0] - $topLeft[0]
  416.         $screenHeight = $bottomRight[1] - $topLeft[1]
  417.         GUICtrlSetData($InputSize5, $screenWidth)
  418.     EndIf
  419.     If $msg = $InputSize4 Then
  420.         $bottomRight[1] = GUICtrlRead($InputSize4)
  421.         $screenWidth = $bottomRight[0] - $topLeft[0]
  422.         $screenHeight = $bottomRight[1] - $topLeft[1]
  423.         GUICtrlSetData($InputSize6, $screenHeight)
  424.     EndIf
  425.     If $msg = $choice_1 Then
  426.         GUICtrlSetData($choice_text, "Takes a low level character through increasingly harder dungeons.  Good for level 1 alts.  Start with your character in Shikaakwa by Jona.  Only lightly tested - please give me suggestions on how to improve this.")
  427.         $grind_choice=1
  428.     EndIf
  429.     If $msg = $choice_2 Then
  430.         GUICtrlSetData($choice_text, "Move your character to Bleakwoods D4 (Tsulas) away from the entrance.  Your character must be able to complete both battles once without dying or the script will fail.")
  431.         $grind_choice=2
  432.     EndIf
  433.     If $msg = $choice_3 Then
  434.         GUICtrlSetData($choice_text, "Move your character to Bleakwoods A3 (Flo) away from the entrance.  Your character must be able to complete the battles without dying or the script will fail.")
  435.         $grind_choice=3
  436.     EndIf
  437.     If $msg = $choice_4 Then
  438.         GUICtrlSetData($choice_text, "Move your character to Dunes F1 (Hector / Choppers) away from the entrance.  Your character must be able to complete the battles without dying or the script will fail.")
  439.         $grind_choice=4
  440.     EndIf
  441.     If $msg = $choice_5 Then
  442.         GUICtrlSetData($choice_text, "Move your character to Underworld D2 (Worms / Octogums / Frogs) away from the entrance.  Your character must be able to complete the battles without dying or the script will fail.")
  443.         $grind_choice=5
  444.     EndIf
  445.     If $msg = $choice_6 Then
  446.         GUICtrlSetData($choice_text, "Move your character to Underworld F4 (Charlotte / Choppers) away from the entrance.  Your character must be able to complete the battles without dying or the script will fail.")
  447.         $grind_choice=6
  448.     EndIf
  449.     If $msg = $choice_7 Then
  450.         GUICtrlSetData($choice_text, "Move your character to Underworld A3 (Octogums / Green Dragons / Bubblers) away from the entrance.  Your character must be able to complete the battles without dying or the script will fail.")
  451.         $grind_choice=7
  452.     EndIf
  453.     If $msg = $choice_8 Then
  454.         GUICtrlSetData($choice_text, "Move your character to Underworld B4 (William / Skeletons / Pirates) away from the entrance.  Your character must be able to complete the battles without dying or the script will fail.")
  455.         $grind_choice=8
  456.     EndIf
  457.     If $msg = $choice_9 Then
  458.         GUICtrlSetData($choice_text, "Move your character to Underworld A4 (Elementals) away from the entrance.  Your character must be able to complete the battles without dying or the script will fail.")
  459.         $grind_choice=9
  460.     EndIf
  461.     If $msg = $choice_10 Then
  462.         GUICtrlSetData($choice_text, "Generic grinder.  Move your character near any dungeon entrance.  This routine is only lightly tested and may not work on all dungeons.  Your character must be able to complete the battles without dying or the script will fail.")
  463.         $grind_choice=10
  464.     EndIf
  465.     If $msg = $choice_11 Then
  466.         GUICtrlSetData($choice_text, "Arena - FF.  Move your character to the first room in the arena with battles (not the lobby).  Your character must be able to complete the battles in the first room without dying or the script will fail.  If your character dies after that, it will return to the arena and start it again.")
  467.         $grind_choice=11
  468.     EndIf
  469.     If $msg = $choice_12 Then
  470.         GUICtrlSetData($choice_text, "Arena - SVA.  Move your character to the first room in the arena with battles (not the lobby).  Your character must be able to complete the battles in the first room without dying or the script will fail.  If your character dies after that, it will return to the arena and start it again.")
  471.         $grind_choice=12
  472.     EndIf
  473.     If $msg = $choice_13 Then
  474.         GUICtrlSetData($choice_text, "Arena - BWA.  Move your character to the first room in the arena with battles (not the lobby).  Your character must be able to complete the battles in the first room without dying or the script will fail.  If your character dies after that, it will return to the arena and start it again.")
  475.         $grind_choice=13
  476.     EndIf
  477.     If $msg = $choice_14 Then
  478.         GUICtrlSetData($choice_text, "Arena - DFA.  Move your character to the first room in the arena with battles (not the lobby).  Your character must be able to complete the battles in the first room without dying or the script will fail.  If your character dies after that, it will return to the arena and start it again.")
  479.         $grind_choice=14
  480.     EndIf
  481.     If $msg = $choice_15 Then
  482.         GUICtrlSetData($choice_text, "Arena - BRA.  Move your character to the first room in the arena with battles (not the lobby).  Your character must be able to complete the battles in the first room without dying or the script will fail.  If your character dies after that, it will return to the arena and start it again.  (The script will probably hang if you reach the 7th floor rooms with no battles.)")
  483.         $grind_choice=15
  484.     EndIf
  485.     If $msg = $choice_16 Then
  486.         GUICtrlSetData($choice_text, "Arena - CWA.  Move your character to the first room in the arena with battles (not the lobby).  Your character DOES NOT need to be able to complete the battles in the first room without dying.  If your character dies, it will return to the arena and start it again.")
  487.         $grind_choice=16
  488.     EndIf
  489.     If $msg = $choice_17 Then
  490.         GUICtrlSetData($choice_text, "Arena - UWA.  Move your character to the first room in the arena with battles (not the lobby).  Your character DOES NOT need to be able to complete the battles in the first room without dying.  If your character dies, it will return to the arena and start it again.")
  491.         $grind_choice=17
  492.     EndIf
  493.     If $msg = $choice_18 Then
  494.         GUICtrlSetData($choice_text, "Move your character to Underworld C2 (Octogums / Water Worms) away from the entrance.  Your character must be able to complete the battles without dying or the script will fail.")
  495.         $grind_choice=18
  496.     EndIf
  497. ;   If $msg = $choice_19 Then
  498. ;       GUICtrlSetData($choice_text, "Arena - PGA.  Move your character to the first room in the arena with battles (not the lobby).  Your character must be able to complete the battles in the first room without dying or the script will fail.  If your character dies after that, it will return to the arena and start it again.")
  499. ;       $grind_choice=19
  500. ;   EndIf
  501.     If ($msg = $ContinueButton1) AND ($grind_choice <> 0) Then
  502.         ; check if buff is checked
  503.         $BuffCheck = BitAnd(GUICtrlRead($BuffBox),$GUI_CHECKED)
  504.         If $BuffCheck = 1 Then
  505.             ; check to make sure spell # is between 1 - 21
  506.             $BuffSpellNumber = GUICtrlRead($BuffSpell1)
  507.             If ($BuffSpellNumber > 0) AND ($BuffSpellNumber < 22) Then
  508.                 $guiExit = 1
  509.             Else
  510.                 ; need to display some sort of error - NOT DONE YET
  511.                 $BuffDisplayError = 1
  512.             EndIf
  513.         Else
  514.             $guiExit = 1
  515.         EndIf
  516.         ; check if attack is checked
  517.         $AttackCheck = BitAnd(GUICtrlRead($AttackBox),$GUI_CHECKED)
  518.         If $AttackCheck = 1 Then
  519.             ; check to make sure spell # is between 1 - 21
  520.             $AttackSpellNumber = GUICtrlRead($AttackSpell1)
  521.             If ($AttackSpellNumber > 0) AND ($AttackSpellNumber < 22) Then
  522.                 $guiExit = 1
  523.             Else
  524.                 ; need to display some sort of error - NOT DONE YET
  525.                 $BuffDisplayError = 1
  526.             EndIf
  527.         Else
  528.             $guiExit = 1
  529.         EndIf
  530.         ; check if heal is checked
  531.         $HealCheck = BitAnd(GUICtrlRead($HealBox),$GUI_CHECKED)
  532.         If $HealCheck = 1 Then
  533.             ; check to make sure spell # is between 1 - 21
  534.             $HealSpellNumber = GUICtrlRead($HealSpell1)
  535.             If ($HealSpellNumber > 0) AND ($HealSpellNumber < 22) Then
  536.                 $guiExit = 1
  537.             Else
  538.                 ; need to display some sort of error - NOT DONE YET
  539.                 $BuffDisplayError = 1
  540.             EndIf
  541.             ; check that HP level is between 1 - 100
  542.             $HealHPCast = GUICtrlRead($HealHPCast1)
  543.             If ($HealHPCast > 0) AND ($HealHPCast < 100) Then
  544.                 $guiExit = 1
  545.             Else
  546.                 ; need to display some sort of error - NOT DONE YET
  547.                 $BuffDisplayError = 1
  548.             EndIf
  549.             ; check that SP level is between 1 - 100
  550.             $HealSPCast = GUICtrlRead($HealSPCast1)
  551.             If ($HealSPCast > 0) AND ($HealSPCast < 100) Then
  552.                 $guiExit = 1
  553.             Else
  554.                 ; need to display some sort of error - NOT DONE YET
  555.                 $BuffDisplayError = 1
  556.             EndIf
  557.         Else
  558.             $guiExit = 1
  559.         EndIf
  560.     EndIf
  561.     Sleep(50)
  562. WEnd
  563.  
  564. GUISetState(@SW_HIDE)
  565.  
  566. ; 0 if not checked, 1 if checked
  567. $BuffCheck = BitAnd(GUICtrlRead($BuffBox),$GUI_CHECKED)
  568. $AttackCheck = BitAnd(GUICtrlRead($AttackBox),$GUI_CHECKED)
  569. $HealCheck = BitAnd(GUICtrlRead($HealBox),$GUI_CHECKED)
  570. $TurboCheck = BitAnd(GUICtrlRead($TurboBox),$GUI_CHECKED)
  571.  
  572. $BuffMaxCast = GUICtrlRead($BuffCast1)
  573. $AttackMaxCast = GUICtrlRead($AttackCast1)
  574. $HealHPCast = GUICtrlRead($HealHPCast1)
  575. $HealSPCast = GUICtrlRead($HealSPCast1)
  576. $HealHPCoord = int ((($topLeft[0] + (139 * ($HealHPCast * .01))) + 88))
  577. $HealSPCoord = int ((($topLeft[0] + (139 * ($HealSPCast * .01))) + 245))
  578.  
  579.  
  580. WinActivate ("[CLASS:IEFrame]", "")
  581. WinActivate ("[CLASS:MozillaUIWindowClass]", "")
  582. WinActivate ("[CLASS:MozillaWindowClass]", "")
  583.  
  584. $entireTime = TimerInit()
  585.  
  586. While $repeatagain < 6000
  587. $startTime = TimerInit()
  588. $TotalXP=0
  589.  
  590. ; for casting spells only a certain number of times
  591. $BuffRemain = $BuffMaxCast
  592. $AttackRemain = $AttackMaxCast
  593.  
  594. If $grind_choice=1 Then
  595.     NewbGrind()
  596. EndIf
  597. If $grind_choice=2 Then
  598.     GrindTsulas2()
  599. EndIf
  600. If $grind_choice=3 Then
  601.     GrindBW_A3()
  602. EndIf
  603. If $grind_choice=4 Then
  604.     GrindDD_F1()
  605. EndIf
  606. If $grind_choice=5 Then
  607.     GrindUW_D2()
  608. EndIf
  609. If $grind_choice=6 Then
  610.     GrindUW_F4()
  611. EndIf
  612. If $grind_choice=7 Then
  613.     GrindDD_E3()
  614. EndIf
  615. If $grind_choice=8 Then
  616.     GrindUW_B4()
  617. EndIf
  618. If $grind_choice=9 Then
  619.     GrindDD_A5()
  620. EndIf
  621. If $grind_choice=10 Then
  622.     Generic()
  623. EndIf
  624. If $grind_choice=11 Then
  625.     $ArenaNumber = 1
  626.     ArenaGrind2()
  627. EndIf
  628. If $grind_choice=12 Then
  629.     $ArenaNumber = 2
  630.     ArenaGrind2()
  631. EndIf
  632. If $grind_choice=13 Then
  633.     $ArenaNumber = 3
  634.     ArenaGrind2()
  635. EndIf
  636. If $grind_choice=14 Then
  637.     $ArenaNumber = 4
  638.     ArenaGrind2()
  639. EndIf
  640. If $grind_choice=15 Then
  641.     $ArenaNumber = 5
  642.     ArenaGrind2()
  643. EndIf
  644. If $grind_choice=16 Then
  645.     $ArenaNumber = 6
  646.     ArenaCWA()
  647. EndIf
  648. If $grind_choice=17 Then
  649.     $ArenaNumber = 7
  650.     ArenaUWA()
  651. EndIf
  652. If $grind_choice=18 Then
  653.     GrindDD_D3()
  654. EndIf
  655. If $grind_choice=19 Then
  656.     $ArenaNumber = 8
  657.     ArenaGrind2()
  658. EndIf
  659.  
  660.  
  661. $EntireXP = $EntireXP + $TotalXP
  662. $timeElapsed = TimerDiff($startTime)
  663. $entireTimeElapsed = TimerDiff($entireTime)
  664. $TotalRunCount = $TotalRunCount + 1
  665. ;ConsoleWrite("Total Runs=" & $TotalRunCount & @CRLF & "Run Time=" & int($timeElapsed/1000) & " seconds" & @CRLF & "Run XP/Min=" & int($TotalXP / ($timeElapsed / 60000)) & @CRLF & "Total Run Time=" & int($entireTimeElapsed / 1000) & @CRLF & "Total XP/Min=" & int($EntireXP / ($entireTimeElapsed / 60000)) & @CRLF)
  666. ;ConsoleWrite("TotalXP=" & $TotalXP & @CRLF)
  667. ;ConsoleWrite("EntireXP=" & $EntireXP & @CRLF & @CRLF)
  668. If $TurboCheck = 0 Then
  669.     MsgBox(160, "Total Runs " & $TotalRunCount, "Total Runs=" & $TotalRunCount & @CRLF & "Run Time=" & int($timeElapsed/1000) & " seconds" & @CRLF & "Run XP/Min=" & int($TotalXP / ($timeElapsed / 60000)) & @CRLF & @CRLF & "Total Run Time=" & int($entireTimeElapsed/1000) & @CRLF & "Total XP/Min=" & int($EntireXP / ($entireTimeElapsed / 60000)) & @CRLF & @CRLF & "TotalXP=" & $TotalXP & @CRLF & "EntireXP=" & $EntireXP & @CRLF, 5)
  670. Else
  671.     MsgBox(160, "Total Runs " & $TotalRunCount, "Total Runs=" & $TotalRunCount & @CRLF & "Run Time=" & int($timeElapsed/1000) & " seconds" & @CRLF & "Run XP/Min=" & int($TotalXP / ($timeElapsed / 60000)) & @CRLF & @CRLF & "Total Run Time=" & int($entireTimeElapsed/1000) & @CRLF & "Total XP/Min=" & int($EntireXP / ($entireTimeElapsed / 60000)) & @CRLF & @CRLF & "TotalXP=" & $TotalXP & @CRLF & "EntireXP=" & $EntireXP & @CRLF, 2)
  672. EndIf
  673.  
  674.  
  675. $repeatagain = $repeatagain + 1
  676. WEnd
  677.  
  678.  
  679.  
  680. Func AttackGrid()
  681.     ; top left
  682.     Attack(449, 190)
  683.    
  684.     ; middle left
  685.     Attack (500, 290)
  686.    
  687.    
  688.     ; bottom left
  689.     Attack (548, 390)
  690.    
  691.  
  692.     ; bottom right
  693.     Attack (703, 385)
  694.  
  695.     ; middle right
  696.     Attack (667, 300)
  697.    
  698.    
  699.     ; top right
  700.     Attack (616, 205)
  701.    
  702.     ;additional
  703.     Attack (667, 330)  
  704.    
  705.     ;additioanl
  706.     Attack (616, 225)
  707.  
  708.    
  709. EndFunc
  710.  
  711. Func Attack($x, $y)
  712.     MouseMove(($topLeft[0]+$x), $topLeft[1]+$y, 0)
  713.     MouseClick("left")
  714. EndFunc
  715.  
  716.  
  717. Func findAttack2()
  718.     $coord2 = PixelSearch($topLeft[0]+333, $topLeft[1]+200, $topLeft[0]+338, $topLeft[1]+343, $AttackColor1, 10)
  719.     If @error=1 Then
  720.         $coord[0]=1
  721.         $coord[1]=1
  722.         If $TurboCheck = 0 Then
  723.             Sleep(200)
  724.         Else
  725.             Sleep(20)
  726.         EndIf
  727.         Return ($coord)
  728.     EndIf
  729.     ; search again in case it found pixels in mid-search
  730.     Sleep(300)
  731.     $coord2 = PixelSearch($topLeft[0]+333, $topLeft[1]+200, $topLeft[0]+338, $topLeft[1]+343, $AttackColor1, 10)
  732.     If @error=1 Then
  733.         $coord[0]=1
  734.         $coord[1]=1
  735.         If $TurboCheck = 0 Then
  736.             Sleep(200)
  737.         Else
  738.             Sleep(20)
  739.         EndIf
  740.         Return ($coord)
  741.     EndIf
  742.     $coord[0] = $topLeft[0] + 345
  743.     $coord[1] = $coord2[1] + 30
  744.     Return($coord)
  745. EndFunc
  746.  
  747. Func Terminate()
  748.     Exit
  749. EndFunc
  750.  
  751. Func Battle($x, $y)
  752.     ; first - make sure pad is there
  753.     $padwait = 0
  754.     While $padwait = 0
  755.         $waitCoord = PixelSearch($x - 10,$y - 10,$x + 10,$y + 10,$PadColor1, 5)
  756.         If @error <> 1 Then
  757.             $padwait=1
  758.         EndIf
  759.         Sleep(100)
  760.     WEnd
  761.     ; get section to check for screen change
  762.     $BattleCheckSum = PixelChecksum(($topLeft[0]+658),($topLeft[1]+478),($topLeft[0]+725),($topLeft[1]+493))
  763.     ; now enter battle
  764.     MouseMove($x, $y, 3)
  765.     ; this helps with lag stability - 11/06
  766.     If $TurboCheck = 0 Then
  767.         Sleep(1000)
  768.     Else
  769.         Sleep(50)
  770.     EndIf
  771.     MouseClick("left")
  772.     If $TurboCheck = 0 Then
  773.         Sleep(100)
  774.     Else
  775.         Sleep(10)
  776.     EndIf
  777.     ; click on character check
  778.     While CharClickCheck() = 1
  779.         MouseMove($x, $y ,3)
  780.         If $TurboCheck = 0 Then
  781.             Sleep(100)
  782.         EndIf
  783.         MouseClick("left")
  784.         If $TurboCheck = 0 Then
  785.             Sleep(100)
  786.         EndIf
  787.     WEnd
  788.  
  789.     ; if battle hasn't started after 3 seconds, maybe battle pad
  790.     ; wasn't clicked - click it again
  791.     $EnterBattleCheck = 0
  792.     While $BattleCheckSum = PixelChecksum(($topLeft[0]+658),($topLeft[1]+478),($topLeft[0]+725),($topLeft[1]+493))
  793.         Sleep(100)
  794.         $EnterBattleCheck = $EnterBattleCheck + 1
  795.         If $EnterBattleCheck > 40 Then
  796.             ; search for pad in vicinity of where you previously clicked
  797.             $BattleCheckCoord = PixelSearch($x-50,$y-40,$x+5,$y+5,$PadColor2, 5)
  798.             ;Battle($ArenaCoord[0]+3, $ArenaCoord[1]+13)
  799.             MouseMove($BattleCheckCoord[0]+3, $BattleCheckCoord[1]+13, 3)
  800.             Sleep(100)
  801.             MouseClick("left")
  802.             Sleep(500)
  803.         EndIf
  804.     WEnd
  805.     ; this section checks to see if you immediately exit a battle
  806.     ; for multiplayer - the battle is already over
  807.     ; sleep is necessary so we skip screen change to blank
  808.     Sleep(1000)
  809.     If $BattleCheckSum = PixelChecksum(($topLeft[0]+658),($topLeft[1]+478),($topLeft[0]+725),($topLeft[1]+493)) Then
  810.         $NumberOfBattles=$NumberOfBattles+1
  811.         Return
  812.     EndIf
  813.     ; kill all creatures
  814.     ;$BattleCheckSum = PixelCheckSum(186,400,205,414)
  815.     $BattleCheckSum = PixelCheckSum(($topLeft[0]+75),($topLeft[1]+253),($topLeft[0]+94),($topLeft[1]+267))
  816.  
  817.     ; buff spells
  818.     $BuffRemain = $BuffRemain - 1
  819.     If ($BuffCheck = 1) AND ($BuffRemain >= 0) Then
  820.  
  821.         ; do findattack2 until battlecoord > 1
  822.         $battleCoord[0] = 1
  823.         While $battleCoord[0] = 1
  824.             $battleCoord = findAttack2()
  825.         WEnd
  826.         $battleCoord[1] = $battleCoord[1] + 22
  827.         ; click on skill
  828.         MouseMove($battleCoord[0], $battleCoord[1], 1)
  829.         If $TurboCheck = 0 Then
  830.             Sleep(200)
  831.         Else
  832.             Sleep(20)
  833.         EndIf
  834.         MouseClick("left")
  835.         ; click on astral travel 3 / skill of choice
  836.         If $TurboCheck = 0 Then
  837.             Sleep(500)
  838.         Else
  839.             Sleep(50)
  840.         EndIf
  841.         MouseMove($topLeft[0]+$BuffCoords[(($BuffSpellNumber*2)-1)],$topLeft[1]+$BuffCoords[(($BuffSpellNumber*2))], 1)
  842.         If $TurboCheck = 0 Then
  843.             Sleep(200)
  844.         Else
  845.             Sleep(20)
  846.         EndIf
  847.         MouseClick("left")
  848.         ; click on character
  849.         If $TurboCheck = 0 Then
  850.             Sleep(200)
  851.         Else
  852.             Sleep(20)
  853.         EndIf
  854.         MouseMove($topLeft[0]+213, $topLeft[1]+200, 1)
  855.         If $TurboCheck = 0 Then
  856.             Sleep(200)
  857.         Else
  858.             Sleep(20)
  859.         EndIf
  860.         MouseClick("left")
  861.         ; click on cancel (if not enough sp)
  862.         MouseMove($topLeft[0]+368, $topLeft[1]+415, 1)
  863.         If $TurboCheck = 0 Then
  864.             Sleep(200)
  865.         Else
  866.             Sleep(20)
  867.         EndIf
  868.         MouseClick("left")
  869.         If $TurboCheck = 0 Then
  870.             Sleep(200)
  871.         Else
  872.             Sleep(20)
  873.         EndIf
  874.  
  875.         ; end buff
  876.     EndIf
  877.  
  878.     ; attack spells
  879.     $AttackRemain = $AttackRemain - 1
  880.     If ($AttackCheck = 1) AND ($AttackRemain >= 0) Then
  881.  
  882.         ; do findattack2 until battlecoord > 1
  883.         $battleCoord[0] = 1
  884.         While $battleCoord[0] = 1
  885.             $battleCoord = findAttack2()
  886.         WEnd
  887.         $battleCoord[1] = $battleCoord[1] + 22
  888.         ; click on skill
  889.         MouseMove($battleCoord[0], $battleCoord[1], 1)
  890.         If $TurboCheck = 0 Then
  891.             Sleep(200)
  892.         Else
  893.             Sleep(20)
  894.         EndIf
  895.         MouseClick("left")
  896.         ; click on attack skill of choice
  897.         If $TurboCheck = 0 Then
  898.             Sleep(500)
  899.         Else
  900.             Sleep(50)
  901.         EndIf
  902.         MouseMove($topLeft[0]+$BuffCoords[(($AttackSpellNumber*2)-1)],$topLeft[1]+$BuffCoords[(($AttackSpellNumber*2))], 1)
  903.         If $TurboCheck = 0 Then
  904.             Sleep(200)
  905.         Else
  906.             Sleep(20)
  907.         EndIf
  908.         MouseClick("left")
  909.         ; click on enemies
  910.         If $TurboCheck = 0 Then
  911.             Sleep(200)
  912.         Else
  913.             Sleep(20)
  914.         EndIf
  915.         AttackGrid()
  916.         ; click on cancel (if not enough sp)
  917.         MouseMove($topLeft[0]+368, $topLeft[1]+415, 1)
  918.         If $TurboCheck = 0 Then
  919.             Sleep(200)
  920.         Else
  921.             Sleep(20)
  922.         EndIf
  923.         MouseClick("left")
  924.         If $TurboCheck = 0 Then
  925.             Sleep(200)
  926.         Else
  927.             Sleep(20)
  928.         EndIf
  929.  
  930.         ; end buff
  931.     EndIf
  932.    
  933.     ; activate chat
  934.     MouseMove(($topLeft[0]+415), ($topLeft[1]+588), 2)
  935.     MouseClick("Left")
  936.    
  937.  
  938.     $AttackPanic1Time = TimerInit()
  939.     ; $BattleIsDone - set to 1 if BattleCheckSum confirms battle is over
  940.     $BattleIsDone = 0
  941.     ;While $BattleCheckSum = PixelCheckSum(($topLeft[0]+75),($topLeft[1]+253),($topLeft[0]+94),($topLeft[1]+267))
  942.     While $BattleIsDone = 0
  943.         ; first check for healing
  944.         ; check for health below HealHPCoord
  945.         If ($HealCheck = 1) Then
  946.  
  947.         $HealCheckPixel = PixelGetColor(($HealHPCoord), ($topLeft[1]+458))
  948.         $SpellCheckPixel = PixelGetColor(($HealSPCoord), ($topLeft[1]+458))
  949.         If $HealCheckPixel = $BlankColor1 Then
  950.             If $SpellCheckPixel <> $BlankColor1 Then
  951.                 ; do findattack2 until battlecoord > 1
  952.                 $battleCoord[0] = 1
  953.                 While $battleCoord[0] = 1
  954.                     $battleCoord = findAttack2()
  955.                 WEnd
  956.                 $battleCoord[1] = $battleCoord[1] + 22
  957.                 ; click on skill
  958.                 MouseMove($battleCoord[0], $battleCoord[1], 1)
  959.                 If $TurboCheck = 0 Then
  960.                     Sleep(200)
  961.                 Else
  962.                     Sleep(20)
  963.                 EndIf
  964.                 MouseClick("left")
  965.                 ; click on heal skill of choice
  966.                 If $TurboCheck = 0 Then
  967.                     Sleep(500)
  968.                 Else
  969.                     Sleep(50)
  970.                 EndIf
  971.                 MouseMove($topLeft[0]+$BuffCoords[(($HealSpellNumber*2)-1)],$topLeft[1]+$BuffCoords[(($HealSpellNumber*2))], 1)
  972.                 If $TurboCheck = 0 Then
  973.                     Sleep(200)
  974.                 Else
  975.                     Sleep(20)
  976.                 EndIf
  977.                 MouseClick("left")
  978.                 ; click on character
  979.                 If $TurboCheck = 0 Then
  980.                     Sleep(200)
  981.                 Else
  982.                     Sleep(20)
  983.                 EndIf
  984.                 MouseMove($topLeft[0]+213, $topLeft[1]+200, 1)
  985.                 If $TurboCheck = 0 Then
  986.                     Sleep(200)
  987.                 Else
  988.                     Sleep(20)
  989.                 EndIf
  990.                 MouseClick("left")
  991.                 ; getting lag problems so lets click twice
  992.                 Sleep (100)
  993.                 MouseClick("left")
  994.                 ; click on cancel (if not enough sp)
  995.                 MouseMove($topLeft[0]+368, $topLeft[1]+415, 1)
  996.                 If $TurboCheck = 0 Then
  997.                     Sleep(200)
  998.                 Else
  999.                     Sleep(20)
  1000.                 EndIf
  1001.                 MouseClick("left")
  1002.                 If $TurboCheck = 0 Then
  1003.                     Sleep(200)
  1004.                 Else
  1005.                     Sleep(20)
  1006.                 EndIf
  1007.  
  1008.                 ; end heal
  1009.             EndIf
  1010.         EndIf
  1011.  
  1012.         EndIf
  1013.  
  1014.         ; then do attack
  1015.         $battleCoord = findAttack2()
  1016.         If $battleCoord[0] > 1 Then
  1017.             MouseMove($battleCoord[0], $battleCoord[1], 1)
  1018.             ; Attack every possible position.
  1019.             If $TurboCheck = 0 Then
  1020.                 Sleep(200)
  1021.             Else
  1022.                 Sleep(20)
  1023.             EndIf
  1024.             MouseClick("left")
  1025.             If $TurboCheck = 0 Then
  1026.                 Sleep(200)
  1027.             Else
  1028.                 Sleep(20)
  1029.             EndIf
  1030.             AttackGrid()
  1031.             $AttackPanic1Time = TimerInit()
  1032.         EndIf
  1033.         $AttackPanic2Time = TimerDiff($AttackPanic1Time)
  1034.         If $AttackPanic2Time > 12000 Then
  1035.             ; first - click on cancel
  1036.             MouseMove($topLeft[0]+368, $topLeft[1]+415, 1)
  1037.             Sleep(200)
  1038.             MouseClick("left")
  1039.             ; then attack again
  1040.             AttackGrid()
  1041.             $AttackPanic1Time = TimerInit()
  1042.         EndIf
  1043.         ;$BattleCheckSum = PixelCheckSum(($topLeft[0]+75),($topLeft[1]+253),($topLeft[0]+94),($topLeft[1]+267))
  1044.         If $BattleCheckSum <> PixelCheckSum(($topLeft[0]+75),($topLeft[1]+253),($topLeft[0]+94),($topLeft[1]+267)) Then
  1045.             Sleep(500)
  1046.             If $BattleCheckSum <> PixelCheckSum(($topLeft[0]+75),($topLeft[1]+253),($topLeft[0]+94),($topLeft[1]+267)) Then
  1047.                 $BattleIsDone=1
  1048.             EndIf
  1049.         EndIf
  1050.     WEnd
  1051.     ; fight over - click box
  1052.     ; check HP first
  1053.     $BlankPixel = PixelGetColor(($topLeft[0]+182), ($topLeft[1]+458))
  1054.     $BlankPixel2 = PixelGetColor(($topLeft[0]+216), ($topLeft[1]+458))
  1055.     $BlankPixel3 = PixelGetColor(($topLeft[0]+226), ($topLeft[1]+458))
  1056.     MouseMove(($topLeft[0]+372),($topLeft[1]+364),1)
  1057.     ; a little pause to see your stats
  1058.     If $TurboCheck = 0 Then
  1059.         Sleep(2000)
  1060.     Else
  1061.         Sleep(100)
  1062.     EndIf
  1063.     $BattleCheckSum = PixelCheckSum(($topLeft[0]+75),($topLeft[1]+253),($topLeft[0]+94),($topLeft[1]+267))
  1064.     MouseClick("left")
  1065.     ; another death check
  1066.     If (DeathCheck() = 1) Then
  1067.         $continue=2
  1068.         MsgBox(8192, "You died! (battle check)", "You died!", 1)
  1069.     Else
  1070.         While $BattleCheckSum = PixelCheckSum(($topLeft[0]+75),($topLeft[1]+253),($topLeft[0]+94),($topLeft[1]+267))
  1071.             Sleep(100)
  1072.         WEnd
  1073.         ; this helps with lag stability - 11/06
  1074.         If $TurboCheck = 0 Then
  1075.             Sleep(500)
  1076.         Else
  1077.             Sleep(50)
  1078.         EndIf
  1079.     EndIf
  1080.     $NumberOfBattles=$NumberOfBattles+1
  1081. EndFunc
  1082.  
  1083. Func DungeonPad($x, $y)
  1084.     ; checks for changes in bottom right corner
  1085.     MouseMove($x, $y ,3)
  1086.     Sleep(100)
  1087.     $DungeonCheckSum = PixelChecksum(($topLeft[0]+658),($topLeft[1]+474),($topLeft[0]+725),($topLeft[1]+493))
  1088.     MouseClick("left")
  1089.     Sleep(100)
  1090.     While CharClickCheck() = 1
  1091.         MouseMove($x, $y, 3)
  1092.         Sleep(100)
  1093.         MouseClick("left")
  1094.         Sleep(100)
  1095.     WEnd
  1096.     While $DungeonCheckSum = PixelChecksum(($topLeft[0]+658),($topLeft[1]+474),($topLeft[0]+725),($topLeft[1]+493))
  1097.         If $TurboCheck = 0 Then
  1098.             Sleep(1000)
  1099.         Else
  1100.             Sleep(50)
  1101.         EndIf
  1102.     WEnd
  1103. EndFunc
  1104.  
  1105. Func DungeonPad2($x, $y)
  1106.     ; checks for changes in top right corner
  1107.     MouseMove($x, $y ,3)
  1108.     Sleep(100)
  1109.     $DungeonCheckSum = PixelChecksum(($topLeft[0]+384),($topLeft[1]+216),($topLeft[0]+673),($topLeft[1]+63),($topLeft[0]+709),($topLeft[1]+83))
  1110.     MouseClick("left")
  1111.     Sleep(100)
  1112.     While CharClickCheck() = 1
  1113.         MouseMove($x, $y, 3)
  1114.         Sleep(100)
  1115.         MouseClick("left")
  1116.         Sleep(100)
  1117.     WEnd
  1118.     While $DungeonCheckSum = PixelChecksum(($topLeft[0]+384),($topLeft[1]+216), ($topLeft[0]+673),($topLeft[1]+63), ($topLeft[0]+709),($topLeft[1]+83))
  1119.         If $TurboCheck = 0 Then
  1120.             Sleep(1000)
  1121.         Else
  1122.             Sleep(50)
  1123.         EndIf
  1124.     WEnd
  1125. EndFunc
  1126.  
  1127. Func WaitForPads()
  1128.     $padwait=1
  1129.     While $padwait < 2
  1130.         ; death check
  1131.         If (DeathCheck() = 1) Then
  1132.             $continue = 2
  1133.             $padwait=$padwait+1
  1134.             MsgBox(8192, "You died! (Padcheck)", "You died!", 1)
  1135.         EndIf
  1136.         ; 117 avoids the non play area, 177 avoids entrance in arenas
  1137.         ; these should probably be 117?
  1138.         ; UW needs to be 117 for DD_E3
  1139.         $waitCoord = PixelSearch($topLeft[0],$topLeft[1],$bottomRight[0],$bottomRight[1]-177,$ExitColor1, 5)
  1140.         If @error <> 1 Then
  1141.             $padwait=$padwait+1
  1142.         EndIf
  1143.  
  1144.         $waitCoord = PixelSearch($topLeft[0],$topLeft[1],$bottomRight[0],$bottomRight[1]-177,$PadColor1, 5)
  1145.         If @error <> 1 Then
  1146.             $padwait=$padwait+1
  1147.         EndIf
  1148.         $waitCoord = PixelSearch($topLeft[0],$topLeft[1],$bottomRight[0],$bottomRight[1]-117,$UWExitColor1, 5)
  1149.         If @error <> 1 Then
  1150.             $padwait=$padwait+1
  1151.         EndIf
  1152.         If $TurboCheck = 0 Then
  1153.             Sleep(500)
  1154.         Else
  1155.             Sleep(50)
  1156.         EndIf
  1157.     WEnd
  1158.  
  1159. EndFunc
  1160.  
  1161. Func GrindTsulas2()
  1162.     $TsulasHP = 1
  1163.     While $TsulasHP = 1
  1164.         ; enter Tsulas
  1165.         DungeonPad(($topLeft[0]+369),($topLeft[1]+283))
  1166.         WaitForPads()
  1167.  
  1168.         ; enter first battle - bottom - 4 creatures
  1169.         Battle(($topLeft[0]+278),($topLeft[1]+410))
  1170.         WaitForPads()
  1171.         $TotalXP=$TotalXP+950
  1172.  
  1173.         ;$BlankPixel = PixelGetColor(($topLeft[0]+176), ($topLeft[1]+455))
  1174.         If ($BlankPixel = $BlankColor1) Then
  1175.             $TsulasHP = 2
  1176.         Else
  1177.             ; click to exit Tsulas
  1178.             ;DungeonPad(676, 316)
  1179.             DungeonPad(($topLeft[0]+565),($topLeft[1]+169))
  1180.  
  1181.             ; move away from Tsulas
  1182.             CharMove(($topLeft[0]+444),($topLeft[1]+406))
  1183.             If $TurboCheck = 0 Then
  1184.                 Sleep(1000)
  1185.             Else
  1186.                 Sleep(50)
  1187.             EndIf
  1188.         EndIf
  1189.     WEnd
  1190.  
  1191.     ; enter second battle - 4 creatures
  1192.     Battle(($topLeft[0]+228),($topLeft[1]+217))
  1193.     WaitForPads()
  1194.  
  1195.     ; click to exit Tsulas
  1196.     DungeonPad(($topLeft[0]+565),($topLeft[1]+169))
  1197.  
  1198.     ; move away from Tsulas
  1199.     CharMove(($topLeft[0]+444),($topLeft[1]+406))
  1200.     If $TurboCheck = 0 Then
  1201.         Sleep(1000)
  1202.     Else
  1203.         Sleep(50)
  1204.     EndIf
  1205.     $TotalXP=$TotalXP+550
  1206. EndFunc
  1207.  
  1208. Func GrindBW_A3()
  1209.     ; enter Bleakwoods A3
  1210.     DungeonPad(($topLeft[0]+490),($topLeft[1]+251))
  1211.     WaitForPads()
  1212.  
  1213.     ; enter first battle - right
  1214.     Battle(($topLeft[0]+514),($topLeft[1]+263))
  1215.     WaitForPads()
  1216.  
  1217.     ; enter second battle - left
  1218.     Battle(($topLeft[0]+225),($topLeft[1]+215))
  1219.     WaitForPads()
  1220.  
  1221.     ; click to exit Bleakwoods A3
  1222.     DungeonPad(($topLeft[0]+609),($topLeft[1]+407))
  1223.     WaitForPads()
  1224.  
  1225.     ; move away from Bleakwoods A3
  1226.     CharMove(($topLeft[0]+396),($topLeft[1]+296))
  1227.     If $TurboCheck = 0 Then
  1228.         Sleep(1000)
  1229.     Else
  1230.         Sleep(50)
  1231.     EndIf
  1232.     $TotalXP=$TotalXP+1617
  1233. EndFunc
  1234.  
  1235. Func GrindDD_F1()
  1236.     ; enter Dunes F1
  1237.     DungeonPad(($topLeft[0]+370),($topLeft[1]+119))
  1238.     WaitForPads()
  1239.  
  1240.     ; enter first battle - right
  1241.     Battle(($topLeft[0]+466),($topLeft[1]+261))
  1242.     WaitForPads()
  1243.  
  1244.     ; enter second battle - left
  1245.     Battle(($topLeft[0]+323),($topLeft[1]+262))
  1246.     WaitForPads()
  1247.    
  1248.     ; enter last battle - up
  1249.     Battle(($topLeft[0]+419),($topLeft[1]+190))
  1250.     WaitForPads()
  1251.  
  1252.     ; click to exit Dunes F1
  1253.     CharMove(($topLeft[0]+203),($topLeft[1]+441))
  1254.     WaitForPads()
  1255.  
  1256.     ; move away from Dunes  F1
  1257.     CharMove(($topLeft[0]+302),($topLeft[1]+152))
  1258.     If $TurboCheck = 0 Then
  1259.         Sleep(1000)
  1260.     Else
  1261.         Sleep(50)
  1262.     EndIf
  1263.     $TotalXP=$TotalXP+1617
  1264. EndFunc
  1265.  
  1266. Func GrindUW_D2()
  1267.     ; enter Underworld D2
  1268.     DungeonPad(($topLeft[0]+369),($topLeft[1]+431))
  1269.     WaitForPads()
  1270.  
  1271.     ; enter third battle
  1272.     Battle(($topLeft[0]+562),($topLeft[1]+263))
  1273.     WaitForPads()
  1274.  
  1275.     ; enter first battle
  1276.     Battle(($topLeft[0]+395),($topLeft[1]+347))
  1277.     WaitForPads()
  1278.  
  1279.     ; enter second battle
  1280.     Battle(($topLeft[0]+203),($topLeft[1]+180))
  1281.     WaitForPads()
  1282.  
  1283.     ; exit Underworld D2
  1284.     DungeonPad(($topLeft[0]+57),($topLeft[1]+467))
  1285.  
  1286.     ; move away from Underworld D2
  1287.     CharMove(($topLeft[0]+279),($topLeft[1]+377))
  1288.     If $TurboCheck = 0 Then
  1289.         Sleep(1000)
  1290.     Else
  1291.         Sleep(50)
  1292.     EndIf
  1293.     $TotalXP=$TotalXP+3610
  1294. EndFunc
  1295.  
  1296. Func GrindUW_F4()
  1297.     ; enter Underworld F4
  1298.     DungeonPad(($topLeft[0]+657), ($topLeft[1]+335))
  1299.     WaitForPads()
  1300.  
  1301.     ; enter first battle
  1302.     Battle(($topLeft[0]+394), ($topLeft[1]+203))
  1303.     WaitForPads()
  1304.  
  1305.     ; enter second battle
  1306.     Battle(($topLeft[0]+514), ($topLeft[1]+287))
  1307.     WaitForPads()
  1308.  
  1309.     ; enter third battle
  1310.     Battle(($topLeft[0]+466), ($topLeft[1]+311))
  1311.     WaitForPads()
  1312.  
  1313.     ; exit Underworld F4
  1314.     DungeonPad(($topLeft[0]+177), ($topLeft[1]+382))
  1315.  
  1316.     ; move away from Underworld F4
  1317.     CharMove(($topLeft[0]+540), ($topLeft[1]+309))
  1318.     If $TurboCheck = 0 Then
  1319.         Sleep(1000)
  1320.     Else
  1321.         Sleep(50)
  1322.     EndIf
  1323.     $TotalXP=$TotalXP+4787
  1324. EndFunc
  1325.  
  1326. Func Generic()
  1327.     ; enter dungeon
  1328.     ; Find pad
  1329.     $GenericContinue = 1
  1330.     $genericCoord = PixelSearch($topLeft[0],$topLeft[1],$bottomRight[0],$bottomRight[1]-119,$PadColor2, 5)
  1331.     If @error=1 Then
  1332.         MouseMove(($topLeft[0]+433), ($topLeft[1]+390), 1)
  1333.         If $TurboCheck = 0 Then
  1334.             Sleep(100)
  1335.         Else
  1336.             Sleep(20)
  1337.         EndIf
  1338.         MouseClick("left")
  1339.         If $TurboCheck = 0 Then
  1340.             Sleep(1000)
  1341.         Else
  1342.             Sleep(50)
  1343.         EndIf
  1344.         $genericCoord = PixelSearch($topLeft[0],$topLeft[1],$bottomRight[0],$bottomRight[1]-119,$PadColor2, 5)
  1345.     EndIf
  1346.     $GenericEntrance[0] = $genericCoord[0]
  1347.     $GenericEntrance[1] = $genericCoord[1]
  1348.  
  1349.     DungeonPad($genericCoord[0]+3, $genericCoord[1]+13)
  1350.     WaitForPads()
  1351.  
  1352.     ; Find Battle
  1353.     While $GenericContinue = 1
  1354.         sleep(500)
  1355.         $genericCoord = PixelSearch($topLeft[0],$topLeft[1],$bottomRight[0],$bottomRight[1]-119,$PadColor2, 5)
  1356.         $CheckPixel = PixelSearch($genericCoord[0], $genericCoord[1]+39, $genericCoord[0],$genericCoord[1]+38,0xFFFFFF, 5)
  1357.         If @error = 0 Then
  1358.             Battle($genericCoord[0]+3, $genericCoord[1]+13)
  1359.             WaitForPads()
  1360.         Else
  1361.             $newGenCoord[0]=$genericCoord[0]
  1362.             $newGenCoord[1]=$genericCoord[1]
  1363.             $genericCoord = PixelSearch($topLeft[0],$newGenCoord[1]+40,$bottomRight[0],$bottomRight[1]-119,$PadColor2, 5)
  1364.             If @error=1 Then
  1365.                 $GenericContinue = 2
  1366.             Else
  1367.                 Battle($genericCoord[0]+3, $genericCoord[1]+13)
  1368.                 WaitForPads()
  1369.             EndIf
  1370.         EndIf
  1371.     WEnd
  1372.  
  1373.     ; exit dungeon
  1374.     $genericCoord = PixelSearch($topLeft[0],$topLeft[1],$bottomRight[0],$bottomRight[1]-119,$PadColor2, 5)
  1375.     DungeonPad($genericCoord[0]+3, $genericCoord[1]+13)
  1376.  
  1377.     WaitForPads()
  1378.     ; move away from dungeon
  1379.  
  1380.     CharMove(($GenericEntrance[0]+50), ($GenericEntrance[1]))
  1381.     CharMove(($GenericEntrance[0]), ($GenericEntrance[1]-50))
  1382.     CharMove(($GenericEntrance[0]-50), ($GenericEntrance[1]))
  1383.     CharMove(($GenericEntrance[0]-50), ($GenericEntrance[1]+50))
  1384.     If $TurboCheck = 0 Then
  1385.         Sleep(1000)
  1386.     Else
  1387.         Sleep(50)
  1388.     EndIf
  1389.     $TotalXP=$TotalXP+1
  1390. EndFunc
  1391.  
  1392. Func ArenaCWA()
  1393.     ; start script in arena in first room with battles (not in lobby)
  1394.     ; if you die, you will return to the arena and start over
  1395.     ; if you make it through, you need to stop the script!
  1396.     ; this one is different so you do NOT need to be able to
  1397.     ;   survive through the first room!
  1398.     ;
  1399.  
  1400.     ; ability to repeat this arena not working yet
  1401.  
  1402.     $continue = 1
  1403.  
  1404.     ; Find Battle
  1405.     While $continue = 1
  1406.         ; **** This section may need some work
  1407.         CharMove(($topLeft[0]+374), ($topLeft[1]+256))
  1408.         CharMove(($topLeft[0]+389), ($topLeft[1]+313))
  1409.         ; find white pad
  1410.         WaitForPads()
  1411.         $arenaCoord = PixelSearch($topLeft[0],$topLeft[1],$bottomRight[0],$bottomRight[1]-119,$ExitColor1)
  1412.         If @error=1 Then
  1413.             $exitCoord[0] = $topLeft[0]
  1414.             $exitCoord[1] = $topLeft[1]
  1415.         Else
  1416.             $exitCoord[0]=$arenaCoord[0]
  1417.             $exitCoord[1]=$arenaCoord[1]
  1418.         EndIf
  1419.  
  1420.         $battleCheck = 1
  1421.  
  1422.         While $battleCheck = 1
  1423.             ; next search for battle pads
  1424.             WaitForPads()
  1425.             $arenaCoord = PixelSearch($topLeft[0],$topLeft[1],$bottomRight[0],$bottomRight[1]-119,$PadColor1)
  1426.             If @error=1 Then
  1427.                 $battleCheck = 2
  1428.             Else
  1429.                 Battle($arenaCoord[0], $arenaCoord[1])
  1430.                 WaitForPads()
  1431.                 $TotalXP=$TotalXP+$CWAXP[$NumberOfBattles]
  1432.             EndIf
  1433.         Wend
  1434.         WaitForPads()
  1435.         ; death check
  1436.         If (DeathCheck() = 1) Then
  1437.             $continue = 2
  1438.             MsgBox(8192, "You died! (arena check 1)", "You died!", 1)
  1439.         Else
  1440.             $arenaCoord = PixelSearch($topLeft[0],$topLeft[1],$bottomRight[0],$bottomRight[1]-119,$ExitColor1)
  1441.             If (($arenaCoord[0] = $exitCoord[0]) and ($arenaCoord[1] = $exitCoord[1])) Then
  1442.                 $arenaCoord = PixelSearch($topLeft[0],$exitCoord[1]+3,$bottomRight[0],$bottomRight[1]-119,$ExitColor1)
  1443.                 DungeonPad($arenaCoord[0],$arenaCoord[1])
  1444.             Else
  1445.                 DungeonPad($arenaCoord[0],$arenaCoord[1])
  1446.             EndIf
  1447.         EndIf
  1448.         ; might need to check more than once
  1449.         If (DeathCheck() = 1) Then
  1450.             $continue = 2
  1451.             MsgBox(8192, "You died! (arena check 2)", "You died!", 1)
  1452.         EndIf
  1453.     WEnd
  1454.  
  1455.     ; died - remove last battle XP
  1456.     $TotalXP=$TotalXP-$CWAXP[$NumberOfBattles]
  1457.  
  1458.     ReturnToArena()
  1459.  
  1460. EndFunc
  1461.  
  1462. Func ArenaUWA()
  1463.     ; start script in arena in first room with battles (not in lobby)
  1464.     ; if you die, you will return to the arena and start over
  1465.     ; if you make it through, you need to stop the script!
  1466.     ; this one is different so you do NOT need to be able to
  1467.     ;   survive through the first room!
  1468.     ;
  1469.     ; first room
  1470.  
  1471.     ; ability to repeat this arena not working yet
  1472.  
  1473.     $continue = 1
  1474.  
  1475.     ; Find Battle
  1476.     While $continue = 1
  1477.         ; **** This section may need some work
  1478.         CharMove(($topLeft[0]+374), ($topLeft[1]+256))
  1479.         CharMove(($topLeft[0]+389), ($topLeft[1]+313))
  1480.         ; find white pad
  1481.         WaitForPads()
  1482.         $arenaCoord = PixelSearch($topLeft[0],$topLeft[1],$bottomRight[0],$bottomRight[1]-119,$ExitColor1)
  1483.         If @error=1 Then
  1484.             $exitCoord[0] = $topLeft[0]
  1485.             $exitCoord[1] = $topLeft[1]
  1486.         Else
  1487.             $exitCoord[0]=$arenaCoord[0]
  1488.             $exitCoord[1]=$arenaCoord[1]
  1489.         EndIf
  1490.  
  1491.         $battleCheck = 1
  1492.  
  1493.         While $battleCheck = 1
  1494.             ; next search for battle pads
  1495.             WaitForPads()
  1496.             $arenaCoord = PixelSearch($topLeft[0],$topLeft[1],$bottomRight[0],$bottomRight[1]-119,$PadColor1)
  1497.             If @error=1 Then
  1498.                 $battleCheck = 2
  1499.             Else
  1500.                 Battle($arenaCoord[0], $arenaCoord[1])
  1501.                 WaitForPads()
  1502.                 $TotalXP=$TotalXP+$UWAXP[$NumberOfBattles]
  1503.             EndIf
  1504.         Wend
  1505.         WaitForPads()
  1506.         ; death check
  1507.         If (DeathCheck() = 1) Then
  1508.             $continue = 2
  1509.             MsgBox(8192, "You died! (arena check 1)", "You died!", 1)
  1510.         Else
  1511.             $arenaCoord = PixelSearch($topLeft[0],$topLeft[1],$bottomRight[0],$bottomRight[1]-119,$ExitColor1)
  1512.             If (($arenaCoord[0] = $exitCoord[0]) and ($arenaCoord[1] = $exitCoord[1])) Then
  1513.                 $arenaCoord = PixelSearch($topLeft[0],$exitCoord[1]+3,$bottomRight[0],$bottomRight[1]-119,$ExitColor1)
  1514.                 DungeonPad($arenaCoord[0],$arenaCoord[1])
  1515.             Else
  1516.                 DungeonPad($arenaCoord[0],$arenaCoord[1])
  1517.             EndIf
  1518.         EndIf
  1519.         ; might need to check more than once
  1520.         If (DeathCheck() = 1) Then
  1521.             $continue = 2
  1522.             MsgBox(8192, "You died! (arena check 2)", "You died!", 1)
  1523.         EndIf
  1524.     WEnd
  1525.  
  1526.     ; died - remove last battle XP
  1527.     $TotalXP=$TotalXP-$UWAXP[$NumberOfBattles]
  1528.  
  1529.     ReturnToArena()
  1530. EndFunc
  1531.  
  1532. Func NewbGrind()
  1533.     ; start script in Shikaakwa
  1534.     ;
  1535.     DungeonPad2(($topLeft[0]+706),($topLeft[1]+432))
  1536.  
  1537.     ;go to A3
  1538.     DungeonPad2(($topLeft[0]+154),($topLeft[1]+106))
  1539.     ;go to A2
  1540.     DungeonPad2(($topLeft[0]+226),($topLeft[1]+95))
  1541.  
  1542.     ; grind A2 until HP is 100% when done
  1543.     $NewbHP=2
  1544.     While $NewbHP > 1
  1545.         $NewbHP = 1
  1546.         ; enter Bellroot A2
  1547.         DungeonPad(($topLeft[0]+201),($topLeft[1]+372))
  1548.         WaitForPads()
  1549.  
  1550.         ; enter first battle - left
  1551.         Battle(($topLeft[0]+178),($topLeft[1]+336))
  1552.         WaitForPads()
  1553.  
  1554.         If ($BlankPixel3 = $BlankColor1) Then
  1555.             $NewbHP = $NewbHP + 1
  1556.         EndIf
  1557.  
  1558.         ; enter 2nd battle - middle
  1559.         Battle(($topLeft[0]+297),($topLeft[1]+227))
  1560.         WaitForPads()
  1561.  
  1562.         If ($BlankPixel3 = $BlankColor1) Then
  1563.             $NewbHP = $NewbHP + 1
  1564.         EndIf
  1565.  
  1566.         ; enter 3rd battle - right
  1567.         Battle(($topLeft[0]+513),($topLeft[1]+287))
  1568.         WaitForPads()
  1569.  
  1570.         If ($BlankPixel3 = $BlankColor1) Then
  1571.             $NewbHP = $NewbHP + 1
  1572.         EndIf
  1573.  
  1574.         ; click to exit A2
  1575.         DungeonPad(($topLeft[0]+609),($topLeft[1]+408))
  1576.  
  1577.         ; move away from A2
  1578.         CharMove(($topLeft[0]+431),($topLeft[1]+361))
  1579.         If $TurboCheck = 0 Then
  1580.             Sleep(1000)
  1581.         Else
  1582.             Sleep(50)
  1583.         EndIf
  1584.     WEnd
  1585.  
  1586.     ; go to A1
  1587.     DungeonPad2(($topLeft[0]+417),($topLeft[1]+95))
  1588.  
  1589.     ; grind A1 until HP is 100% when done
  1590.     $NewbHP=2
  1591.     While $NewbHP > 1
  1592.         $NewbHP = 1
  1593.         ; enter Bellroot A1
  1594.         DungeonPad(($topLeft[0]+585),($topLeft[1]+181))
  1595.         WaitForPads()
  1596.  
  1597.         ; enter first battle
  1598.         Battle(($topLeft[0]+250),($topLeft[1]+276))
  1599.         WaitForPads()
  1600.  
  1601.         If ($BlankPixel2 = $BlankColor1) Then
  1602.             $NewbHP = $NewbHP + 1
  1603.         EndIf
  1604.  
  1605.         ; enter 2nd battle
  1606.         Battle(($topLeft[0]+465),($topLeft[1]+264))
  1607.         WaitForPads()
  1608.  
  1609.         If ($BlankPixel2 = $BlankColor1) Then
  1610.             $NewbHP = $NewbHP + 1
  1611.         EndIf
  1612.  
  1613.         ; enter 3rd battle
  1614.         Battle(($topLeft[0]+442),($topLeft[1]+348))
  1615.         WaitForPads()
  1616.  
  1617.         If ($BlankPixel3 = $BlankColor1) Then
  1618.             $NewbHP = $NewbHP + 1
  1619.         EndIf
  1620.  
  1621.         ; click to exit A1
  1622.         DungeonPad(($topLeft[0]+177),($topLeft[1]+408))
  1623.  
  1624.         ; move away from A1
  1625.         CharMove(($topLeft[0]+684),($topLeft[1]+172))
  1626.         If $TurboCheck = 0 Then
  1627.             Sleep(1000)
  1628.         Else
  1629.             Sleep(50)
  1630.         EndIf
  1631.     WEnd
  1632.  
  1633.     ; go to B2
  1634.     DungeonPad2(($topLeft[0]+585),($topLeft[1]+467))
  1635.  
  1636.     DungeonPad2(($topLeft[0]+704),($topLeft[1]+383))
  1637.  
  1638.     ; grind B2 until HP is 100% when done
  1639.     $NewbHP = 2
  1640.     While $NewbHP > 1
  1641.         $NewbHP = 1
  1642.         ; grind 2nd battle until HP is low
  1643.         $RepeatB2 = 1
  1644.         While $RepeatB2 = 1
  1645.             ; enter Bellroot B2
  1646.             DungeonPad(($topLeft[0]+418),($topLeft[1]+358))
  1647.             WaitForPads()
  1648.  
  1649.             ; enter 2nd battle
  1650.             Battle(($topLeft[0]+466),($topLeft[1]+264))
  1651.             WaitForPads()
  1652.  
  1653.             If ($BlankPixel3 <> $BlankColor1) Then
  1654.                 $RepeatB2 = 2
  1655.             Else
  1656.                 If ($BlankPixel = $BlankColor1) Then
  1657.                     $RepeatB2 = 2
  1658.                 Else
  1659.                     ; click to exit B2
  1660.                     DungeonPad(($topLeft[0]+177),($topLeft[1]+407))
  1661.  
  1662.                     ; move away from B2
  1663.                     CharMove(($topLeft[0]+525),($topLeft[1]+322))
  1664.                     If $TurboCheck = 0 Then
  1665.                         Sleep(1000)
  1666.                     Else
  1667.                         Sleep(50)
  1668.                     EndIf
  1669.                 EndIf
  1670.             EndIf
  1671.         WEnd
  1672.  
  1673.         ; enter first battle
  1674.         Battle(($topLeft[0]+226),($topLeft[1]+312))
  1675.         WaitForPads()
  1676.  
  1677.         If ($BlankPixel3 = $BlankColor1) Then
  1678.             $NewbHP = $NewbHP + 1
  1679.         EndIf
  1680.  
  1681.         ; enter 3rd battle
  1682.         Battle(($topLeft[0]+442),($topLeft[1]+347))
  1683.         WaitForPads()
  1684.  
  1685.         If ($BlankPixel3 = $BlankColor1) Then
  1686.             $NewbHP = $NewbHP + 1
  1687.         EndIf
  1688.  
  1689.         ; click to exit B2
  1690.         DungeonPad(($topLeft[0]+177),($topLeft[1]+407))
  1691.  
  1692.         ; move away from B2
  1693.         CharMove(($topLeft[0]+525),($topLeft[1]+322))
  1694.         If $TurboCheck = 0 Then
  1695.             Sleep(1000)
  1696.         Else
  1697.             Sleep(50)
  1698.         EndIf
  1699.     WEnd
  1700.  
  1701.     ;return to Shik
  1702.     DungeonPad(($topLeft[0]+33),($topLeft[1]+262))
  1703.  
  1704.     DungeonPad(($topLeft[0]+346),($topLeft[1]+467))
  1705.  
  1706.     DungeonPad(($topLeft[0]+346),($topLeft[1]+467))
  1707.  
  1708.     DungeonPad(($topLeft[0]+32),($topLeft[1]+455))
  1709.  
  1710.     ; go to Summerville
  1711.     DungeonPad(($topLeft[0]+226),($topLeft[1]+142))
  1712.  
  1713.     DungeonPad(($topLeft[0]+249),($topLeft[1]+466))
  1714.  
  1715.     DungeonPad(($topLeft[0]+34),($topLeft[1]+334))
  1716.  
  1717.     ; grind D1 until HP is 100% when done
  1718.     $NewbHP=2
  1719.     While $NewbHP > 1
  1720.         $NewbHP = 1
  1721.         ; enter Summerville D1
  1722.         DungeonPad(($topLeft[0]+514),($topLeft[1]+240))
  1723.         WaitForPads()
  1724.  
  1725.         ; enter first battle
  1726.         Battle(($topLeft[0]+297),($topLeft[1]+251))
  1727.         WaitForPads()
  1728.  
  1729.         If ($BlankPixel3 = $BlankColor1) Then
  1730.             $NewbHP = $NewbHP + 1
  1731.         EndIf
  1732.  
  1733.         ; enter 2nd battle
  1734.         Battle(($topLeft[0]+514),($topLeft[1]+216))
  1735.         WaitForPads()
  1736.  
  1737.         If ($BlankPixel3 = $BlankColor1) Then
  1738.             $NewbHP = $NewbHP + 1
  1739.         EndIf
  1740.  
  1741.         ; enter 3rd battle
  1742.         Battle(($topLeft[0]+442),($topLeft[1]+324))
  1743.         WaitForPads()
  1744.  
  1745.         If ($BlankPixel3 = $BlankColor1) Then
  1746.             $NewbHP = $NewbHP + 1
  1747.         EndIf
  1748.  
  1749.         ; click to exit D1
  1750.         DungeonPad(($topLeft[0]+225),($topLeft[1]+382))
  1751.  
  1752.         ; move away from D1
  1753.         CharMove(($topLeft[0]+447),($topLeft[1]+324))
  1754.         If $TurboCheck = 0 Then
  1755.             Sleep(1000)
  1756.         Else
  1757.             Sleep(50)
  1758.         EndIf
  1759.     WEnd
  1760.  
  1761.     ; go to C4
  1762.     DungeonPad(($topLeft[0]+394),($topLeft[1]+466))
  1763.  
  1764.     DungeonPad(($topLeft[0]+538),($topLeft[1]+467))
  1765.  
  1766.     DungeonPad(($topLeft[0]+346),($topLeft[1]+468))
  1767.  
  1768.     DungeonPad(($topLeft[0]+33),($topLeft[1]+334))
  1769.  
  1770.     ; grind C4 until HP is 100% when done
  1771.     $NewbHP=2
  1772.     While $NewbHP > 1
  1773.         $NewbHP = 1
  1774.         ; enter Summerville C4
  1775.         DungeonPad(($topLeft[0]+298),($topLeft[1]+323))
  1776.         WaitForPads()
  1777.  
  1778.         ; enter first battle
  1779.         Battle(($topLeft[0]+274),($topLeft[1]+264))
  1780.         WaitForPads()
  1781.  
  1782.         If ($BlankPixel3 = $BlankColor1) Then
  1783.             $NewbHP = $NewbHP + 1
  1784.         EndIf
  1785.  
  1786.         ; enter 2nd battle
  1787.         Battle(($topLeft[0]+441),($topLeft[1]+204))
  1788.         WaitForPads()
  1789.  
  1790.         If ($BlankPixel3 = $BlankColor1) Then
  1791.             $NewbHP = $NewbHP + 1
  1792.         EndIf
  1793.  
  1794.         ; click to exit C4
  1795.         DungeonPad(($topLeft[0]+177),($topLeft[1]+407))
  1796.  
  1797.         ; move away from C4
  1798.         CharMove(($topLeft[0]+173),($topLeft[1]+296))
  1799.         If $TurboCheck = 0 Then
  1800.             Sleep(1000)
  1801.         Else
  1802.             Sleep(50)
  1803.         EndIf
  1804.     WEnd
  1805.  
  1806.     ; go to West Hills E1
  1807.     DungeonPad2(($topLeft[0]+273),($topLeft[1]+97))
  1808.  
  1809.     DungeonPad2(($topLeft[0]+705),($topLeft[1]+240))
  1810.  
  1811.     DungeonPad2(($topLeft[0]+321),($topLeft[1]+95))
  1812.  
  1813.     DungeonPad2(($topLeft[0]+369),($topLeft[1]+95))
  1814.  
  1815.     DungeonPad2(($topLeft[0]+705),($topLeft[1]+215))
  1816.  
  1817.     DungeonPad2(($topLeft[0]+321),($topLeft[1]+95))
  1818.  
  1819.     DungeonPad2(($topLeft[0]+370),($topLeft[1]+95))
  1820.  
  1821.     DungeonPad2(($topLeft[0]+57),($topLeft[1]+106))
  1822.  
  1823.     DungeonPad2(($topLeft[0]+33),($topLeft[1]+234))
  1824.  
  1825.     DungeonPad(($topLeft[0]+129),($topLeft[1]+89))
  1826.  
  1827.     DungeonPad2(($topLeft[0]+369),($topLeft[1]+90))
  1828.  
  1829.     DungeonPad2(($topLeft[0]+465),($topLeft[1]+89))
  1830.  
  1831.     DungeonPad2(($topLeft[0]+369),($topLeft[1]+90))
  1832.  
  1833.     DungeonPad2(($topLeft[0]+705),($topLeft[1]+379))
  1834.  
  1835.     ; grind E1 until HP is 100% when done
  1836.     $NewbHP=2
  1837.     While $NewbHP > 1
  1838.         $NewbHP = 1
  1839.         ; enter West Hills E1
  1840.         DungeonPad(($topLeft[0]+416),($topLeft[1]+312))
  1841.         WaitForPads()
  1842.  
  1843.         ; enter first battle
  1844.         Battle(($topLeft[0]+250),($topLeft[1]+203))
  1845.         WaitForPads()
  1846.  
  1847.         If ($BlankPixel3 = $BlankColor1) Then
  1848.             $NewbHP = $NewbHP + 1
  1849.         EndIf
  1850.  
  1851.         ; enter 2nd battle
  1852.         Battle(($topLeft[0]+608),($topLeft[1]+263))
  1853.         WaitForPads()
  1854.  
  1855.         If ($BlankPixel3 = $BlankColor1) Then
  1856.             $NewbHP = $NewbHP + 1
  1857.         EndIf
  1858.  
  1859.         ; click to exit E1
  1860.         DungeonPad(($topLeft[0]+201),($topLeft[1]+396))
  1861.  
  1862.         ; move away from E1
  1863.         CharMove(($topLeft[0]+305),($topLeft[1]+310))
  1864.         If $TurboCheck = 0 Then
  1865.             Sleep(1000)
  1866.         Else
  1867.             Sleep(50)
  1868.         EndIf
  1869.     WEnd
  1870.  
  1871.     ; go to bleakwoods H3
  1872.     DungeonPad2(($topLeft[0]+34),($topLeft[1]+330))
  1873.  
  1874.     DungeonPad2(($topLeft[0]+585),($topLeft[1]+463))
  1875.  
  1876.     DungeonPad2(($topLeft[0]+153),($topLeft[1]+462))
  1877.  
  1878.     DungeonPad2(($topLeft[0]+393),($topLeft[1]+463))
  1879.  
  1880.     DungeonPad2(($topLeft[0]+81),($topLeft[1]+450))
  1881.  
  1882.     DungeonPad(($topLeft[0]+706),($topLeft[1]+209))
  1883.  
  1884.     DungeonPad2(($topLeft[0]+704),($topLeft[1]+330))
  1885.  
  1886.     DungeonPad(($topLeft[0]+705),($topLeft[1]+312))
  1887.  
  1888.     DungeonPad(($topLeft[0]+345),($topLeft[1]+106))
  1889.  
  1890.     DungeonPad(($topLeft[0]+514),($topLeft[1]+94))
  1891.  
  1892.     DungeonPad(($topLeft[0]+416),($topLeft[1]+95))
  1893.  
  1894.     DungeonPad(($topLeft[0]+416),($topLeft[1]+95))
  1895.  
  1896.     DungeonPad(($topLeft[0]+416),($topLeft[1]+95))
  1897.  
  1898.     DungeonPad(($topLeft[0]+416),($topLeft[1]+95))
  1899.  
  1900.     DungeonPad(($topLeft[0]+657),($topLeft[1]+94))
  1901.  
  1902.     DungeonPad(($topLeft[0]+33),($topLeft[1]+383))
  1903.  
  1904.     DungeonPad(($topLeft[0]+369),($topLeft[1]+96))
  1905.  
  1906.     ; grind H3 until HP is 80% when done
  1907.     $NewbHP=2
  1908.     While $NewbHP > 1
  1909.         $NewbHP = 1
  1910.         ; enter Bleakwoods H3
  1911.         DungeonPad(($topLeft[0]+177),($topLeft[1]+359))
  1912.         WaitForPads()
  1913.  
  1914.         ; enter first battle
  1915.         Battle(($topLeft[0]+225),($topLeft[1]+286))
  1916.         WaitForPads()
  1917.  
  1918.         If ($BlankPixel2 = $BlankColor1) Then
  1919.             $NewbHP = $NewbHP + 1
  1920.         EndIf
  1921.  
  1922.         ; enter 2nd battle
  1923.         Battle(($topLeft[0]+441),($topLeft[1]+203))
  1924.         WaitForPads()
  1925.  
  1926.         If ($BlankPixel2 = $BlankColor1) Then
  1927.             $NewbHP = $NewbHP + 1
  1928.         EndIf
  1929.  
  1930.         ; enter 3rd battle
  1931.         Battle(($topLeft[0]+394),($topLeft[1]+395))
  1932.         WaitForPads()
  1933.  
  1934.         If ($BlankPixel2 = $BlankColor1) Then
  1935.             $NewbHP = $NewbHP + 1
  1936.         EndIf
  1937.  
  1938.         ; click to exit H3
  1939.         DungeonPad(($topLeft[0]+176),($topLeft[1]+407))
  1940.  
  1941.         ; move away from H3
  1942.         CharMove(($topLeft[0]+269),($topLeft[1]+423))
  1943.         If $TurboCheck = 0 Then
  1944.             Sleep(1000)
  1945.         Else
  1946.             Sleep(50)
  1947.         EndIf
  1948.     WEnd
  1949.  
  1950.     ; go to Tsulas
  1951.     DungeonPad(($topLeft[0]+346),($topLeft[1]+467))
  1952.  
  1953.     DungeonPad(($topLeft[0]+33),($topLeft[1]+384))
  1954.  
  1955.     DungeonPad(($topLeft[0]+32),($topLeft[1]+382))
  1956.  
  1957.     DungeonPad(($topLeft[0]+33),($topLeft[1]+407))
  1958.  
  1959.     DungeonPad(($topLeft[0]+154),($topLeft[1]+275))
  1960.  
  1961.     ; this should start Tsulas grind
  1962.     $grind_choice=2
  1963. EndFunc
  1964.  
  1965. Func GrindDD_E3()
  1966.    
  1967.     ; enter Dunes E3
  1968.     DungeonPad(($topLeft[0]+226), ($topLeft[1]+287))
  1969.     WaitForPads()
  1970.    
  1971.     ; move in centre of the duegon
  1972.     CharMove(($topLeft[0]+316), ($topLeft[1]+230))
  1973.  
  1974.     ; enter third battle
  1975.     Battle(($topLeft[0]+442), ($topLeft[1]+178))
  1976.     WaitForPads()
  1977.  
  1978.     ; enter second battle
  1979.     Battle(($topLeft[0]+395), ($topLeft[1]+227))
  1980.     WaitForPads()
  1981.  
  1982.     ; enter fourth battle
  1983.     Battle(($topLeft[0]+514), ($topLeft[1]+286))
  1984.     WaitForPads()
  1985.  
  1986.     ; enter first battle
  1987.     Battle(($topLeft[0]+370), ($topLeft[1]+263))
  1988.     WaitForPads()
  1989.  
  1990.     ; exit Dunes E3
  1991.     DungeonPad(($topLeft[0]+202), ($topLeft[1]+396))
  1992.     WaitForPads()
  1993.  
  1994.     ; move away from Dunes E3
  1995.     CharMove(($topLeft[0]+220), ($topLeft[1]+355))
  1996.     If $TurboCheck = 0 Then
  1997.         Sleep(1000)
  1998.     Else
  1999.         Sleep(50)
  2000.     EndIf
  2001.     $TotalXP=$TotalXP+5756
  2002. EndFunc
  2003.  
  2004. Func GrindUW_B4()
  2005.     ; enter Underworld B4
  2006.     DungeonPad(($topLeft[0]+82), ($topLeft[1]+193))
  2007.     WaitForPads()
  2008.  
  2009.     ; enter first battle
  2010.     Battle(($topLeft[0]+321), ($topLeft[1]+383))
  2011.     WaitForPads()
  2012.  
  2013.     ; enter second battle
  2014.     Battle(($topLeft[0]+273), ($topLeft[1]+239))
  2015.     WaitForPads()
  2016.  
  2017.     ; enter third battle
  2018.     Battle(($topLeft[0]+465), ($topLeft[1]+288))
  2019.     WaitForPads()
  2020.  
  2021.     ; enter fourth battle
  2022.     Battle(($topLeft[0]+513), ($topLeft[1]+311))
  2023.     WaitForPads()
  2024.  
  2025.     ; exit Underworld B4
  2026.     DungeonPad(($topLeft[0]+562), ($topLeft[1]+408))
  2027.     WaitForads()
  2028.  
  2029.     ; move away from Underworld B4
  2030.     CharMove(($topLeft[0]+244), ($topLeft[1]+173))
  2031.     If $TurboCheck = 0 Then
  2032.         Sleep(1000)
  2033.     Else
  2034.         Sleep(50)
  2035.     EndIf
  2036.     $TotalXP=$TotalXP+7559
  2037. EndFunc
  2038.  
  2039. Func GrindDD_A5()
  2040.     ; enter Underworld C2
  2041.     DungeonPad(($topLeft[0]+537), ($topLeft[1]+156))
  2042.     WaitForPads()
  2043.  
  2044.     ; enter first battle
  2045.     Battle(($topLeft[0]+130), ($topLeft[1]+336))
  2046.     WaitForPads()
  2047.  
  2048.     ; enter third battle
  2049.     Battle(($topLeft[0]+488), ($topLeft[1]+155))
  2050.     WaitForPads()
  2051.  
  2052.     ; enter second battle
  2053.     Battle(($topLeft[0]+201), ($topLeft[1]+179))
  2054.     WaitForPads()
  2055.  
  2056.     ; exit Underworld C2
  2057.     DungeonPad(($topLeft[0]+57), ($topLeft[1]+467))
  2058.  
  2059.     ; move away from Underworld C2
  2060.     CharMove(($topLeft[0]+395), ($topLeft[1]+177))
  2061.     If $TurboCheck = 0 Then
  2062.         Sleep(1000)
  2063.     Else
  2064.         Sleep(50)
  2065.     EndIf
  2066.     $TotalXP=$TotalXP+2280
  2067. EndFunc
  2068.  
  2069. Func GrindDD_D3()
  2070.     ; enter Dunes D3
  2071.     DungeonPad(($topLeft[0]+299), ($topLeft[1]+372))
  2072.     WaitForPads()
  2073.  
  2074.     ; enter first battle
  2075.     Battle(($topLeft[0]+250), ($topLeft[1]+251))
  2076.     WaitForPads()
  2077.  
  2078.     ; enter second battle
  2079.     Battle(($topLeft[0]+418), ($topLeft[1]+167))
  2080.     WaitForPads()
  2081.  
  2082.     ; enter third battle
  2083.     Battle(($topLeft[0]+562), ($topLeft[1]+264))
  2084.     WaitForPads()
  2085.  
  2086.     ; exit Dunes D3
  2087.     DungeonPad(($topLeft[0]+202), ($topLeft[1]+395))
  2088.  
  2089.     ; move away from Dunes D3
  2090.     CharMove(($topLeft[0]+238), ($topLeft[1]+431))
  2091.     If $TurboCheck = 0 Then
  2092.         Sleep(1000)
  2093.     Else
  2094.         Sleep(50)
  2095.     EndIf
  2096.     $TotalXP=$TotalXP+9370
  2097. EndFunc
  2098.  
  2099. Func DeathCheck()
  2100.     $DeathYes=0
  2101.     $DeathNo=0
  2102.     ;$chimneycheck = 0xE2D6C3
  2103.     $chimneycheck = PixelGetColor($topLeft[0]+267, $topLeft[1]+311)
  2104.     If $chimneycheck < 0xB00000 Then
  2105.         Return(0)
  2106.     EndIf
  2107.     For $DeathX = 267 to 277
  2108.         For $DeathY = 311 to 321
  2109.             $chimneycheck2 = PixelGetColor($topLeft[0]+$DeathX, $topLeft[1]+$DeathY)
  2110.             If $chimneycheck2 = $chimneycheck Then
  2111.                 $DeathYes=$DeathYes+1
  2112.             Else
  2113.                 $DeathNo=$DeathNo+1
  2114.                 ; not chimney - not dead - return 0
  2115.                 If $DeathNo > 10 Then
  2116.                     Return(0)
  2117.                 EndIf
  2118.             EndIf
  2119.         Next
  2120.     Next
  2121.     ; thats the chimney - they dead
  2122.     Return(1)
  2123. EndFunc
  2124.  
  2125. Func ArenaGrind2()
  2126.     ; start script in arena in first room with battles (not in lobby)
  2127.     ; if you die, you will return to the arena and start over
  2128.     $NumberOfBattles=0
  2129.     $ArenaContinue = 1
  2130.     $RoomsCleared = 0
  2131.     $ArenaRoomCount = 1
  2132.     $continue = 1
  2133.  
  2134.     ; Find Battle
  2135.     While $continue = 1
  2136.         ; need to move away from pad first - maybe not necessary?
  2137.         ; 09/01 - I decided this is necessary again
  2138.         ; 11/06 - good delay while we wait for pads
  2139.         MouseMove(($topLeft[0]+374), ($topLeft[1]+256), 3)
  2140.         MouseClick("left")
  2141.         sleep(500)
  2142.  
  2143.         ; click on character check
  2144.         While CharClickCheck() = 1
  2145.             MouseMove(($topLeft[0]+374), ($topLeft[1]+256), 3)
  2146.             Sleep(100)
  2147.             MouseClick("left")
  2148.             Sleep(100)
  2149.         WEnd
  2150.  
  2151.         ; find white pad
  2152.         WaitForPads()
  2153.         $battleCheck = 1
  2154.         While $battleCheck = 1
  2155.             ; next search for battle pads
  2156.             WaitForPads()
  2157.             ; need this code so it doesn't think 7-7 exit is a battle
  2158.             If $NumberOfBattles < $ArenaNumberOfBattles[$ArenaNumber] Then
  2159.                 ; -177 avoids the non play area and the entrance at the start of an arena
  2160.                 $ArenaCoord = PixelSearch($topLeft[0],$topLeft[1],$bottomRight[0],$bottomRight[1]-177,$PadColor2, 5)
  2161.                 If @error=1 Then
  2162.                     ; for battle pad server delay - lets check twice
  2163.                     Sleep(500)
  2164.                 EndIf
  2165.                 $ArenaCoord = PixelSearch($topLeft[0],$topLeft[1],$bottomRight[0],$bottomRight[1]-177,$PadColor2, 5)
  2166.                 If @error=1 Then
  2167.                     $battleCheck = 2
  2168.                 Else
  2169.                     Battle($ArenaCoord[0]+3, $ArenaCoord[1]+13)
  2170.                     WaitForPads()
  2171.                     $TotalXP=$TotalXP+$ArenaXP[$ArenaNumber][$NumberOfBattles]
  2172.                 EndIf
  2173.             Else
  2174.                 $battleCheck = 2
  2175.             EndIf
  2176.         Wend
  2177.         WaitForPads()
  2178.         ; keep count of rooms cleared - when arena is done - exit and repeat
  2179.         $RoomsCleared = $RoomsCleared + 1
  2180.         If $RoomsCleared = 49 Then
  2181.             ; find exit
  2182.             DungeonPad(($ArenaExit[$ArenaRoomCount])+$topLeft[0],($ArenaExit[$ArenaRoomCount+1])+$topLeft[1])
  2183.             CharMove(($topLeft[0]+320), ($topLeft[1]+239))
  2184.             If $TurboCheck = 0 Then
  2185.                 Sleep(2000)
  2186.             Else
  2187.                 Sleep(20)
  2188.             EndIf
  2189.             DungeonPad(($topLeft[0]+82),($topLeft[1]+97))
  2190.             Return
  2191.         EndIf
  2192.         ; death check
  2193.         If (DeathCheck() = 1) Then
  2194.             $continue = 2
  2195.             MsgBox(8192, "You died! (arena check 1)", "You died!", 1)
  2196.         Else
  2197.             ; find exit
  2198.             DungeonPad(($ArenaExit[$ArenaRoomCount])+$topLeft[0],($ArenaExit[$ArenaRoomCount+1])+$topLeft[1])
  2199.             $ArenaRoomCount = $ArenaRoomCount + 2
  2200.             If $ArenaRoomCount = 15 Then
  2201.                 $ArenaRoomCount = 1
  2202.             EndIf
  2203.         EndIf
  2204.         ; might need to check more than once
  2205.         If (DeathCheck() = 1) Then
  2206.             $continue = 2
  2207.             MsgBox(8192, "You died! (arena check 2)", "You died!", 1)
  2208.         EndIf
  2209.     WEnd
  2210.  
  2211.     ; died - remove last battle XP
  2212.     $TotalXP=$TotalXP-$ArenaXP[$ArenaNumber][$NumberOfBattles]
  2213.     ReturnToArena()
  2214. EndFunc
  2215.  
  2216.  
  2217. Func ReturnToArena()
  2218.     If $ArenaNumber = 1 Then
  2219.         ; starting from Shikaakwa - return to FF
  2220.         DungeonPad(($topLeft[0]+224),($topLeft[1]+141))
  2221.  
  2222.         DungeonPad(($topLeft[0]+370),($topLeft[1]+91))
  2223.  
  2224.         DungeonPad(($topLeft[0]+57),($topLeft[1]+105))
  2225.  
  2226.         DungeonPad(($topLeft[0]+369),($topLeft[1]+87))
  2227.  
  2228.         DungeonPad(($topLeft[0]+202),($topLeft[1]+266))
  2229.  
  2230.         DungeonPad(($topLeft[0]+81),($topLeft[1]+93))
  2231.     EndIf
  2232.  
  2233.     If $ArenaNumber = 2 Then
  2234.         ; starting from Shikaakwa - return to SVA
  2235.         DungeonPad(($topLeft[0]+224),($topLeft[1]+141))
  2236.  
  2237.         DungeonPad(($topLeft[0]+251),($topLeft[1]+465))
  2238.  
  2239.         DungeonPad(($topLeft[0]+705),($topLeft[1]+237))
  2240.  
  2241.         DungeonPad(($topLeft[0]+706),($topLeft[1]+140))
  2242.  
  2243.         DungeonPad(($topLeft[0]+322),($topLeft[1]+380))
  2244.  
  2245.         DungeonPad(($topLeft[0]+81),($topLeft[1]+94))
  2246.     EndIf
  2247.  
  2248.     If $ArenaNumber = 3 Then
  2249.         ; starting from Shikaakwa - return to BWA
  2250.         DungeonPad(($topLeft[0]+321),($topLeft[1]+92))
  2251.  
  2252.         DungeonPad(($topLeft[0]+346),($topLeft[1]+103))
  2253.  
  2254.         DungeonPad(($topLeft[0]+513),($topLeft[1]+91))
  2255.  
  2256.         DungeonPad(($topLeft[0]+416),($topLeft[1]+91))
  2257.  
  2258.         DungeonPad(($topLeft[0]+417),($topLeft[1]+92))
  2259.  
  2260.         DungeonPad(($topLeft[0]+416),($topLeft[1]+91))
  2261.  
  2262.         DungeonPad(($topLeft[0]+416),($topLeft[1]+92))
  2263.  
  2264.         DungeonPad(($topLeft[0]+657),($topLeft[1]+92))
  2265.  
  2266.         DungeonPad(($topLeft[0]+321),($topLeft[1]+92))
  2267.  
  2268.         DungeonPad(($topLeft[0]+370),($topLeft[1]+92))
  2269.  
  2270.         DungeonPad(($topLeft[0]+273),($topLeft[1]+91))
  2271.  
  2272.         DungeonPad(($topLeft[0]+298),($topLeft[1]+320))
  2273.  
  2274.         DungeonPad(($topLeft[0]+81),($topLeft[1]+91))
  2275.     EndIf
  2276.  
  2277.     If $ArenaNumber = 4 Then
  2278.         ; starting from Shikaakwa - return to DFA
  2279.         DungeonPad2(($topLeft[0]+705),($topLeft[1]+429))
  2280.  
  2281.         DungeonPad2(($topLeft[0]+586),($topLeft[1]+465))
  2282.  
  2283.         DungeonPad2(($topLeft[0]+705),($topLeft[1]+453))
  2284.  
  2285.         DungeonPad(($topLeft[0]+705),($topLeft[1]+260))
  2286.  
  2287.         DungeonPad(($topLeft[0]+704),($topLeft[1]+140))
  2288.  
  2289.         DungeonPad(($topLeft[0]+497),($topLeft[1]+440))
  2290.  
  2291.         DungeonPad(($topLeft[0]+391),($topLeft[1]+461))
  2292.  
  2293.         DungeonPad(($topLeft[0]+392),($topLeft[1]+461))
  2294.  
  2295.         DungeonPad(($topLeft[0]+439),($topLeft[1]+461))
  2296.  
  2297.         DungeonPad(($topLeft[0]+199),($topLeft[1]+462))
  2298.  
  2299.         DungeonPad(($topLeft[0]+704),($topLeft[1]+306))
  2300.  
  2301.         DungeonPad(($topLeft[0]+703),($topLeft[1]+233))
  2302.  
  2303.         DungeonPad2(($topLeft[0]+704),($topLeft[1]+401))
  2304.  
  2305.         DungeonPad(($topLeft[0]+704),($topLeft[1]+232))
  2306.  
  2307.         DungeonPad2(($topLeft[0]+711),($topLeft[1]+401))
  2308.  
  2309.         DungeonPad(($topLeft[0]+344),($topLeft[1]+221))
  2310.  
  2311.         DungeonPad(($topLeft[0]+81),($topLeft[1]+94))
  2312.     EndIf
  2313.  
  2314.     If $ArenaNumber = 5 Then
  2315.         ; starting from Shikaakwa - return to BRA
  2316.         DungeonPad2(($topLeft[0]+705),($topLeft[1]+429))
  2317.  
  2318.         DungeonPad2(($topLeft[0]+586),($topLeft[1]+465))
  2319.  
  2320.         DungeonPad2(($topLeft[0]+705),($topLeft[1]+453))
  2321.  
  2322.         DungeonPad(($topLeft[0]+705),($topLeft[1]+260))
  2323.  
  2324.         DungeonPad(($topLeft[0]+704),($topLeft[1]+140))
  2325.  
  2326.         DungeonPad(($topLeft[0]+706),($topLeft[1]+284))
  2327.  
  2328.         DungeonPad(($topLeft[0]+154),($topLeft[1]+176))
  2329.  
  2330.         DungeonPad(($topLeft[0]+81),($topLeft[1]+93))
  2331.     EndIf
  2332.  
  2333.     If $ArenaNumber = 6 Then
  2334.         ; starting from Shikaakwa - return to CWA
  2335.         DungeonPad(($topLeft[0]+321),($topLeft[1]+94))
  2336.  
  2337.         DungeonPad(($topLeft[0]+347),($topLeft[1]+105))
  2338.  
  2339.         DungeonPad2(($topLeft[0]+31),($topLeft[1]+384))
  2340.  
  2341.         DungeonPad2(($topLeft[0]+32),($topLeft[1]+214))
  2342.  
  2343.         DungeonPad2(($topLeft[0]+33),($topLeft[1]+359))
  2344.  
  2345.         DungeonPad(($topLeft[0]+465),($topLeft[1]+96))
  2346.  
  2347.         DungeonPad(($topLeft[0]+201),($topLeft[1]+300))
  2348.  
  2349.         DungeonPad(($topLeft[0]+57),($topLeft[1]+251))
  2350.     EndIf
  2351.  
  2352.     If $ArenaNumber = 7 Then
  2353.         ; starting from Shikaakwa - return to UWA
  2354.         DungeonPad2(($topLeft[0]+705),($topLeft[1]+430))
  2355.  
  2356.         DungeonPad2(($topLeft[0]+585),($topLeft[1]+467))
  2357.  
  2358.         DungeonPad2(($topLeft[0]+705),($topLeft[1]+453))
  2359.  
  2360.         DungeonPad(($topLeft[0]+705),($topLeft[1]+263))
  2361.  
  2362.         DungeonPad(($topLeft[0]+704),($topLeft[1]+142))
  2363.  
  2364.         DungeonPad(($topLeft[0]+705),($topLeft[1]+287))
  2365.  
  2366.         DungeonPad(($topLeft[0]+705),($topLeft[1]+215))
  2367.  
  2368.         DungeonPad(($topLeft[0]+177),($topLeft[1]+95))
  2369.  
  2370.         DungeonPad(($topLeft[0]+705),($topLeft[1]+166))
  2371.  
  2372.         DungeonPad(($topLeft[0]+538),($topLeft[1]+82))
  2373.  
  2374.         DungeonPad(($topLeft[0]+33),($topLeft[1]+376))
  2375.  
  2376.         DungeonPad(($topLeft[0]+33),($topLeft[1]+351))
  2377.  
  2378.         DungeonPad2(($topLeft[0]+32),($topLeft[1]+400))
  2379.  
  2380.         DungeonPad(($topLeft[0]+33),($topLeft[1]+257))
  2381.  
  2382.         DungeonPad2(($topLeft[0]+489),($topLeft[1]+460))
  2383.  
  2384.         DungeonPad(($topLeft[0]+33),($topLeft[1]+280))
  2385.  
  2386.         DungeonPad(($topLeft[0]+273),($topLeft[1]+88))
  2387.  
  2388.         DungeonPad(($topLeft[0]+32),($topLeft[1]+311))
  2389.     EndIf
  2390.  
  2391.     If $ArenaNumber = 8 Then
  2392.         ; starting from Shikaakwa - return to PGA
  2393.         ; 137, 121
  2394.         ; dungeonpad - bottom right
  2395.         ; dungeonpad2 - top right
  2396.         ;DungeonPad2(458, 216)
  2397.  
  2398.         ;DungeonPad2(482, 228)
  2399.  
  2400.         ;DungeonPad2(841, 578)
  2401.  
  2402.         ;DungeonPad2(457, 216)
  2403.  
  2404.         ;DungeonPad2(842, 505)
  2405.  
  2406.         ;DungeonPad2(601, 217)
  2407.  
  2408.         ;DungeonPad2(338, 276)
  2409.  
  2410.         ;DungeonPad2(842, 407)
  2411.  
  2412.         ;DungeonPad2(842, 384)
  2413.  
  2414.         ;DungeonPad2(841, 504)
  2415.  
  2416.         ;DungeonPad2(506, 216)
  2417.  
  2418.         ;DungeonPad2(554, 217)
  2419.  
  2420.         ;DungeonPad2(697, 217)
  2421.  
  2422.         ;DungeonPad2(602, 216)
  2423.  
  2424.         ;DungeonPad2(506, 217)
  2425.  
  2426.         ;DungeonPad2(171, 385)
  2427.  
  2428.         ;DungeonPad2(482, 589)
  2429.  
  2430.         ;DungeonPad2(530, 324)
  2431.     EndIf
  2432. EndFunc
  2433.  
  2434. Func CharClickCheck()
  2435.     ; if character box is found, clicks on cancel, returns 1
  2436.     ; if no box found, returns 0
  2437.     $cccCount = 0
  2438.     For $cccx = 40 to 90
  2439.         For $cccy = 297 to 337
  2440.             $ClickCheck = PixelGetColor($topLeft[0]+$cccx, $topLeft[1]+$cccy)
  2441.             If $ClickCheck < 15728640 Then
  2442.                 $cccCount = $cccCount + 1
  2443.                 If $cccCount > 5 Then
  2444.                     Return (0)
  2445.                     ;$cccy = 454
  2446.                     ;$cccx = 98
  2447.                 EndIf
  2448.             EndIf
  2449.         Next
  2450.     Next
  2451.     ; Click to cancel window
  2452.     MouseMove ($topLeft[0]+318,$topLeft[1]+95,1)
  2453.     MouseClick("left")
  2454.     Return (1)
  2455. EndFunc
  2456.  
  2457. Func CharMove($x, $y)
  2458.     ; clicks on a non-pad area
  2459.     ; checks for character click check
  2460.     MouseMove($x, $y, 3)
  2461.     If $TurboCheck = 0 Then
  2462.         Sleep(100)
  2463.     Else
  2464.         Sleep(20)
  2465.     EndIf
  2466.     MouseClick("left")
  2467.     While CharClickCheck() = 1
  2468.         MouseMove($x, $y, 3)
  2469.         Sleep(100)
  2470.         MouseClick("left")
  2471.         Sleep(100)
  2472.     WEnd
  2473. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment