Shakesphere

Sacred Seasons Bot v1.2

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