Guest User

Sacred Seasons Bot 1.3.3

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