Advertisement
Guest User

Sacred Seasons Dunes version bot

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