Jump to content

problem with a declaration


Recommended Posts

how can i make the function fight know, what $MobHP is? :)

#include <winapi.au3>

$Count = 1
$Count2 = 1
Opt("PixelCoordMode", 0)

While 1
Do 
    $Fight = Fight()
    Until $Count = 30
ExitLoop
WEnd

Func Fight()
    $TrayTip = "Monster: " & $Count
    TrayTip("Fight", $TrayTip, 30)
    If $Count2 > 6 Then
    Sleep(500)
    ControlClick("Game", "", "", "middle")
    $Count2 = 0
    EndIf
    Sleep(500)
    ControlSend("Game", "", "", "{TAB}", 0)
    sleep(500)
    ControlSend("Game", "", "", "3", 0)
    Do
        MobHp()
        Sleep(500)
    Until $MobHP = 0
    $Count = $Count +1
    $Count2 = $Count2 +1
EndFunc

Func MobHP()
    Global Const $PROCESS_VM_OPERATION = (0x0008)
    Global Const $PROCESS_VM_READ = (0x0010)

    Global $Process="game.exe"
    Global $Pointer = 0x13E49640 

    $handle=_WinAPI_OpenProcess(BitOR($PROCESS_VM_OPERATION,$PROCESS_VM_READ),False,ProcessExists($Process))

    $s=DllStructCreate("int")
    Local $read
    _WinAPI_ReadProcessMemory($handle,$Pointer,DllStructGetPtr($s),DllStructGetSize($s),$read)

    Global $MobHP = DllStructGetData($s,1)

    _WinAPI_CloseHandle($handle)
EndFunc
Link to comment
Share on other sites

Ok, this fixed my problem, but now i have anotherone, after 1 kill the script terminates and throws out this error:

script.au3 (56) : ==> Can not redeclare a constant.:

Global Const $PROCESS_VM_OPERATION = (0x0008)

Global Const ^ ERROR

->03:16:17 AutoIT3.exe ended.rc:1

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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