Results 1 to 8 of 8

Thread: Checking HP level.

  1. #1
    Join Date
    Jul 2006
    Posts
    189
    Mentioned
    1 Post(s)
    Quoted
    19 Post(s)

    Default Checking HP level.

    Im creating a script for a p server and i was wondering how i could go about checking the HP?

    i thought it could be possible to go to skills and check the hp that way by looking at the numbers but i dont know??

    please help if you can.


    EDIT - when i mean level i mean the level of HP left till i die. not the skill level.
    Last edited by seany; 09-16-2010 at 03:04 AM.

  2. #2
    Join Date
    Nov 2007
    Location
    46696E6C616E64
    Posts
    3,069
    Mentioned
    44 Post(s)
    Quoted
    302 Post(s)

    Default

    You can try creating a font, or a DTM for each level (99 DTM's), but the font is easier.

    I also used CountColorTolerance, and if the HP was not the same as the 99's CCT, the script ate a shark. This is quite sufficient way because I checked it after 5 pickpockets, the Paladins don't do more then 10 damage at a time, so max 50 lost.

    So, my suggestion is that try to create the font. Simba seemed to fail at retrieving the text, althought Simbas OCR is amazing.

    Hope this helps
    There used to be something meaningful here.

  3. #3
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    If you're just going to make a thread anyway, please don't PM me. If you make a thread, I'll see it. It's just I get a lot of PMs and if you aren't going to wait for a response anyway, don't bother. I don't mean to be rude, I'm sure you'll understand.

    Thanks.

  4. #4
    Join Date
    Dec 2006
    Location
    Houston, TX USA
    Posts
    4,791
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    If you're making a script where the HP level can potentially rise then it's a good idea to often check your actual HP level (the bottom number) via the stats tab.

    SCAR Code:
    Players[CurrentPlayer].Level[Skill_HP] := GetSkillLevel(Skill_HP);
    //or
    GetAllLevels;

    then to check the minimap's (current Health)

    SCAR Code:
    function CurrentHealth: Integer;
    var
      S: string;
    begin
      Result := GetMMLevels('health', S);
    end;

    Then you can compare it with Players[CurrentPlayer].Level[Skill_HP] using math or whatever.

    Edit: Ah? Private server

    In that case you will need to make your own font (or find the correct one) that matches those small chars. Then you can do your source similar to this

    SCAR Code:
    {*******************************************************************************
    Function GetMMLevels(LevelType : String;var ColorSign : String): integer;
    By: Raymond / Wizzup / Sabzi
    Last Edit: 29 June 2010
    Description: Returns the level shown next to the minimap.
    Colorsign returns the color of the text (Green,Yellow,Orange,Red).
    Returns -1 if failed.
    *******************************************************************************}

    function GetMMLevels(LevelType: string; var ColorSign: string): Integer;
    var
      Colors : TIntegerArray;
      Signs: TStringArray;
      P: TPointArray;
      TP: TPoint;
      I,cl: Integer;
      B: TBox;
      {$ifdef Scar}
      x,y : integer;
      {$endif}
      W,H, T: integer;
      SearchBox : TBox;
      Run: Boolean;
    begin;
      Result := -1;
      ColorSign := '';
      case LowerCase(Leveltype) of
        'health', 'hp', 'hitpoints', 'constitution': TP := Point(715,27);
        'prayer', 'pray'                           : TP := Point(730,66);
        'summon', 'summoning'                      : TP := Point(715,140);
        'run','energy'                             :
        begin
          TP := Point(730,105);
          Run := True;
        end;
      else
        begin;
          srl_Warn('GetMMLevels', 'Invalid LevelType: ''' + LevelType + '', warn_AllVersions);
          Exit;
        end;
      end;
      Colors := [65280, 65535, 2070783, 255];
      Signs  := ['Green', 'Yellow', 'Orange', 'Red'];
      GetClientDimensions(w,h); //We donnot want to search out of the clients area!
      SearchBox := IntToBox(TP.X, TP.Y, Min(w-1,TP.X + 30), min(h-1,TP.Y + 15));
      for I := 0 to 3 do
      begin
        if Run then
        begin
          MarkTime(T);
          cl := GetColor(749, 118);
          repeat
            if not IsResting then Break;
            {$ifdef Simba}
            if CountColorTolerance(cl, 730, 105, 760, 120, 20) = 215 then Break;
            {$else}
            if not FindColorComp(x, y, clYellow, ccBlue, 730, 107, 742, 108, 130) then Break;
            {$endif}
          until (TimeFromMark(T) >= 5000);
        end;                                              //Do not search outside the client
        With SearchBox do
          FindColorsTolerance(P, Colors[i], x1, y1, x2, y2, 30);
        if Length(P) < 1 then
          Continue;
        B := GetTPABounds(P);//GetTextAtEx works better for Simba for Run
        Result := StrToIntDef(GetNumbers(GetTextAtEx(B.X1 - 1 , B.Y1 - 1, 30, statChars,
                  False, False, 0, 0, Colors[i], 20, False, tr_Digits)), -1);
        if (Result > 0) then
        begin
          ColorSign := Signs[i];
          Exit;
        end;
      end;
    end;

    of course you will need to edit the coordinates and such.

    If the private server is old to the point where there's no MM levels then use something like the source code in SRL's core/gametab.
    Last edited by Wanted; 09-16-2010 at 05:19 AM.

  5. #5
    Join Date
    Jul 2006
    Posts
    189
    Mentioned
    1 Post(s)
    Quoted
    19 Post(s)

    Default

    there is no level/stats around the mm.


    im finding it very difficult on how to use the SRL'c core/gametab.

    im guessing it would be using the GetSkillInfo function... but i currently im finding it difficuly incorporating it.

  6. #6
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Simba Code:
    function GetHPLevel: integer;
    begin
      result := GetSkillLevel(SKILL_HITPOINTS);
    end;

  7. #7
    Join Date
    Nov 2007
    Location
    46696E6C616E64
    Posts
    3,069
    Mentioned
    44 Post(s)
    Quoted
    302 Post(s)

    Default

    Quote Originally Posted by Coh3n View Post
    Simba Code:
    function GetHPLevel: integer;
    begin
      result := GetSkillLevel(SKILL_HITPOINTS);
    end;
    The fonts wont work.
    There used to be something meaningful here.

  8. #8
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by Frement View Post
    The fonts wont work.
    Then he needs his own fonts. He's not going to be able to use most of the include if he doesn't have the right fonts.

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
  •