Jump to content
lazarbeam

[2007] Getting Current HP

Recommended Posts

Returns value of HP via stats game tab

(Would not work for HP > 99, but does work for 1 and 2-digit HP levels)

I had considered making a function that can obtain all current and base player stats, but saw little reason.

 

Get HP

Function GetHP:Integer;
Begin
 If(RS07_LoggedIn)Then
   Begin
     If(Not(RS07_GameTabOpen(1)))Then RS07_OpenGameTab(1);
     Result := StrToInt(GetTextAtEx(645, 210, 0, RS07_StatFont, False, False, 0, 2, 65535, 2, True, tr_AllChars));
   end; 
end;

 

Get HP Percentage (Rounded to integer)

Function GetHpPercentage:Integer;
var cur,base:Integer;
Begin
 If(RS07_LoggedIn)Then
   Begin
     If(Not(RS07_GameTabOpen(1)))Then RS07_OpenGameTab(1);
     cur := StrToInt(GetTextAtEx(645, 210, 0, RS07_StatFont, False, False, 0, 2, 65535, 2, True, tr_AllChars));
     base:= StrToInt(GetTextAtEx(657,222, 0, RS07_StatFont, False, False, 0, 2, 65535, 2, True, tr_AllChars));
     If(base>0)Then Result:=Round(100*cur/base);
   end; 
end;

Edited by lazarbeam
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...