Advertisement
djvj

Untitled

Apr 9th, 2011
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 4.32 KB | None | 0 0
  1. Global $Battle_Mobs[11][2] = [[$xBattle_Mob_Left_1,$yBattle_mob], [$xBattle_Mob_Left_2,$yBattle_mob], [$xBattle_Mob_Left_3,$yBattle_mob], [$xBattle_Mob_Left_4,$yBattle_mob], [$xBattle_Mob_Left_5,$yBattle_mob], [$xBattle_Mob_Mid,$yBattle_mob], [$xBattle_Mob_Right_1,$yBattle_mob], [$xBattle_Mob_Right_2,$yBattle_mob], [$xBattle_Mob_Right_3,$yBattle_mob], [$xBattle_Mob_Right_4,$yBattle_mob], [$xBattle_Mob_Right_5,$yBattle_mob]] ; our itemslot array while hunting
  2.  
  3. Func Battle()
  4.     If Hex(PixelGetColor($xBattle_start_1,$yBattle_start_1),6) = $Battle_start_color_1 and Hex(PixelGetColor($xBattle_start_2,$yBattle_start_2),6) = $Battle_start_color_2 Then ;checking to see if we are in battle
  5.         $BattleCounter = $BattleCounter + 1
  6.         ToolTip('In battle #' & $BattleCounter,0,25)
  7.         FileWriteLine($Log, @Hour & ":" & @Min & ":" & @Sec & " -- Starting Battle")
  8.         Do ;If we don't have this Do loop, the $BattleCounter will keep incrementing, prevents us from leaving the battle function until battle is actually over
  9.             InventoryFull()
  10.             If $CanCurePoison = "yes" Then
  11.                 CheckBattlePoison($PartySpot) ; checking if self is poisoned
  12.                 If $IsGroupHealer = "yes" Then
  13.                     CheckBattlePoison($PartySpot_P2) ; checking if 2nd player is poisoned
  14.                     CheckBattlePoison($PartySpot_P3) ; checking if 3rd player is poisoned
  15.                 EndIf
  16.             EndIf
  17.             CheckBattleHealth($PartySpot) ; checking if self is low on health
  18.             StopWhenLowHealth() ; health is low, if we need to stop the script because we can't heal, now is the time
  19.             If $IsGroupHealer = "yes" Then
  20.                 CheckBattleHealth($PartySpot_P2) ; checking if 2nd player is low on health
  21.                 CheckBattleHealth($PartySpot_P3) ; checking if 3rd player is low on health
  22.             EndIf
  23.             ;CastBuff() ;future function to cast a buff at start of battle
  24.             If Hex(PixelGetColor($xAttack,$yAttack),6) = $Attack_color and Hex(PixelGetColor($xAbility,$yAbility),6) = $Ability_color Then ;checking to see either attack or ability icons have turned pink yet to show we are ready to attack
  25.                 Select
  26.                     Case $AttackStyle = "melee"
  27.                         MeleeAttack()
  28.                     Case $AttackStyle = "magic"
  29.                         MagicAttack()
  30.                     Case $AttackStyle = "custom"
  31.                         CustomAttack()
  32.                 EndSelect
  33.                 If Hex(PixelGetColor($xBattle_start_1,$yBattle_start_1),6) <> $Battle_start_color_1 and Hex(PixelGetColor($xBattle_start_2,$yBattle_start_2),6) <> $Battle_start_color_2 Then ;this breaks out of the battle function at the end of battle and prevents accidental clicks after battle
  34.                     Return
  35.                 EndIf
  36.                 Sleep (100)
  37.                 Local $boxArr[20][2]
  38.                 Select
  39.                     Case $BattleMobs = "single" ;Use when hunting in an area that you will battle only 1 mob
  40.                         If Hex(PixelGetColor($xBattle_Mid_mob,$yBattle_Mid_mob),6) <> "000000" Then
  41.                             MouseMove($xBattle_Mid_mob,$yBattle_Mid_mob) ;click to attack middle monster
  42.                             MouseDown("left")
  43.                             MouseUp("left")
  44.                             Sleep (500)
  45.                             MouseDown("left")
  46.                             MouseUp("left")
  47.                             Sleep (500)
  48.                             MouseDown("left") ;clicking again, sometimes lag misses the first click
  49.                             MouseUp("left")
  50.                         EndIf
  51.  
  52.                     Case $BattleMobs = "multiple" ;Use when hunting in an area that you will battle more then 1 mob
  53.                         Select
  54.                             Case $ReverseAttackOrder = "no"
  55.                                 for $i = 0 to 10
  56.  
  57.                                     if searchBoxForNotColor($Battle_Mobs[$i][0], $Battle_Mobs[$i][1], "000000") == 1 Then
  58.                                         functionToclickOnTheSpot($Battle_Mobs[$i][0],$Battle_Mobs[$i][1])
  59.                                         ExitLoop
  60.                                     Endif
  61.  
  62.                                 next
  63.  
  64.                             Case $ReverseAttackOrder = "yes"
  65.                                 for $i = 10 to 0 Step -1
  66.  
  67.                                     if searchBoxForNotColor($Battle_Mobs[$i][0], $Battle_Mobs[$i][1], "000000") == 1 Then
  68.                                         functionToclickOnTheSpot($Battle_Mobs[$i][0],$Battle_Mobs[$i][1])
  69.                                         ExitLoop
  70.                                     Endif
  71.  
  72.                                 next
  73.                         EndSelect
  74.                 EndSelect
  75.             EndIf
  76.             InventoryFull()
  77.         Until Hex(PixelGetColor($xBattle_start_1,$yBattle_start_1),6) <> $Battle_start_color_1 and Hex(PixelGetColor($xBattle_start_2,$yBattle_start_2),6) <> $Battle_start_color_2
  78.     EndIf
  79. EndFunc
  80.  
  81.  
  82. Func searchBoxForNotColor($x, $y, $color)
  83.     $xStart = $x
  84.     $yStart = $y
  85.     $xEnd = $x + 50
  86.     $yEnd = $y + 50
  87.  
  88.     for $xBattle_Left1_mob= $xStart to $xEnd
  89.          for $yBattle_Left1_mob= $yStart to $yEnd
  90.               If PixelGetColor($xBattle_Left1_mob,$yBattle_Left1_mob) <> $color Then
  91.                 return 1
  92.               Endif
  93.          next
  94.     next
  95.  
  96.     return 0
  97. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement