Jump to content

Progress bar value


Recommended Posts

How can I change the max value of a progress bar (guictrlcreateprogress)?

I'm reading the health of a character in game which is (1550), and I want the current health to be displayed as a progress bar.

I tried using guictrlsetlimit(), but that didn't seem to work.

Here is the code:

#include <GuiConstants.au3>
#include <mem.au3>

GuiCreate("MyGUI", 251, 154,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Progress_1 = GuiCtrlCreateProgress(100, 30, 130, 20)
$Progress_2 = GuiCtrlCreateProgress(100, 60, 130, 20)
$Progress_3 = GuiCtrlCreateProgress(100, 90, 130, 20)
$G_Stats = GuiCtrlCreateGroup("Character Statistics", 10, 10, 230, 110)
$L_Health = GuiCtrlCreateLabel("Health", 20, 30, 70, 20)
$L_Mana = GuiCtrlCreateLabel("Mana", 20, 60, 70, 20)
$L_Exp = GuiCtrlCreateLabel("Experience", 20, 90, 60, 20)
$B_Exit = GuiCtrlCreateButton("Exit", 180, 130, 60, 20)

$Process = 'soul.exe'           ;-> Target process
$PID = ProcessExists($Process)  ;-> Get Process ID
$Address = 0x56C5EC8            ;-> Health Handle
;$Address = 0x0A27CAB8          ;-> Mana Handle
$Value = 12                     ;-> Value to write

$MaxHealth = 1550    ; Total health of character (100%)
GUICtrlSetData($Progress_1,0)
GUICtrlSetData($Progress_2,0)
GUICtrlSetData($Progress_3,0)

$OpenProcess = _MemOpen(0x38, False, $PID) ;-> Enable reading/writing to the process and get the handle

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $B_Exit
        Exit
EndSelect


$v_Read = _MemRead($OpenProcess, $Address, 4) 
$HP = Int($v_Read)      ; Current health value
GUICtrlSetData($Progress_1,$HP)
    

WEnd
_MemClose($OpenProcess)
Exit
Link to comment
Share on other sites

  • Developers

How can I change the max value of a progress bar (guictrlcreateprogress)?

I'm reading the health of a character in game which is (1550), and I want the current health to be displayed as a progress bar.

When the Progressbar FULL value is 100 and you want 1550 to represent that, you just do: x/1550*100 to set the progress ...

:)

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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...