Guest User

Sacred Seasons Bot 1.3.4

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