Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[AutoIT] pointers.

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Dracons
Newbie cheater
Reputation: 0

Joined: 08 Nov 2016
Posts: 16

PostPosted: Mon Jan 23, 2017 7:47 am    Post subject: [AutoIT] pointers. Reply with quote

Hello.

I want to make application, which will be reading my "Player HP" from game continuously. For now I am able to do it only once. Even when I am trying to do my best I still need your help guys.
Here you go my script:

Code:
#RequireAdmin
#include <Timers.au3>
#include <MemoryPointer.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 139, 267, 562, 301)
$Label1 = GUICtrlCreateLabel("Auto Heal:", 8, 16, 66, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x000000)
$Input1 = GUICtrlCreateInput("2000", 8, 56, 121, 21)
$Button1 = GUICtrlCreateButton("Start", 56, 136, 75, 25)
$Input2 = GUICtrlCreateInput("{F1}", 8, 106, 121, 21)
$Label2 = GUICtrlCreateLabel("HP:", 8, 38, 22, 17)
$Label3 = GUICtrlCreateLabel("Hotkey:", 8, 88, 41, 17)
$Label4 = GUICtrlCreateLabel("Current HP:", 8, 224, 59, 17)
$Label5 = GUICtrlCreateLabel("0", 8, 240, 122, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$Value = _Pointer()





While 1
   _Timer_SetTimer($form1,2000,"readhp")


    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit



            Case $Button1
            $ks = guictrlread($Input2)
            $ksks = guictrlread($Input1)
            _Timer_SetTimer($form1,$ksks,"senzu")


         EndSwitch



WEnd

Func readhp($1,$2,$3,$4)
GUICtrlSetData ($label5, $Value)

EndFunc

Func senzu($1,$2,$3,$4)
    controlsend("Client","","",$ks)

EndFunc


Func _Pointer()
    Local $Staticoffset = 0x002410E0
    Local $hOpen, $sRead
    $PID = ProcessExists("Client.exe")
    $hOpen = _MemoryOpen($PID )
    Local $Base = _MemoryModuleGetBaseAddress($PID, 'Client.exe')

    $sRead = _MemoryRead($Base + $Staticoffset, $hOpen, 'dword') + 0xb8
    $sRead = _MemoryRead($sRead, $hOpen, 'dword') + 0x8
    $sValue = _MemoryRead($sRead , $hOpen, 'double')
    _MemoryClose($hOpen)
    Return ($sValue)
 EndFunc
Back to top
View user's profile Send private message
Viloresi
Expert Cheater
Reputation: 0

Joined: 02 Feb 2017
Posts: 149

PostPosted: Thu Feb 02, 2017 11:43 am    Post subject: Reply with quote

just put your function readhp inside the while loop like this, and also a sleep to avoid many problems that may be caused by your infinite loop
Code:

While 1
   _Timer_SetTimer($form1,2000,"readhp")


    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit



            Case $Button1
            $ks = guictrlread($Input2)
            $ksks = guictrlread($Input1)
            _Timer_SetTimer($form1,$ksks,"senzu")


         EndSwitch


Sleep(100)

readhp()


WEnd 


Also... your code is kinda messy.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites