Shakesphere

Sacred Seasons Bot v.1.3

Sep 3rd, 2011
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 73.02 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.     DungeonPad(($topLeft[0]+202), ($topLeft[1]+444))
  1255.     WaitForPads()
  1256.  
  1257.     ; move away from Dunes  F1
  1258.     CharMove(($topLeft[0]+302),($topLeft[1]+152))
  1259.     If $TurboCheck = 0 Then
  1260.         Sleep(1000)
  1261.     Else
  1262.         Sleep(50)
  1263.     EndIf
  1264.     $TotalXP=$TotalXP+1617
  1265. EndFunc
  1266.  
  1267. Func GrindUW_D2()
  1268.     ; enter Underworld D2
  1269.     DungeonPad(($topLeft[0]+369),($topLeft[1]+431))
  1270.     WaitForPads()
  1271.  
  1272.     ; enter third battle
  1273.     Battle(($topLeft[0]+562),($topLeft[1]+263))
  1274.     WaitForPads()
  1275.  
  1276.     ; enter first battle
  1277.     Battle(($topLeft[0]+395),($topLeft[1]+347))
  1278.     WaitForPads()
  1279.  
  1280.     ; enter second battle
  1281.     Battle(($topLeft[0]+203),($topLeft[1]+180))
  1282.     WaitForPads()
  1283.  
  1284.     ; exit Underworld D2
  1285.     DungeonPad(($topLeft[0]+57),($topLeft[1]+467))
  1286.  
  1287.     ; move away from Underworld D2
  1288.     CharMove(($topLeft[0]+279),($topLeft[1]+377))
  1289.     If $TurboCheck = 0 Then
  1290.         Sleep(1000)
  1291.     Else
  1292.         Sleep(50)
  1293.     EndIf
  1294.     $TotalXP=$TotalXP+3610
  1295. EndFunc
  1296.  
  1297. Func GrindUW_F4()
  1298.     ; enter Underworld F4
  1299.     DungeonPad(($topLeft[0]+657), ($topLeft[1]+335))
  1300.     WaitForPads()
  1301.  
  1302.     ; enter first battle
  1303.     Battle(($topLeft[0]+394), ($topLeft[1]+203))
  1304.     WaitForPads()
  1305.  
  1306.     ; enter second battle
  1307.     Battle(($topLeft[0]+514), ($topLeft[1]+287))
  1308.     WaitForPads()
  1309.  
  1310.     ; enter third battle
  1311.     Battle(($topLeft[0]+466), ($topLeft[1]+311))
  1312.     WaitForPads()
  1313.  
  1314.     ; exit Underworld F4
  1315.     DungeonPad(($topLeft[0]+177), ($topLeft[1]+382))
  1316.  
  1317.     ; move away from Underworld F4
  1318.     CharMove(($topLeft[0]+540), ($topLeft[1]+309))
  1319.     If $TurboCheck = 0 Then
  1320.         Sleep(1000)
  1321.     Else
  1322.         Sleep(50)
  1323.     EndIf
  1324.     $TotalXP=$TotalXP+4787
  1325. EndFunc
  1326.  
  1327. Func Generic()
  1328.     ; enter dungeon
  1329.     ; Find pad
  1330.     $GenericContinue = 1
  1331.     $genericCoord = PixelSearch($topLeft[0],$topLeft[1],$bottomRight[0],$bottomRight[1]-119,$PadColor2, 5)
  1332.     If @error=1 Then
  1333.         MouseMove(($topLeft[0]+433), ($topLeft[1]+390), 1)
  1334.         If $TurboCheck = 0 Then
  1335.             Sleep(100)
  1336.         Else
  1337.             Sleep(20)
  1338.         EndIf
  1339.         MouseClick("left")
  1340.         If $TurboCheck = 0 Then
  1341.             Sleep(1000)
  1342.         Else
  1343.             Sleep(50)
  1344.         EndIf
  1345.         $genericCoord = PixelSearch($topLeft[0],$topLeft[1],$bottomRight[0],$bottomRight[1]-119,$PadColor2, 5)
  1346.     EndIf
  1347.     $GenericEntrance[0] = $genericCoord[0]
  1348.     $GenericEntrance[1] = $genericCoord[1]
  1349.  
  1350.     DungeonPad($genericCoord[0]+3, $genericCoord[1]+13)
  1351.     WaitForPads()
  1352.  
  1353.     ; Find Battle
  1354.     While $GenericContinue = 1
  1355.         sleep(500)
  1356.         $genericCoord = PixelSearch($topLeft[0],$topLeft[1],$bottomRight[0],$bottomRight[1]-119,$PadColor2, 5)
  1357.         $CheckPixel = PixelSearch($genericCoord[0], $genericCoord[1]+39, $genericCoord[0],$genericCoord[1]+38,0xFFFFFF, 5)
  1358.         If @error = 0 Then
  1359.             Battle($genericCoord[0]+3, $genericCoord[1]+13)
  1360.             WaitForPads()
  1361.         Else
  1362.             $newGenCoord[0]=$genericCoord[0]
  1363.             $newGenCoord[1]=$genericCoord[1]
  1364.             $genericCoord = PixelSearch($topLeft[0],$newGenCoord[1]+40,$bottomRight[0],$bottomRight[1]-119,$PadColor2, 5)
  1365.             If @error=1 Then
  1366.                 $GenericContinue = 2
  1367.             Else
  1368.                 Battle($genericCoord[0]+3, $genericCoord[1]+13)
  1369.                 WaitForPads()
  1370.             EndIf
  1371.         EndIf
  1372.     WEnd
  1373.  
  1374.     ; exit dungeon
  1375.     $genericCoord = PixelSearch($topLeft[0],$topLeft[1],$bottomRight[0],$bottomRight[1]-119,$PadColor2, 5)
  1376.     DungeonPad($genericCoord[0]+3, $genericCoord[1]+13)
  1377.  
  1378.     WaitForPads()
  1379.     ; move away from dungeon
  1380.  
  1381.     CharMove(($GenericEntrance[0]+50), ($GenericEntrance[1]))
  1382.     CharMove(($GenericEntrance[0]), ($GenericEntrance[1]-50))
  1383.     CharMove(($GenericEntrance[0]-50), ($GenericEntrance[1]))
  1384.     CharMove(($GenericEntrance[0]-50), ($GenericEntrance[1]+50))
  1385.     If $TurboCheck = 0 Then
  1386.         Sleep(1000)
  1387.     Else
  1388.         Sleep(50)
  1389.     EndIf
  1390.     $TotalXP=$TotalXP+1
  1391. EndFunc
  1392.  
  1393. Func ArenaCWA()
  1394.     ; start script in arena in first room with battles (not in lobby)
  1395.     ; if you die, you will return to the arena and start over
  1396.     ; if you make it through, you need to stop the script!
  1397.     ; this one is different so you do NOT need to be able to
  1398.     ;   survive through the first room!
  1399.     ;
  1400.  
  1401.     ; ability to repeat this arena not working yet
  1402.  
  1403.     $continue = 1
  1404.  
  1405.     ; Find Battle
  1406.     While $continue = 1
  1407.         ; **** This section may need some work
  1408.         CharMove(($topLeft[0]+374), ($topLeft[1]+256))
  1409.         CharMove(($topLeft[0]+389), ($topLeft[1]+313))
  1410.         ; find white pad
  1411.         WaitForPads()
  1412.         $arenaCoord = PixelSearch($topLeft[0],$topLeft[1],$bottomRight[0],$bottomRight[1]-119,$ExitColor1)
  1413.         If @error=1 Then
  1414.             $exitCoord[0] = $topLeft[0]
  1415.             $exitCoord[1] = $topLeft[1]
  1416.         Else
  1417.             $exitCoord[0]=$arenaCoord[0]
  1418.             $exitCoord[1]=$arenaCoord[1]
  1419.         EndIf
  1420.  
  1421.         $battleCheck = 1
  1422.  
  1423.         While $battleCheck = 1
  1424.             ; next search for battle pads
  1425.             WaitForPads()
  1426.             $arenaCoord = PixelSearch($topLeft[0],$topLeft[1],$bottomRight[0],$bottomRight[1]-119,$PadColor1)
  1427.             If @error=1 Then
  1428.                 $battleCheck = 2
  1429.             Else
  1430.                 Battle($arenaCoord[0], $arenaCoord[1])
  1431.                 WaitForPads()
  1432.                 $TotalXP=$TotalXP+$CWAXP[$NumberOfBattles]
  1433.             EndIf
  1434.         Wend
  1435.         WaitForPads()
  1436.         ; death check
  1437.         If (DeathCheck() = 1) Then
  1438.             $continue = 2
  1439.             MsgBox(8192, "You died! (arena check 1)", "You died!", 1)
  1440.         Else
  1441.             $arenaCoord = PixelSearch($topLeft[0],$topLeft[1],$bottomRight[0],$bottomRight[1]-119,$ExitColor1)
  1442.             If (($arenaCoord[0] = $exitCoord[0]) and ($arenaCoord[1] = $exitCoord[1])) Then
  1443.                 $arenaCoord = PixelSearch($topLeft[0],$exitCoord[1]+3,$bottomRight[0],$bottomRight[1]-119,$ExitColor1)
  1444.                 DungeonPad($arenaCoord[0],$arenaCoord[1])
  1445.             Else
  1446.                 DungeonPad($arenaCoord[0],$arenaCoord[1])
  1447.             EndIf
  1448.         EndIf
  1449.         ; might need to check more than once
  1450.         If (DeathCheck() = 1) Then
  1451.             $continue = 2
  1452.             MsgBox(8192, "You died! (arena check 2)", "You died!", 1)
  1453.         EndIf
  1454.     WEnd
  1455.  
  1456.     ; died - remove last battle XP
  1457.     $TotalXP=$TotalXP-$CWAXP[$NumberOfBattles]
  1458.  
  1459.     ReturnToArena()
  1460.  
  1461. EndFunc
  1462.  
  1463. Func ArenaUWA()
  1464.     ; start script in arena in first room with battles (not in lobby)
  1465.     ; if you die, you will return to the arena and start over
  1466.     ; if you make it through, you need to stop the script!
  1467.     ; this one is different so you do NOT need to be able to
  1468.     ;   survive through the first room!
  1469.     ;
  1470.     ; first room
  1471.  
  1472.     ; ability to repeat this arena not working yet
  1473.  
  1474.     $continue = 1
  1475.  
  1476.     ; Find Battle
  1477.     While $continue = 1
  1478.         ; **** This section may need some work
  1479.         CharMove(($topLeft[0]+374), ($topLeft[1]+256))
  1480.         CharMove(($topLeft[0]+389), ($topLeft[1]+313))
  1481.         ; find white pad
  1482.         WaitForPads()
  1483.         $arenaCoord = PixelSearch($topLeft[0],$topLeft[1],$bottomRight[0],$bottomRight[1]-119,$ExitColor1)
  1484.         If @error=1 Then
  1485.             $exitCoord[0] = $topLeft[0]
  1486.             $exitCoord[1] = $topLeft[1]
  1487.         Else
  1488.             $exitCoord[0]=$arenaCoord[0]
  1489.             $exitCoord[1]=$arenaCoord[1]
  1490.         EndIf
  1491.  
  1492.         $battleCheck = 1
  1493.  
  1494.         While $battleCheck = 1
  1495.             ; next search for battle pads
  1496.             WaitForPads()
  1497.             $arenaCoord = PixelSearch($topLeft[0],$topLeft[1],$bottomRight[0],$bottomRight[1]-119,$PadColor1)
  1498.             If @error=1 Then
  1499.                 $battleCheck = 2
  1500.             Else
  1501.                 Battle($arenaCoord[0], $arenaCoord[1])
  1502.                 WaitForPads()
  1503.                 $TotalXP=$TotalXP+$UWAXP[$NumberOfBattles]
  1504.             EndIf
  1505.         Wend
  1506.         WaitForPads()
  1507.         ; death check
  1508.         If (DeathCheck() = 1) Then
  1509.             $continue = 2
  1510.             MsgBox(8192, "You died! (arena check 1)", "You died!", 1)
  1511.         Else
  1512.             $arenaCoord = PixelSearch($topLeft[0],$topLeft[1],$bottomRight[0],$bottomRight[1]-119,$ExitColor1)
  1513.             If (($arenaCoord[0] = $exitCoord[0]) and ($arenaCoord[1] = $exitCoord[1])) Then
  1514.                 $arenaCoord = PixelSearch($topLeft[0],$exitCoord[1]+3,$bottomRight[0],$bottomRight[1]-119,$ExitColor1)
  1515.                 DungeonPad($arenaCoord[0],$arenaCoord[1])
  1516.             Else
  1517.                 DungeonPad($arenaCoord[0],$arenaCoord[1])
  1518.             EndIf
  1519.         EndIf
  1520.         ; might need to check more than once
  1521.         If (DeathCheck() = 1) Then
  1522.             $continue = 2
  1523.             MsgBox(8192, "You died! (arena check 2)", "You died!", 1)
  1524.         EndIf
  1525.     WEnd
  1526.  
  1527.     ; died - remove last battle XP
  1528.     $TotalXP=$TotalXP-$UWAXP[$NumberOfBattles]
  1529.  
  1530.     ReturnToArena()
  1531. EndFunc
  1532.  
  1533. Func NewbGrind()
  1534.     ; start script in Shikaakwa
  1535.     ;
  1536.     DungeonPad2(($topLeft[0]+706),($topLeft[1]+432))
  1537.  
  1538.     ;go to A3
  1539.     DungeonPad2(($topLeft[0]+154),($topLeft[1]+106))
  1540.     ;go to A2
  1541.     DungeonPad2(($topLeft[0]+226),($topLeft[1]+95))
  1542.  
  1543.     ; grind A2 until HP is 100% when done
  1544.     $NewbHP=2
  1545.     While $NewbHP > 1
  1546.         $NewbHP = 1
  1547.         ; enter Bellroot A2
  1548.         DungeonPad(($topLeft[0]+201),($topLeft[1]+372))
  1549.         WaitForPads()
  1550.  
  1551.         ; enter first battle - left
  1552.         Battle(($topLeft[0]+178),($topLeft[1]+336))
  1553.         WaitForPads()
  1554.  
  1555.         If ($BlankPixel3 = $BlankColor1) Then
  1556.             $NewbHP = $NewbHP + 1
  1557.         EndIf
  1558.  
  1559.         ; enter 2nd battle - middle
  1560.         Battle(($topLeft[0]+297),($topLeft[1]+227))
  1561.         WaitForPads()
  1562.  
  1563.         If ($BlankPixel3 = $BlankColor1) Then
  1564.             $NewbHP = $NewbHP + 1
  1565.         EndIf
  1566.  
  1567.         ; enter 3rd battle - right
  1568.         Battle(($topLeft[0]+513),($topLeft[1]+287))
  1569.         WaitForPads()
  1570.  
  1571.         If ($BlankPixel3 = $BlankColor1) Then
  1572.             $NewbHP = $NewbHP + 1
  1573.         EndIf
  1574.  
  1575.         ; click to exit A2
  1576.         DungeonPad(($topLeft[0]+609),($topLeft[1]+408))
  1577.  
  1578.         ; move away from A2
  1579.         CharMove(($topLeft[0]+431),($topLeft[1]+361))
  1580.         If $TurboCheck = 0 Then
  1581.             Sleep(1000)
  1582.         Else
  1583.             Sleep(50)
  1584.         EndIf
  1585.     WEnd
  1586.  
  1587.     ; go to A1
  1588.     DungeonPad2(($topLeft[0]+417),($topLeft[1]+95))
  1589.  
  1590.     ; grind A1 until HP is 100% when done
  1591.     $NewbHP=2
  1592.     While $NewbHP > 1
  1593.         $NewbHP = 1
  1594.         ; enter Bellroot A1
  1595.         DungeonPad(($topLeft[0]+585),($topLeft[1]+181))
  1596.         WaitForPads()
  1597.  
  1598.         ; enter first battle
  1599.         Battle(($topLeft[0]+250),($topLeft[1]+276))
  1600.         WaitForPads()
  1601.  
  1602.         If ($BlankPixel2 = $BlankColor1) Then
  1603.             $NewbHP = $NewbHP + 1
  1604.         EndIf
  1605.  
  1606.         ; enter 2nd battle
  1607.         Battle(($topLeft[0]+465),($topLeft[1]+264))
  1608.         WaitForPads()
  1609.  
  1610.         If ($BlankPixel2 = $BlankColor1) Then
  1611.             $NewbHP = $NewbHP + 1
  1612.         EndIf
  1613.  
  1614.         ; enter 3rd battle
  1615.         Battle(($topLeft[0]+442),($topLeft[1]+348))
  1616.         WaitForPads()
  1617.  
  1618.         If ($BlankPixel3 = $BlankColor1) Then
  1619.             $NewbHP = $NewbHP + 1
  1620.         EndIf
  1621.  
  1622.         ; click to exit A1
  1623.         DungeonPad(($topLeft[0]+177),($topLeft[1]+408))
  1624.  
  1625.         ; move away from A1
  1626.         CharMove(($topLeft[0]+684),($topLeft[1]+172))
  1627.         If $TurboCheck = 0 Then
  1628.             Sleep(1000)
  1629.         Else
  1630.             Sleep(50)
  1631.         EndIf
  1632.     WEnd
  1633.  
  1634.     ; go to B2
  1635.     DungeonPad2(($topLeft[0]+585),($topLeft[1]+467))
  1636.  
  1637.     DungeonPad2(($topLeft[0]+704),($topLeft[1]+383))
  1638.  
  1639.     ; grind B2 until HP is 100% when done
  1640.     $NewbHP = 2
  1641.     While $NewbHP > 1
  1642.         $NewbHP = 1
  1643.         ; grind 2nd battle until HP is low
  1644.         $RepeatB2 = 1
  1645.         While $RepeatB2 = 1
  1646.             ; enter Bellroot B2
  1647.             DungeonPad(($topLeft[0]+418),($topLeft[1]+358))
  1648.             WaitForPads()
  1649.  
  1650.             ; enter 2nd battle
  1651.             Battle(($topLeft[0]+466),($topLeft[1]+264))
  1652.             WaitForPads()
  1653.  
  1654.             If ($BlankPixel3 <> $BlankColor1) Then
  1655.                 $RepeatB2 = 2
  1656.             Else
  1657.                 If ($BlankPixel = $BlankColor1) Then
  1658.                     $RepeatB2 = 2
  1659.                 Else
  1660.                     ; click to exit B2
  1661.                     DungeonPad(($topLeft[0]+177),($topLeft[1]+407))
  1662.  
  1663.                     ; move away from B2
  1664.                     CharMove(($topLeft[0]+525),($topLeft[1]+322))
  1665.                     If $TurboCheck = 0 Then
  1666.                         Sleep(1000)
  1667.                     Else
  1668.                         Sleep(50)
  1669.                     EndIf
  1670.                 EndIf
  1671.             EndIf
  1672.         WEnd
  1673.  
  1674.         ; enter first battle
  1675.         Battle(($topLeft[0]+226),($topLeft[1]+312))
  1676.         WaitForPads()
  1677.  
  1678.         If ($BlankPixel3 = $BlankColor1) Then
  1679.             $NewbHP = $NewbHP + 1
  1680.         EndIf
  1681.  
  1682.         ; enter 3rd battle
  1683.         Battle(($topLeft[0]+442),($topLeft[1]+347))
  1684.         WaitForPads()
  1685.  
  1686.         If ($BlankPixel3 = $BlankColor1) Then
  1687.             $NewbHP = $NewbHP + 1
  1688.         EndIf
  1689.  
  1690.         ; click to exit B2
  1691.         DungeonPad(($topLeft[0]+177),($topLeft[1]+407))
  1692.  
  1693.         ; move away from B2
  1694.         CharMove(($topLeft[0]+525),($topLeft[1]+322))
  1695.         If $TurboCheck = 0 Then
  1696.             Sleep(1000)
  1697.         Else
  1698.             Sleep(50)
  1699.         EndIf
  1700.     WEnd
  1701.  
  1702.     ;return to Shik
  1703.     DungeonPad(($topLeft[0]+33),($topLeft[1]+262))
  1704.  
  1705.     DungeonPad(($topLeft[0]+346),($topLeft[1]+467))
  1706.  
  1707.     DungeonPad(($topLeft[0]+346),($topLeft[1]+467))
  1708.  
  1709.     DungeonPad(($topLeft[0]+32),($topLeft[1]+455))
  1710.  
  1711.     ; go to Summerville
  1712.     DungeonPad(($topLeft[0]+226),($topLeft[1]+142))
  1713.  
  1714.     DungeonPad(($topLeft[0]+249),($topLeft[1]+466))
  1715.  
  1716.     DungeonPad(($topLeft[0]+34),($topLeft[1]+334))
  1717.  
  1718.     ; grind D1 until HP is 100% when done
  1719.     $NewbHP=2
  1720.     While $NewbHP > 1
  1721.         $NewbHP = 1
  1722.         ; enter Summerville D1
  1723.         DungeonPad(($topLeft[0]+514),($topLeft[1]+240))
  1724.         WaitForPads()
  1725.  
  1726.         ; enter first battle
  1727.         Battle(($topLeft[0]+297),($topLeft[1]+251))
  1728.         WaitForPads()
  1729.  
  1730.         If ($BlankPixel3 = $BlankColor1) Then
  1731.             $NewbHP = $NewbHP + 1
  1732.         EndIf
  1733.  
  1734.         ; enter 2nd battle
  1735.         Battle(($topLeft[0]+514),($topLeft[1]+216))
  1736.         WaitForPads()
  1737.  
  1738.         If ($BlankPixel3 = $BlankColor1) Then
  1739.             $NewbHP = $NewbHP + 1
  1740.         EndIf
  1741.  
  1742.         ; enter 3rd battle
  1743.         Battle(($topLeft[0]+442),($topLeft[1]+324))
  1744.         WaitForPads()
  1745.  
  1746.         If ($BlankPixel3 = $BlankColor1) Then
  1747.             $NewbHP = $NewbHP + 1
  1748.         EndIf
  1749.  
  1750.         ; click to exit D1
  1751.         DungeonPad(($topLeft[0]+225),($topLeft[1]+382))
  1752.  
  1753.         ; move away from D1
  1754.         CharMove(($topLeft[0]+447),($topLeft[1]+324))
  1755.         If $TurboCheck = 0 Then
  1756.             Sleep(1000)
  1757.         Else
  1758.             Sleep(50)
  1759.         EndIf
  1760.     WEnd
  1761.  
  1762.     ; go to C4
  1763.     DungeonPad(($topLeft[0]+394),($topLeft[1]+466))
  1764.  
  1765.     DungeonPad(($topLeft[0]+538),($topLeft[1]+467))
  1766.  
  1767.     DungeonPad(($topLeft[0]+346),($topLeft[1]+468))
  1768.  
  1769.     DungeonPad(($topLeft[0]+33),($topLeft[1]+334))
  1770.  
  1771.     ; grind C4 until HP is 100% when done
  1772.     $NewbHP=2
  1773.     While $NewbHP > 1
  1774.         $NewbHP = 1
  1775.         ; enter Summerville C4
  1776.         DungeonPad(($topLeft[0]+298),($topLeft[1]+323))
  1777.         WaitForPads()
  1778.  
  1779.         ; enter first battle
  1780.         Battle(($topLeft[0]+274),($topLeft[1]+264))
  1781.         WaitForPads()
  1782.  
  1783.         If ($BlankPixel3 = $BlankColor1) Then
  1784.             $NewbHP = $NewbHP + 1
  1785.         EndIf
  1786.  
  1787.         ; enter 2nd battle
  1788.         Battle(($topLeft[0]+441),($topLeft[1]+204))
  1789.         WaitForPads()
  1790.  
  1791.         If ($BlankPixel3 = $BlankColor1) Then
  1792.             $NewbHP = $NewbHP + 1
  1793.         EndIf
  1794.  
  1795.         ; click to exit C4
  1796.         DungeonPad(($topLeft[0]+177),($topLeft[1]+407))
  1797.  
  1798.         ; move away from C4
  1799.         CharMove(($topLeft[0]+173),($topLeft[1]+296))
  1800.         If $TurboCheck = 0 Then
  1801.             Sleep(1000)
  1802.         Else
  1803.             Sleep(50)
  1804.         EndIf
  1805.     WEnd
  1806.  
  1807.     ; go to West Hills E1
  1808.     DungeonPad2(($topLeft[0]+273),($topLeft[1]+97))
  1809.  
  1810.     DungeonPad2(($topLeft[0]+705),($topLeft[1]+240))
  1811.  
  1812.     DungeonPad2(($topLeft[0]+321),($topLeft[1]+95))
  1813.  
  1814.     DungeonPad2(($topLeft[0]+369),($topLeft[1]+95))
  1815.  
  1816.     DungeonPad2(($topLeft[0]+705),($topLeft[1]+215))
  1817.  
  1818.     DungeonPad2(($topLeft[0]+321),($topLeft[1]+95))
  1819.  
  1820.     DungeonPad2(($topLeft[0]+370),($topLeft[1]+95))
  1821.  
  1822.     DungeonPad2(($topLeft[0]+57),($topLeft[1]+106))
  1823.  
  1824.     DungeonPad2(($topLeft[0]+33),($topLeft[1]+234))
  1825.  
  1826.     DungeonPad(($topLeft[0]+129),($topLeft[1]+89))
  1827.  
  1828.     DungeonPad2(($topLeft[0]+369),($topLeft[1]+90))
  1829.  
  1830.     DungeonPad2(($topLeft[0]+465),($topLeft[1]+89))
  1831.  
  1832.     DungeonPad2(($topLeft[0]+369),($topLeft[1]+90))
  1833.  
  1834.     DungeonPad2(($topLeft[0]+705),($topLeft[1]+379))
  1835.  
  1836.     ; grind E1 until HP is 100% when done
  1837.     $NewbHP=2
  1838.     While $NewbHP > 1
  1839.         $NewbHP = 1
  1840.         ; enter West Hills E1
  1841.         DungeonPad(($topLeft[0]+416),($topLeft[1]+312))
  1842.         WaitForPads()
  1843.  
  1844.         ; enter first battle
  1845.         Battle(($topLeft[0]+250),($topLeft[1]+203))
  1846.         WaitForPads()
  1847.  
  1848.         If ($BlankPixel3 = $BlankColor1) Then
  1849.             $NewbHP = $NewbHP + 1
  1850.         EndIf
  1851.  
  1852.         ; enter 2nd battle
  1853.         Battle(($topLeft[0]+608),($topLeft[1]+263))
  1854.         WaitForPads()
  1855.  
  1856.         If ($BlankPixel3 = $BlankColor1) Then
  1857.             $NewbHP = $NewbHP + 1
  1858.         EndIf
  1859.  
  1860.         ; click to exit E1
  1861.         DungeonPad(($topLeft[0]+201),($topLeft[1]+396))
  1862.  
  1863.         ; move away from E1
  1864.         CharMove(($topLeft[0]+305),($topLeft[1]+310))
  1865.         If $TurboCheck = 0 Then
  1866.             Sleep(1000)
  1867.         Else
  1868.             Sleep(50)
  1869.         EndIf
  1870.     WEnd
  1871.  
  1872.     ; go to bleakwoods H3
  1873.     DungeonPad2(($topLeft[0]+34),($topLeft[1]+330))
  1874.  
  1875.     DungeonPad2(($topLeft[0]+585),($topLeft[1]+463))
  1876.  
  1877.     DungeonPad2(($topLeft[0]+153),($topLeft[1]+462))
  1878.  
  1879.     DungeonPad2(($topLeft[0]+393),($topLeft[1]+463))
  1880.  
  1881.     DungeonPad2(($topLeft[0]+81),($topLeft[1]+450))
  1882.  
  1883.     DungeonPad(($topLeft[0]+706),($topLeft[1]+209))
  1884.  
  1885.     DungeonPad2(($topLeft[0]+704),($topLeft[1]+330))
  1886.  
  1887.     DungeonPad(($topLeft[0]+705),($topLeft[1]+312))
  1888.  
  1889.     DungeonPad(($topLeft[0]+345),($topLeft[1]+106))
  1890.  
  1891.     DungeonPad(($topLeft[0]+514),($topLeft[1]+94))
  1892.  
  1893.     DungeonPad(($topLeft[0]+416),($topLeft[1]+95))
  1894.  
  1895.     DungeonPad(($topLeft[0]+416),($topLeft[1]+95))
  1896.  
  1897.     DungeonPad(($topLeft[0]+416),($topLeft[1]+95))
  1898.  
  1899.     DungeonPad(($topLeft[0]+416),($topLeft[1]+95))
  1900.  
  1901.     DungeonPad(($topLeft[0]+657),($topLeft[1]+94))
  1902.  
  1903.     DungeonPad(($topLeft[0]+33),($topLeft[1]+383))
  1904.  
  1905.     DungeonPad(($topLeft[0]+369),($topLeft[1]+96))
  1906.  
  1907.     ; grind H3 until HP is 80% when done
  1908.     $NewbHP=2
  1909.     While $NewbHP > 1
  1910.         $NewbHP = 1
  1911.         ; enter Bleakwoods H3
  1912.         DungeonPad(($topLeft[0]+177),($topLeft[1]+359))
  1913.         WaitForPads()
  1914.  
  1915.         ; enter first battle
  1916.         Battle(($topLeft[0]+225),($topLeft[1]+286))
  1917.         WaitForPads()
  1918.  
  1919.         If ($BlankPixel2 = $BlankColor1) Then
  1920.             $NewbHP = $NewbHP + 1
  1921.         EndIf
  1922.  
  1923.         ; enter 2nd battle
  1924.         Battle(($topLeft[0]+441),($topLeft[1]+203))
  1925.         WaitForPads()
  1926.  
  1927.         If ($BlankPixel2 = $BlankColor1) Then
  1928.             $NewbHP = $NewbHP + 1
  1929.         EndIf
  1930.  
  1931.         ; enter 3rd battle
  1932.         Battle(($topLeft[0]+394),($topLeft[1]+395))
  1933.         WaitForPads()
  1934.  
  1935.         If ($BlankPixel2 = $BlankColor1) Then
  1936.             $NewbHP = $NewbHP + 1
  1937.         EndIf
  1938.  
  1939.         ; click to exit H3
  1940.         DungeonPad(($topLeft[0]+176),($topLeft[1]+407))
  1941.  
  1942.         ; move away from H3
  1943.         CharMove(($topLeft[0]+269),($topLeft[1]+423))
  1944.         If $TurboCheck = 0 Then
  1945.             Sleep(1000)
  1946.         Else
  1947.             Sleep(50)
  1948.         EndIf
  1949.     WEnd
  1950.  
  1951.     ; go to Tsulas
  1952.     DungeonPad(($topLeft[0]+346),($topLeft[1]+467))
  1953.  
  1954.     DungeonPad(($topLeft[0]+33),($topLeft[1]+384))
  1955.  
  1956.     DungeonPad(($topLeft[0]+32),($topLeft[1]+382))
  1957.  
  1958.     DungeonPad(($topLeft[0]+33),($topLeft[1]+407))
  1959.  
  1960.     DungeonPad(($topLeft[0]+154),($topLeft[1]+275))
  1961.  
  1962.     ; this should start Tsulas grind
  1963.     $grind_choice=2
  1964. EndFunc
  1965.  
  1966. Func GrindDD_E3()
  1967.    
  1968.     ; enter Dunes E3
  1969.     DungeonPad(($topLeft[0]+228), ($topLeft[1]+288))
  1970.     WaitForPads()
  1971.    
  1972.     CharMove(($topLeft[0]+339), ($topLeft[1]+205))
  1973.    
  1974.     ; enter third battle
  1975.     Battle(($topLeft[0]+395), ($topLeft[1]+227))
  1976.     WaitForPads()
  1977.    
  1978.     ; enter first battle
  1979.     Battle(($topLeft[0]+372), ($topLeft[1]+266))
  1980.     WaitForPads()
  1981.    
  1982.     ; enter fourth battle
  1983.     Battle(($topLeft[0]+443), ($topLeft[1]+181))
  1984.     WaitForPads()
  1985.    
  1986.     ; enter second battle
  1987.     Battle(($topLeft[0]+515), ($topLeft[1]+288))
  1988.     WaitForPads()
  1989.     ; exit Dunes E3
  1990.    
  1991.     DungeonPad(($topLeft[0]+206), ($topLeft[1]+398))
  1992.     WaitForPads()
  1993.  
  1994.     ; move away from Dunes E3
  1995.     CharMove(($topLeft[0]+185), ($topLeft[1]+307))
  1996.     If $TurboCheck = 0 Then
  1997.         Sleep(1000)
  1998.     Else
  1999.         Sleep(50)
  2000.     EndIf
  2001.     $TotalXP=$TotalXP+5756
  2002. EndFunc
  2003.  
  2004. Func GrindUW_B4()
  2005.     ; enter Underworld B4
  2006.     DungeonPad(($topLeft[0]+82), ($topLeft[1]+193))
  2007.     WaitForPads()
  2008.  
  2009.     ; enter first battle
  2010.     Battle(($topLeft[0]+321), ($topLeft[1]+383))
  2011.     WaitForPads()
  2012.  
  2013.     ; enter second battle
  2014.     Battle(($topLeft[0]+273), ($topLeft[1]+239))
  2015.     WaitForPads()
  2016.  
  2017.     ; enter third battle
  2018.     Battle(($topLeft[0]+465), ($topLeft[1]+288))
  2019.     WaitForPads()
  2020.  
  2021.     ; enter fourth battle
  2022.     Battle(($topLeft[0]+513), ($topLeft[1]+311))
  2023.     WaitForPads()
  2024.  
  2025.     ; exit Underworld B4
  2026.     DungeonPad(($topLeft[0]+562), ($topLeft[1]+408))
  2027.     WaitForads()
  2028.  
  2029.     ; move away from Underworld B4
  2030.     CharMove(($topLeft[0]+244), ($topLeft[1]+173))
  2031.     If $TurboCheck = 0 Then
  2032.         Sleep(1000)
  2033.     Else
  2034.         Sleep(50)
  2035.     EndIf
  2036.     $TotalXP=$TotalXP+7559
  2037. EndFunc
  2038.  
  2039. Func GrindDD_A5()
  2040.     ; enter Underworld C2
  2041.     DungeonPad(($topLeft[0]+537), ($topLeft[1]+156))
  2042.     WaitForPads()
  2043.  
  2044.     ; enter first battle
  2045.     Battle(($topLeft[0]+130), ($topLeft[1]+336))
  2046.     WaitForPads()
  2047.  
  2048.     ; enter third battle
  2049.     Battle(($topLeft[0]+488), ($topLeft[1]+155))
  2050.     WaitForPads()
  2051.  
  2052.     ; enter second battle
  2053.     Battle(($topLeft[0]+201), ($topLeft[1]+179))
  2054.     WaitForPads()
  2055.  
  2056.     ; exit Underworld C2
  2057.     DungeonPad(($topLeft[0]+57), ($topLeft[1]+467))
  2058.  
  2059.     ; move away from Underworld C2
  2060.     CharMove(($topLeft[0]+395), ($topLeft[1]+177))
  2061.     If $TurboCheck = 0 Then
  2062.         Sleep(1000)
  2063.     Else
  2064.         Sleep(50)
  2065.     EndIf
  2066.     $TotalXP=$TotalXP+2280
  2067. EndFunc
  2068.  
  2069. Func GrindDD_D3()
  2070.     ; enter Dunes D3
  2071.     DungeonPad(($topLeft[0]+299), ($topLeft[1]+372))
  2072.     WaitForPads()
  2073.  
  2074.     ; enter first battle
  2075.     Battle(($topLeft[0]+250), ($topLeft[1]+251))
  2076.     WaitForPads()
  2077.  
  2078.     ; enter second battle
  2079.     Battle(($topLeft[0]+418), ($topLeft[1]+167))
  2080.     WaitForPads()
  2081.  
  2082.     ; enter third battle
  2083.     Battle(($topLeft[0]+562), ($topLeft[1]+264))
  2084.     WaitForPads()
  2085.  
  2086.     ; exit Dunes D3
  2087.     DungeonPad(($topLeft[0]+202), ($topLeft[1]+395))
  2088.  
  2089.     ; move away from Dunes D3
  2090.     CharMove(($topLeft[0]+238), ($topLeft[1]+431))
  2091.     If $TurboCheck = 0 Then
  2092.         Sleep(1000)
  2093.     Else
  2094.         Sleep(50)
  2095.     EndIf
  2096.     $TotalXP=$TotalXP+9370
  2097. EndFunc
  2098.  
  2099. Func DeathCheck()
  2100.     $DeathYes=0
  2101.     $DeathNo=0
  2102.     ;$chimneycheck = 0xE2D6C3
  2103.     $chimneycheck = PixelGetColor($topLeft[0]+267, $topLeft[1]+311)
  2104.     If $chimneycheck < 0xB00000 Then
  2105.         Return(0)
  2106.     EndIf
  2107.     For $DeathX = 267 to 277
  2108.         For $DeathY = 311 to 321
  2109.             $chimneycheck2 = PixelGetColor($topLeft[0]+$DeathX, $topLeft[1]+$DeathY)
  2110.             If $chimneycheck2 = $chimneycheck Then
  2111.                 $DeathYes=$DeathYes+1
  2112.             Else
  2113.                 $DeathNo=$DeathNo+1
  2114.                 ; not chimney - not dead - return 0
  2115.                 If $DeathNo > 10 Then
  2116.                     Return(0)
  2117.                 EndIf
  2118.             EndIf
  2119.         Next
  2120.     Next
  2121.     ; thats the chimney - they dead
  2122.     Return(1)
  2123. EndFunc
  2124.  
  2125. Func ArenaGrind2()
  2126.     ; start script in arena in first room with battles (not in lobby)
  2127.     ; if you die, you will return to the arena and start over
  2128.     $NumberOfBattles=0
  2129.     $ArenaContinue = 1
  2130.     $RoomsCleared = 0
  2131.     $ArenaRoomCount = 1
  2132.     $continue = 1
  2133.  
  2134.     ; Find Battle
  2135.     While $continue = 1
  2136.         ; need to move away from pad first - maybe not necessary?
  2137.         ; 09/01 - I decided this is necessary again
  2138.         ; 11/06 - good delay while we wait for pads
  2139.         MouseMove(($topLeft[0]+374), ($topLeft[1]+256), 3)
  2140.         MouseClick("left")
  2141.         sleep(500)
  2142.  
  2143.         ; click on character check
  2144.         While CharClickCheck() = 1
  2145.             MouseMove(($topLeft[0]+374), ($topLeft[1]+256), 3)
  2146.             Sleep(100)
  2147.             MouseClick("left")
  2148.             Sleep(100)
  2149.         WEnd
  2150.  
  2151.         ; find white pad
  2152.         WaitForPads()
  2153.         $battleCheck = 1
  2154.         While $battleCheck = 1
  2155.             ; next search for battle pads
  2156.             WaitForPads()
  2157.             ; need this code so it doesn't think 7-7 exit is a battle
  2158.             If $NumberOfBattles < $ArenaNumberOfBattles[$ArenaNumber] Then
  2159.                 ; -177 avoids the non play area and the entrance at the start of an arena
  2160.                 $ArenaCoord = PixelSearch($topLeft[0],$topLeft[1],$bottomRight[0],$bottomRight[1]-177,$PadColor2, 5)
  2161.                 If @error=1 Then
  2162.                     ; for battle pad server delay - lets check twice
  2163.                     Sleep(500)
  2164.                 EndIf
  2165.                 $ArenaCoord = PixelSearch($topLeft[0],$topLeft[1],$bottomRight[0],$bottomRight[1]-177,$PadColor2, 5)
  2166.                 If @error=1 Then
  2167.                     $battleCheck = 2
  2168.                 Else
  2169.                     Battle($ArenaCoord[0]+3, $ArenaCoord[1]+13)
  2170.                     WaitForPads()
  2171.                     $TotalXP=$TotalXP+$ArenaXP[$ArenaNumber][$NumberOfBattles]
  2172.                 EndIf
  2173.             Else
  2174.                 $battleCheck = 2
  2175.             EndIf
  2176.         Wend
  2177.         WaitForPads()
  2178.         ; keep count of rooms cleared - when arena is done - exit and repeat
  2179.         $RoomsCleared = $RoomsCleared + 1
  2180.         If $RoomsCleared = 49 Then
  2181.             ; find exit
  2182.             DungeonPad(($ArenaExit[$ArenaRoomCount])+$topLeft[0],($ArenaExit[$ArenaRoomCount+1])+$topLeft[1])
  2183.             CharMove(($topLeft[0]+320), ($topLeft[1]+239))
  2184.             If $TurboCheck = 0 Then
  2185.                 Sleep(2000)
  2186.             Else
  2187.                 Sleep(20)
  2188.             EndIf
  2189.             DungeonPad(($topLeft[0]+82),($topLeft[1]+97))
  2190.             Return
  2191.         EndIf
  2192.         ; death check
  2193.         If (DeathCheck() = 1) Then
  2194.             $continue = 2
  2195.             MsgBox(8192, "You died! (arena check 1)", "You died!", 1)
  2196.         Else
  2197.             ; find exit
  2198.             DungeonPad(($ArenaExit[$ArenaRoomCount])+$topLeft[0],($ArenaExit[$ArenaRoomCount+1])+$topLeft[1])
  2199.             $ArenaRoomCount = $ArenaRoomCount + 2
  2200.             If $ArenaRoomCount = 15 Then
  2201.                 $ArenaRoomCount = 1
  2202.             EndIf
  2203.         EndIf
  2204.         ; might need to check more than once
  2205.         If (DeathCheck() = 1) Then
  2206.             $continue = 2
  2207.             MsgBox(8192, "You died! (arena check 2)", "You died!", 1)
  2208.         EndIf
  2209.     WEnd
  2210.  
  2211.     ; died - remove last battle XP
  2212.     $TotalXP=$TotalXP-$ArenaXP[$ArenaNumber][$NumberOfBattles]
  2213.     ReturnToArena()
  2214. EndFunc
  2215.  
  2216.  
  2217. Func ReturnToArena()
  2218.     If $ArenaNumber = 1 Then
  2219.         ; starting from Shikaakwa - return to FF
  2220.         DungeonPad(($topLeft[0]+224),($topLeft[1]+141))
  2221.  
  2222.         DungeonPad(($topLeft[0]+370),($topLeft[1]+91))
  2223.  
  2224.         DungeonPad(($topLeft[0]+57),($topLeft[1]+105))
  2225.  
  2226.         DungeonPad(($topLeft[0]+369),($topLeft[1]+87))
  2227.  
  2228.         DungeonPad(($topLeft[0]+202),($topLeft[1]+266))
  2229.  
  2230.         DungeonPad(($topLeft[0]+81),($topLeft[1]+93))
  2231.     EndIf
  2232.  
  2233.     If $ArenaNumber = 2 Then
  2234.         ; starting from Shikaakwa - return to SVA
  2235.         DungeonPad(($topLeft[0]+224),($topLeft[1]+141))
  2236.  
  2237.         DungeonPad(($topLeft[0]+251),($topLeft[1]+465))
  2238.  
  2239.         DungeonPad(($topLeft[0]+705),($topLeft[1]+237))
  2240.  
  2241.         DungeonPad(($topLeft[0]+706),($topLeft[1]+140))
  2242.  
  2243.         DungeonPad(($topLeft[0]+322),($topLeft[1]+380))
  2244.  
  2245.         DungeonPad(($topLeft[0]+81),($topLeft[1]+94))
  2246.     EndIf
  2247.  
  2248.     If $ArenaNumber = 3 Then
  2249.         ; starting from Shikaakwa - return to BWA
  2250.         DungeonPad(($topLeft[0]+321),($topLeft[1]+92))
  2251.  
  2252.         DungeonPad(($topLeft[0]+346),($topLeft[1]+103))
  2253.  
  2254.         DungeonPad(($topLeft[0]+513),($topLeft[1]+91))
  2255.  
  2256.         DungeonPad(($topLeft[0]+416),($topLeft[1]+91))
  2257.  
  2258.         DungeonPad(($topLeft[0]+417),($topLeft[1]+92))
  2259.  
  2260.         DungeonPad(($topLeft[0]+416),($topLeft[1]+91))
  2261.  
  2262.         DungeonPad(($topLeft[0]+416),($topLeft[1]+92))
  2263.  
  2264.         DungeonPad(($topLeft[0]+657),($topLeft[1]+92))
  2265.  
  2266.         DungeonPad(($topLeft[0]+321),($topLeft[1]+92))
  2267.  
  2268.         DungeonPad(($topLeft[0]+370),($topLeft[1]+92))
  2269.  
  2270.         DungeonPad(($topLeft[0]+273),($topLeft[1]+91))
  2271.  
  2272.         DungeonPad(($topLeft[0]+298),($topLeft[1]+320))
  2273.  
  2274.         DungeonPad(($topLeft[0]+81),($topLeft[1]+91))
  2275.     EndIf
  2276.  
  2277.     If $ArenaNumber = 4 Then
  2278.         ; starting from Shikaakwa - return to DFA
  2279.         DungeonPad2(($topLeft[0]+705),($topLeft[1]+429))
  2280.  
  2281.         DungeonPad2(($topLeft[0]+586),($topLeft[1]+465))
  2282.  
  2283.         DungeonPad2(($topLeft[0]+705),($topLeft[1]+453))
  2284.  
  2285.         DungeonPad(($topLeft[0]+705),($topLeft[1]+260))
  2286.  
  2287.         DungeonPad(($topLeft[0]+704),($topLeft[1]+140))
  2288.  
  2289.         DungeonPad(($topLeft[0]+497),($topLeft[1]+440))
  2290.  
  2291.         DungeonPad(($topLeft[0]+391),($topLeft[1]+461))
  2292.  
  2293.         DungeonPad(($topLeft[0]+392),($topLeft[1]+461))
  2294.  
  2295.         DungeonPad(($topLeft[0]+439),($topLeft[1]+461))
  2296.  
  2297.         DungeonPad(($topLeft[0]+199),($topLeft[1]+462))
  2298.  
  2299.         DungeonPad(($topLeft[0]+704),($topLeft[1]+306))
  2300.  
  2301.         DungeonPad(($topLeft[0]+703),($topLeft[1]+233))
  2302.  
  2303.         DungeonPad2(($topLeft[0]+704),($topLeft[1]+401))
  2304.  
  2305.         DungeonPad(($topLeft[0]+704),($topLeft[1]+232))
  2306.  
  2307.         DungeonPad2(($topLeft[0]+711),($topLeft[1]+401))
  2308.  
  2309.         DungeonPad(($topLeft[0]+344),($topLeft[1]+221))
  2310.  
  2311.         DungeonPad(($topLeft[0]+81),($topLeft[1]+94))
  2312.     EndIf
  2313.  
  2314.     If $ArenaNumber = 5 Then
  2315.         ; starting from Shikaakwa - return to BRA
  2316.         DungeonPad2(($topLeft[0]+705),($topLeft[1]+429))
  2317.  
  2318.         DungeonPad2(($topLeft[0]+586),($topLeft[1]+465))
  2319.  
  2320.         DungeonPad2(($topLeft[0]+705),($topLeft[1]+453))
  2321.  
  2322.         DungeonPad(($topLeft[0]+705),($topLeft[1]+260))
  2323.  
  2324.         DungeonPad(($topLeft[0]+704),($topLeft[1]+140))
  2325.  
  2326.         DungeonPad(($topLeft[0]+706),($topLeft[1]+284))
  2327.  
  2328.         DungeonPad(($topLeft[0]+154),($topLeft[1]+176))
  2329.  
  2330.         DungeonPad(($topLeft[0]+81),($topLeft[1]+93))
  2331.     EndIf
  2332.  
  2333.     If $ArenaNumber = 6 Then
  2334.         ; starting from Shikaakwa - return to CWA
  2335.         DungeonPad(($topLeft[0]+321),($topLeft[1]+94))
  2336.  
  2337.         DungeonPad(($topLeft[0]+347),($topLeft[1]+105))
  2338.  
  2339.         DungeonPad2(($topLeft[0]+31),($topLeft[1]+384))
  2340.  
  2341.         DungeonPad2(($topLeft[0]+32),($topLeft[1]+214))
  2342.  
  2343.         DungeonPad2(($topLeft[0]+33),($topLeft[1]+359))
  2344.  
  2345.         DungeonPad(($topLeft[0]+465),($topLeft[1]+96))
  2346.  
  2347.         DungeonPad(($topLeft[0]+201),($topLeft[1]+300))
  2348.  
  2349.         DungeonPad(($topLeft[0]+57),($topLeft[1]+251))
  2350.     EndIf
  2351.  
  2352.     If $ArenaNumber = 7 Then
  2353.         ; starting from Shikaakwa - return to UWA
  2354.         DungeonPad2(($topLeft[0]+705),($topLeft[1]+430))
  2355.  
  2356.         DungeonPad2(($topLeft[0]+585),($topLeft[1]+467))
  2357.  
  2358.         DungeonPad2(($topLeft[0]+705),($topLeft[1]+453))
  2359.  
  2360.         DungeonPad(($topLeft[0]+705),($topLeft[1]+263))
  2361.  
  2362.         DungeonPad(($topLeft[0]+704),($topLeft[1]+142))
  2363.  
  2364.         DungeonPad(($topLeft[0]+705),($topLeft[1]+287))
  2365.  
  2366.         DungeonPad(($topLeft[0]+705),($topLeft[1]+215))
  2367.  
  2368.         DungeonPad(($topLeft[0]+177),($topLeft[1]+95))
  2369.  
  2370.         DungeonPad(($topLeft[0]+705),($topLeft[1]+166))
  2371.  
  2372.         DungeonPad(($topLeft[0]+538),($topLeft[1]+82))
  2373.  
  2374.         DungeonPad(($topLeft[0]+33),($topLeft[1]+376))
  2375.  
  2376.         DungeonPad(($topLeft[0]+33),($topLeft[1]+351))
  2377.  
  2378.         DungeonPad2(($topLeft[0]+32),($topLeft[1]+400))
  2379.  
  2380.         DungeonPad(($topLeft[0]+33),($topLeft[1]+257))
  2381.  
  2382.         DungeonPad2(($topLeft[0]+489),($topLeft[1]+460))
  2383.  
  2384.         DungeonPad(($topLeft[0]+33),($topLeft[1]+280))
  2385.  
  2386.         DungeonPad(($topLeft[0]+273),($topLeft[1]+88))
  2387.  
  2388.         DungeonPad(($topLeft[0]+32),($topLeft[1]+311))
  2389.     EndIf
  2390.  
  2391.     If $ArenaNumber = 8 Then
  2392.         ; starting from Shikaakwa - return to PGA
  2393.         ; 137, 121
  2394.         ; dungeonpad - bottom right
  2395.         ; dungeonpad2 - top right
  2396.         ;DungeonPad2(458, 216)
  2397.  
  2398.         ;DungeonPad2(482, 228)
  2399.  
  2400.         ;DungeonPad2(841, 578)
  2401.  
  2402.         ;DungeonPad2(457, 216)
  2403.  
  2404.         ;DungeonPad2(842, 505)
  2405.  
  2406.         ;DungeonPad2(601, 217)
  2407.  
  2408.         ;DungeonPad2(338, 276)
  2409.  
  2410.         ;DungeonPad2(842, 407)
  2411.  
  2412.         ;DungeonPad2(842, 384)
  2413.  
  2414.         ;DungeonPad2(841, 504)
  2415.  
  2416.         ;DungeonPad2(506, 216)
  2417.  
  2418.         ;DungeonPad2(554, 217)
  2419.  
  2420.         ;DungeonPad2(697, 217)
  2421.  
  2422.         ;DungeonPad2(602, 216)
  2423.  
  2424.         ;DungeonPad2(506, 217)
  2425.  
  2426.         ;DungeonPad2(171, 385)
  2427.  
  2428.         ;DungeonPad2(482, 589)
  2429.  
  2430.         ;DungeonPad2(530, 324)
  2431.     EndIf
  2432. EndFunc
  2433.  
  2434. Func CharClickCheck()
  2435.     ; if character box is found, clicks on cancel, returns 1
  2436.     ; if no box found, returns 0
  2437.     $cccCount = 0
  2438.     For $cccx = 40 to 90
  2439.         For $cccy = 297 to 337
  2440.             $ClickCheck = PixelGetColor($topLeft[0]+$cccx, $topLeft[1]+$cccy)
  2441.             If $ClickCheck < 15728640 Then
  2442.                 $cccCount = $cccCount + 1
  2443.                 If $cccCount > 5 Then
  2444.                     Return (0)
  2445.                     ;$cccy = 454
  2446.                     ;$cccx = 98
  2447.                 EndIf
  2448.             EndIf
  2449.         Next
  2450.     Next
  2451.     ; Click to cancel window
  2452.     MouseMove ($topLeft[0]+318,$topLeft[1]+95,1)
  2453.     MouseClick("left")
  2454.     Return (1)
  2455. EndFunc
  2456.  
  2457. Func CharMove($x, $y)
  2458.     ; clicks on a non-pad area
  2459.     ; checks for character click check
  2460.     MouseMove($x, $y, 3)
  2461.     If $TurboCheck = 0 Then
  2462.         Sleep(100)
  2463.     Else
  2464.         Sleep(20)
  2465.     EndIf
  2466.     MouseClick("left")
  2467.     While CharClickCheck() = 1
  2468.         MouseMove($x, $y, 3)
  2469.         Sleep(100)
  2470.         MouseClick("left")
  2471.         Sleep(100)
  2472.     WEnd
  2473. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment