Jump to content

Script logic problems


Recommended Posts

Hi guys! I have a problem with my script here. It should be quite easy but the issue I am having is that my character press TAB when it should not. Look at script and tell me what is wrong, I have rewritten it a couple of times so it probably looks worse than from start with some added sleep etc:

HotKeySet ("{ESC}", "_exit")
HotKeySet ("{F12}", "_pause")
 
#include "NoMadMemory.AU3"
 
$ID=_MemoryOpen(0x00001484)
$Address= 0x02EE20DC ;Player HP
$Address5= 0x02EE7AAC ;Player Max HP
$Address2= 0x02ED54AC ;CTU energy
$Address3= 0x02EE7AE4 ;Enemy HP
$Address6= 0x02EE7AF4 ;Enemy Max HP
$Address4= 0x02ED9A94 ;CTU HP
 
$HP=_MemoryRead($Address,$ID)
$enemyHP=_MemoryRead($Address3,$ID)
$enemyMAX=_MemoryRead($Address6,$ID)
 
WinActivate("Bounty Hounds Online 1.094.41")
 
While 1
_Fight() ;Start fighting enemy
If $enemyHP = 0 Then
_Switch() ;If enemy is dead switch to next target
EndIf
WEnd
 
Func _exit()
    Exit
EndFunc
 
Func _pause()
    while 1
    Sleep(9999999)
WEnd
EndFunc
 
Func _Fight()
If $HP > 500 And $enemyHP = $enemyMAX Then
  Sleep(50)
  _Attack() ;Start attacking because enemy has full health and you enough
ElseIf $HP > 500 And $enemyHP < $enemyMAX Then
  Sleep(50)
  _Attack() ;Keep attacking
ElseIf $HP < 500 Then ;If HP to low, do nothing
  _noFight()
   EndIf
EndFunc
 
Func _Attack() ;Attack sequence
Sleep(30)
Send("2")
Sleep(10)
Send("2")
Sleep(10)
Send("2")
Sleep(10)
Send("4")
Sleep(10)
Send("3")
Sleep(10)
EndFunc
 
Func _Switch() ;Wait a little and then switch to next target, if current target is dead
Sleep(200)
If $enemyHP = 0 Then
Send("{TAB}")
Sleep(50)
Send("z")
Sleep(10)
Send("z")
Sleep(10)
Send("z")
Sleep(10)
Send("z")
Sleep(50)
ElseIf $HP < 500 Then
_Fight()
EndIf
EndFunc
 
Func _noFight()
while 1
WEnd
EndFunc

I have set the if enemy hp is zero, then switch with TAB but it switches before that

Edited by pixellegolas
Link to comment
Share on other sites

$ID=_MemoryOpen(0x00001484)
$Address= 0x02EE20DC ;Player HP
$Address5= 0x02EE7AAC ;Player Max HP
$Address2= 0x02ED54AC ;CTU energy
$Address3= 0x02EE7AE4 ;Enemy HP
$Address6= 0x02EE7AF4 ;Enemy Max HP
$Address4= 0x02ED9A94 ;CTU HP

Player energy ? HP?

You should read forum rules.

Sorry for my bad English but nobody is perfect. [font=arial, helvetica, sans-serif]Ramzes[/font]

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...