Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
- Func Battle()
- 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
- $BattleCounter = $BattleCounter + 1
- ToolTip('In battle #' & $BattleCounter,0,25)
- FileWriteLine($Log, @Hour & ":" & @Min & ":" & @Sec & " -- Starting Battle")
- 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
- InventoryFull()
- If $CanCurePoison = "yes" Then
- CheckBattlePoison($PartySpot) ; checking if self is poisoned
- If $IsGroupHealer = "yes" Then
- CheckBattlePoison($PartySpot_P2) ; checking if 2nd player is poisoned
- CheckBattlePoison($PartySpot_P3) ; checking if 3rd player is poisoned
- EndIf
- EndIf
- CheckBattleHealth($PartySpot) ; checking if self is low on health
- StopWhenLowHealth() ; health is low, if we need to stop the script because we can't heal, now is the time
- If $IsGroupHealer = "yes" Then
- CheckBattleHealth($PartySpot_P2) ; checking if 2nd player is low on health
- CheckBattleHealth($PartySpot_P3) ; checking if 3rd player is low on health
- EndIf
- ;CastBuff() ;future function to cast a buff at start of battle
- 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
- Select
- Case $AttackStyle = "melee"
- MeleeAttack()
- Case $AttackStyle = "magic"
- MagicAttack()
- Case $AttackStyle = "custom"
- CustomAttack()
- EndSelect
- 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
- Return
- EndIf
- Sleep (100)
- Local $boxArr[20][2]
- Select
- Case $BattleMobs = "single" ;Use when hunting in an area that you will battle only 1 mob
- If Hex(PixelGetColor($xBattle_Mid_mob,$yBattle_Mid_mob),6) <> "000000" Then
- MouseMove($xBattle_Mid_mob,$yBattle_Mid_mob) ;click to attack middle monster
- MouseDown("left")
- MouseUp("left")
- Sleep (500)
- MouseDown("left")
- MouseUp("left")
- Sleep (500)
- MouseDown("left") ;clicking again, sometimes lag misses the first click
- MouseUp("left")
- EndIf
- Case $BattleMobs = "multiple" ;Use when hunting in an area that you will battle more then 1 mob
- Select
- Case $ReverseAttackOrder = "no"
- for $i = 0 to 10
- if searchBoxForNotColor($Battle_Mobs[$i][0], $Battle_Mobs[$i][1], "000000") == 1 Then
- functionToclickOnTheSpot($Battle_Mobs[$i][0],$Battle_Mobs[$i][1])
- ExitLoop
- Endif
- next
- Case $ReverseAttackOrder = "yes"
- for $i = 10 to 0 Step -1
- if searchBoxForNotColor($Battle_Mobs[$i][0], $Battle_Mobs[$i][1], "000000") == 1 Then
- functionToclickOnTheSpot($Battle_Mobs[$i][0],$Battle_Mobs[$i][1])
- ExitLoop
- Endif
- next
- EndSelect
- EndSelect
- EndIf
- InventoryFull()
- 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
- EndIf
- EndFunc
- Func searchBoxForNotColor($x, $y, $color)
- $xStart = $x
- $yStart = $y
- $xEnd = $x + 50
- $yEnd = $y + 50
- for $xBattle_Left1_mob= $xStart to $xEnd
- for $yBattle_Left1_mob= $yStart to $yEnd
- If PixelGetColor($xBattle_Left1_mob,$yBattle_Left1_mob) <> $color Then
- return 1
- Endif
- next
- next
- return 0
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement