Advertisement
Guest User

Sacred Seasons Bot v1.6

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