Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
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

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×