|
Ok, this is the first stage of my rewrite, just fixed some of the small easy stuff for now, will be doing some more reading befor I go on. If you know whats what, feel free point out stuff that needs to be changed (just make sure you inclued how/what to change)
Option Explicit
' be sure to click OUTSIDE the window before 3 seconds is up
' Auto-Fighter scripting,
' written by notme, With help from all the posters on another 3rd party app Forum.
' Re-written by MaximusDM, With help from all the posters at xunleashed
'---------------------------------------------------------------------------
Pause (3000)
Const RessurectedSTR = "You have been resurrected by"
Const NoArrowsSTR = "You must Select a quiver slot to draw from!"
Const PrepareShot = "You prepare your shot"
Const NoCritshotSTR = "re too tired to perform a critical shot!"
Const YouMissSTR = "You miss!"
Const StopAimSTR = "re too tired to hold your shot any longer!"
Const FatiguedSTR = "re too tired to use your"
Const TiredSTR = "You are too fatigued to perform"
Const YouHitSTR = "with your bow and hit For"
Const CannotSeeSTR = "see your target!"
Const ParrySTR = "attacks you and you parry the blow!"
Const Style1STR = "attacks you and you block the blow!"
Const Style2STR = "You perform your black widow perfectly"
Const HitsYouSTR = "hits your"
Const MissesYouSTR = "attacks you and misses!"
Const YouFumbleSTR = "You fumble the attack and take time to recover!"
Const MonsDiesSTR = "You are no longer auto-following your target."
Const YouDiedSTR = "You have died. Type /release to return to you last bind point."
Const NoMonsterSTR = "No monster target in range."
Const ToFarFaceSTR = "is too far away to auto-face!"
Const ToFarStickSTR = "is too far away to auto-stick!"
Const ShotInterruptedSTR = "is attacking you and your shot is interrupted!"
Const TrantulaSTR = "You perform your Tarantula perfectly."
Const SidewinderSTR = "You perform your Sidewinder perfectly."
Const DiamondbackSTR = "You perform your Diamondback perfectly."
'---------------------------------------------------------------------------
Const PlayerPixels = 89
Const TargetPixels = 89
Const SafetyPixelsINT = 20 ' out of 89
Const HealNowPixelsINT = 9 ' out of 89
Const MonsterPixelsINT = 10 ' out of 89
Const PlayerWinX = 1472 ' can be found in INI of your character
Const PlayerWinY = 1104 ' can be found in INI of your character
'---------------------------------------------------------------------------
Const _ALL = 0
Const _Health = 1
Const _STAMINA = 2
Const _MANA = 3
Const _TARGET = 4
Const _MONSTERCON = 5
'---------------------------------------------------------------------------
Dim LogText1, LogText2, LogText3, LogText4
Dim OrigMarker
Dim LogMarker1, LogMarker2, LogMarker3, LogMarker4
'---------------------------------------------------------------------------
Dim CannotSee, YouHit, YouFumble, ShotInterrupted, Fatigued, YouMiss, StopAim, NoArrows
Dim MonsDies, YouDied, HitsYou, Parry, Style1B, Style2B, MustHaveTarget
'---------------------------------------------------------------------------
Private Sub Sit() 'Procedure Sit
begin
sendkeys ("/sit<CR>")
Pause (150)
End Sub
Private Sub Stand() 'Procedure Stand
begin
SendKeys ("/stand<CR>")
Pause (150)
End Sub
Private Sub LogOut() 'Procedure LogOut
begin
SendKeys ("/release<CR>")
Pause (1000)
SendKeys ("/quit<CR>")
Pause (1000)
End Sub
'---------------------------------------------------------------------------
' WatchStatus procedure speeds up the reading from the correct area of the screen
' Give the status you will be looking For and a boolean to turn it on or off
Private Function WatchStatus(Status, Activate)
begin
If (Activate) Then begin
If ((Status = _Health) or (Status = _ALL)) Then AddScreenWatch(PlayerWinX+31,PlayerWinY+24,PlayerPixels,1)
If ((Status = _STAMINA) or (Status = _ALL)) Then AddScreenWatch(PlayerWinX+31,PlayerWinY+34,PlayerPixels,1)
If ((Status = _MANA) or (Status = _ALL)) Then AddScreenWatch(PlayerWinX+31,PlayerWinY+45,PlayerPixels,1)
If ((Status = _Target) or (Status = _ALL)) Then AddScreenWatch(PlayerWinX+31,PlayerWinY+90,TargetPixels,1)
End Else begin
If ((Status = _Health) or (Status = _ALL)) Then DeleteScreenWatch(PlayerWinX+31,PlayerWinY+24,PlayerPixels,1)
If ((Status = _STAMINA) or (Status = _ALL)) Then DeleteScreenWatch(PlayerWinX+31,PlayerWinY+34,PlayerPixels,1)
If ((Status = _MANA) or (Status = _ALL)) Then DeleteScreenWatch(PlayerWinX+31,PlayerWinY+45,PlayerPixels,1)
If ((Status = _Target) or (Status = _ALL)) Then DeleteScreenWatch(PlayerWinX+31,PlayerWinY+90,TargetPixels,1)
End
End Function
'---------------------------------------------------------------------------
' GetStatusPixel Function is used by GetStatus.
' It returns True If the X-th pixel of that status is filled.
' Examples:
' FullMana:=GetStatusPixel(_MANA,PlayerPixels-1)
' TargetAtHalf:=GetStatusPixel(_TARGET,TargetPixels/2)
' OutOfStamina:=GetStatusPixel(_STAMINA,0)
Private Function GetStatusPixel(Status, Pos)
Dim Red, Blue, Green
begin
If (Status = _Health) Then begin
GetPixelColor(PlayerWinX+31+Pos,PlayerWinY+24,Red,Green,Blue)
If ((Red/2)>Green) and ((Red/3)>Blue) and (Red > 100) Then Result = True Else Result = False
End
If (Status = _STAMINA) Then begin
GetPixelColor(PlayerWinX+31+Pos,PlayerWinY+34,Red,Green,Blue)
If ((Green*2)>(Red*5)) and ((Green*3)>(Blue*5)) Then Result = True Else Result = False
End
If (Status = _MANA) Then begin
GetPixelColor(PlayerWinX+31+Pos,PlayerWinY+45,Red,Green,Blue)
If ((Red*2)>(Blue*5)) and ((Green*2)>(Blue*5)) Then Result = True Else Result = False
End
If (Status = _Target) Then begin
GetPixelColor(PlayerWinX+31+Pos,PlayerWinY+90,Red,Green,Blue)
If ((Red/2)>Green) and ((Red/3)>Blue) and (Red > 100) Then Result = True Else Result = False
End
End Function
Private Function GetStatus(Status) ' Function GetStatus returns the Status you chose as a float between 0 and 1
Dim Border(1, 3)
Dim Bordertype(1, 3)
Dim Bool, CurHP, Step, Dir
begin
Border(1) = 0
If (Status = _Target) Then Border(3) = TargetPixels Else Border(3]) = PlayerPixels
Bordertype(1) = True
Bordertype(3) = False
CurHP = Border(3) -1
Dir = -1
repeat
Step = Trunc( ((Border(Dir + 2) - CurHP) / 2) + (Dir * 0.55) )
CurHP = (CurHP + Step)
Bool = GetStatusPixel(Status, CurHP)
If (Bool = True) Then Border(1) = CurHP Else Border(3) = CurHP
If (Bool = Bordertype(Dir + 2)) Then Dir = (Dir * -1)
Until (Border(1) = Border(3) -1)
If (Status = _Target) Then begin
Result = Border(1)
End Else begin
Result = Border(1)
End
End
'---------------------------------------------------------------------------
Private Function GetCon() ' This Function gets the monsters con
Dim Red, Green, Blue, GrayB, GreenB, BlueB, YellowB, OrangeB, RedB, PurpleB, PosX, PosY
Begin
PosX = 0
PosY = 0
repeat ' Set one
AddScreenWatch(PlayerWinX+7,PlayerWinY+73,5,5) ' Target name bar
repeat ' Set two
GetPixelColor(PlayerWinX+7+PosX,PlayerWinY+73+PosY,Red,Green,Blue)
If (Red = 168) and (Green = 168) and (Blue = 168) Then GrayB = True Else GrayB = False ' gray con, should never be Set to True
If (Red = 152) and (Green = 240) and (Blue = 128) Then GreenB = True Else GreenB = False ' Green con, Set to True For low xp
If (Red = 104) and (Green = 100) and (Blue = 255) Then BlueB = True Else BlueB = False ' Blue con, the most likely setting to True
If (Red > 200) and (Green > 200) and (Blue < 50) Then YellowB = True Else YellowB = False ' yellow con,hard For a bot to kill, but maybe
If (Red > 200) and (Green > 100) and (Green < 200) and (Blue<100) Then OrangeB = True Else OrangeB = False ' orange con, should never Set to True,
If (Red = 248) and (Green = 0) and (Blue = 0) Then RedB = True Else RedB = False ' Red con, should never Set to True
If (Red = 176) and (Green = 80) and (Blue = 255) Then PurpleB = True Else PurpleB = False ' purple con, should never be Set to True
If (GreenB = True) or (BlueB = True) or (YellowB = True) or (OrangeB = True) Then Result = True Else Result = False
PosX:=PosX+1
Until (PosX=6) or (Result=True) ' Set two
PosY = (PosY + 1)
PosX = 0
Until (PosY = 3) or (Result = True) ' Set one
DeleteScreenWatch(PlayerWinX+7,PlayerWinY+73,5,5) ' target name bar
End Function ' Proceedure GetCon
'---------------------------------------------------------------------------
Private Sub TargetMonster() ' This procedure targets a monster
Dim Bool
begin 'Procedure TargetMonster
Bool = False
Stand
Repeat
Pause (60000)
SendKeys ("<F8>")
pause (500)
Bool = GetCon
Until (Bool = True)
SendKeys ("/face<CR>")
pause (500)
End Sub 'Procedure TargetMonster
'---------------------------------------------------------------------------
Private Sub Ressurection() ' This procedure will accept a Ressurection
Dim RessurectionTries
Begin
RessurectionTries = 0
LogMarker1 = SetLogMarker
Repeat
SendKeys ("l")
Pause (250)
SendKeys ("l")
Pause (750) ' Resets the log
MouseMove(762, 543)
WaitForMouse ' Lets the mouse catch up to the move
MouseDown(0) ' Left click
MouseMove(762, 543)
WaitForMouse ' Lets the mouse catch up to the move
MouseUp(0) ' Left click
LogText1 = GetNewLogText(LogMarker1)
If (HasToken(LogText1, RessurectedSTR)) Then YouDied = False Else YouDied = True
RessurectionTries = RessurectionTries + 1
Until (YouDied = False) or (RessurectionTries = 300)
If (RessurectionTries = 300) Then LogOut
Pause (30000) ' Waits five minutes For the Ressurection effects to wear off
End Sub ' Proceedure Ressurection
'---------------------------------------------------------------------------
Private Sub FireBow() ' This procedure fires characters bow
Dim Bool1, Bool2, Shots
begin 'Procedure FireBow
Shots = 0
SendKeys ("l")
Pause (250)
SendKeys ("l")
Pause (75) ' Resets the log
Bool1 = False
Bool2 = False
CannotSee = False
YouHit = False
YouFumble = False
ShotInterrupted = False
Fatigued = False
YouMiss = False
StopAim = False
NoArrows = False
YouDied = False
MonsDies = False
SendKeys ("3")
pause (75) ' Selects melee weapon to ensure proper firing sequence
SendKeys ("1")
pause (75) ' Selects the bow
SendKeys ("2") ' Takes aim With the bow replace With a 2 For critshot
' this should keep firing the bow
Repeat
If (Bool1 = True) Then SendKeys ("l")
Pause (250)
If (Bool1 = True) Then SendKeys ("l")
Pause (250) ' Resets the log
SendKeys ("1")
pause (250) ' Fires when ready
SendKeys ("1")
pause (250) ' Sets the bow to auto reload
LogMarker1 = SetLogMarker
' This should keep checking the log to see whats happening
Repeat
LogText1 = GetNewLogText(LogMarker1)
If (HasToken(LogText1, CannotSeeSTR)) Then CannotSee = True Else CannotSee = False
If (HasToken(LogText1, YouHitSTR)) Then YouHit = True Else YouHit alse
If (HasToken(LogText1, YouFumbleSTR)) Then YouFumble = True Else YouFumble = False
If (HasToken(LogText1, ShotInterruptedSTR)) Then ShotInterrupted = True Else ShotInterrupted = False
If (HasToken(LogText1, FatiguedSTR))Then Fatigued = True Else Fatigued = False
If (HasToken(LogText1, YouMissSTR)) Then YouMiss = True Else YouMiss = False
If (HasToken(LogText1, StopAimSTR)) Then StopAim = True Else StopAim = False;
If (HasToken(LogText1, NoArrowsSTR)) Then NoArrows = True Else NoArrows = False
If (CannotSee = True) or (YouHit = True) or (YouFumble = True) or (ShotInterrupted = True) or (Fatigued = True) or
(YouMiss = True) or (StopAim = True) or (YouDied = True) or (MonsDies = True) or
(CannotSee = True) Then Bool1 = True Else Bool1 = False
If (NoArrows = True) Then LogOut
Until (Bool1 = True)
Shots = Shots + 1
If (CannotSee = True) Then TargetMonster
If (YouDied = True) Then Ressurection
If (YouDied = True) or (MonsDies = True) or (ShotInterrupted = True) or
(Fatigued = True) or (Shots = 2) Then Bool2 = True Else Bool2 = False
Until (Bool2 = True)
End Sub 'Procedure FireBow
'---------------------------------------------------------------------------
Private Sub BeginMelee () ' This procedure begins melee
begin ' Procedure BeginMelee
SendKeys ("/face<CR>")
Pause (150) ' Double checks that you are facing opponent
SendKeys ("3")
Pause (150) ' Selects melee weapon right hand
SendKeys ("4")
Pause (150) ' Selects the melee item weapon or shield left hand
SendKeys ("a")
Pause (150) ' Is keyboard default attack key
End Sub ' Procedure beginmelee
'---------------------------------------------------------------------------
Private Sub Style1() ' This procedure executes style one
begin Procedure style1
SendKeys ("5") ' Uses gem
End Sub ' Procedure Style1
'---------------------------------------------------------------------------
Private Sub Style2() ' This procedure executes style two
begin ' Procedure style2
SendKeys ("6") ' Uses gem
End Sub ' Procedure Style2
'---------------------------------------------------------------------------
Private Sub HealMeNow()
Begin
SendKeys ("8") ' Make sure to have a macro that sends a tell "heal me" to your partner
End Sub
'---------------------------------------------------------------------------
Private Function CheckForAdd()
Begin
LogMarker2 = SetLogMarker
SendKeys ("l")
Pause (250)
SendKeys ("l")
Pause (150) ' resets the log
Pause (5000)
LogText2 = GetNewLogText(LogMarker2)
If (HasToken(LogText2, MissesYouSTR)) or
(HasToken(LogText2, HitsYouSTR)) or
(HasToken(LogText2, Style2STR)) or
(HasToken(LogText2, Style1STR)) Then Result = True
End Function
'---------------------------------------------------------------------------
Private Sub DoMelee()
Dim Health, Target
Begin
YouHit = False
YouFumble = False
Fatigued = False
YouMiss = False
Parry = False
Style1B = False
Style2B = True
YouDied = False
MonsDies = False
MustHaveTarget = False
LogMarker2 = SetLogMarker ' This log marker does Not reset For entire fight.
LogMarker3 = SetLogMarker ' This log marker should reset For Each run through Until.
repeat
If (Style2B = True) Then SendKeys ("l")
Pause (250)
If (Style2B = True) Then SendKeys ("l")
Pause (925) ' resets the log
LogText3 = GetNewLogText(LogMarker3)
If (HasToken(LogText3, YouHitSTR)) Then YouHit = True Else YouHit = False
If (HasToken(LogText3, YouFumbleSTR)) Then YouFumble = True Else YouFumble = False
If (HasToken(LogText3, HitsYouSTR))Then HitsYou = True Else HitsYou = False
If (HasToken(LogText3, YouMissSTR)) Then YouMiss = True Else YouMiss = False;
If (HasToken(LogText3, ParrySTR )) Then Parry = True Else Parry = False
If (HasToken(LogText3, Style1STR)) Then Style1B = True Else Style1B = False
If (HasToken(LogText3, Style2STR)) Then Style2B = True Else Style2B = False
If (HasToken(LogText3, MustHaveTargetSTR)) Then MustHaveTarget = True Else MustHaveTarget = False
If (Style2B=True) Then Style2 Else Style1 ' will append later
Health = GetStatus(_Health)
Target = GetStatus(_Target)
If (Health < SafetyPixelsINT) and (Target > MonsterPixelsINT) Then HealMeNow
If (Health < HealNowPixelsINT) Then HealMeNow
LogText2 = GetNewLogText(LogMarker2)
If (HasToken(LogText2, YouDiedSTR)) Then YouDied = True Else YouDied = False
LogMarker3 = SetLogMarker
Until (HasToken(LogText2, MustHaveTargetSTR)) or (HasToken(LogText2, YouDiedSTR)) or
(HasToken(LogText2, MonsDiesSTR))
End Sub
'---------------------------------------------------------------------------
Private Sub Recover()
Dim FullStamina, FullHealth
Begin
Sit
repeat
If (YouDied = True) Then Ressurection
FullStamina = GetStatusPixel(_STAMINA,PlayerPixels-1)
FullHealth = GetStatusPixel(_Health,PlayerPixels-1)
If (FullHealth = False) Then HealMeNow
If (FullStamina = False) or (FullHealth = False) Then Pause (5000)
Until (FullStamina = True) and (FullHealth = True) and (YouDied=False)
Stand
End Sub
'---------------------------------------------------------------------------
While True Do begin
Stand
TargetMonster
FireBow
Repeat
BeginMelee
DoMelee
CheckForAdd
Until (CheckForAdd = False)
Recover
' Loot ' Not implemented yet
End
I'll update this post when i do major updates.
|