Results 1 to 6 of 6

Thread: Health Checker Utility

  1. #1
    Join Date
    Oct 2006
    Posts
    206
    Mentioned
    2 Post(s)
    Quoted
    45 Post(s)

    Default Health Checker Utility

    Hi guys,

    A little contribution (it's not perfect..)

    Simba Code:
    program HealthTest;
    {$Define SMART8}
    {$include SRL/SRL.simba}
    {$include SPS/SPS.simba}
    {$include SRL/SRL/Misc/SmartGraphics.simba}

    var
      DebugBitmap: integer;

    const
      debug = true;

    function FindGreenHealth: integer;
    var
      HealthBarTPA: TPointArray;
      HealthBarATPA: T2DPointArray;
    begin
      if (Findcolors(HealthBarTPA, 65280, MSX1, MSY1, MSX2, MSY2)) then
      begin
        SplitTPAWrap(HealthBarTPA, 10, HealthBarATPA);
        SortATPAFromMidPoint(HealthBarATPA, Point(251, 171));
        if (debug) then
          Smart_DrawDotsEx(true, HealthBarTPA, clBlue);
        result := High(HealthBarATPA[0]);
      end;
    end;

    function CalculateHealth: integer;
    var
      Conversion, Red, Green: extended;
      Calculation: integer;
    begin
      Green := FindGreenHealth;
      Conversion := (green / 149) * 100;
      Calculation := Round(Conversion);
      if (Calculation < 1) then
      begin
        result := - 1;
      end
      else
        result := Calculation;
    end;

    begin
      SetupSRL;
      Smart_SetupDebug;
      repeat
        Cleardebug;
        writeln(CalculateHealth);
        Wait(3000);
      until (false)
    end.

    What it does:


    Green is a constant color in old rs, so it checks for that color on the screen using FindColors().
    It then splits all the TPA's into ATPA's and check for the first ATPA in the middle (characters health bar)
    It then (if debug = true -> debugs on smart) calculates the health in % using very simple math.

  2. #2
    Join Date
    Feb 2013
    Posts
    31
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    what does it do?

  3. #3
    Join Date
    Jun 2012
    Posts
    15
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Thx for adding this utility! However it still checks A green bar not your OWN healthbar :P

  4. #4
    Join Date
    Feb 2013
    Posts
    31
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    doesnt compile either

  5. #5
    Join Date
    Oct 2006
    Posts
    206
    Mentioned
    2 Post(s)
    Quoted
    45 Post(s)

    Default

    Quote Originally Posted by Tombraider View Post
    Thx for adding this utility! However it still checks A green bar not your OWN healthbar :P
    Since it sorts the tpa from the center of the screen (MMX1 + MMX2 / 2) etc. it most likely finds the own healthbar.

  6. #6
    Join Date
    Feb 2013
    Posts
    64
    Mentioned
    0 Post(s)
    Quoted
    21 Post(s)

    Default

    Thanks for this

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •