Shakesphere

Sacred Seasons Bot v.1.4

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