Results 1 to 22 of 22

Thread: XP Total

  1. #1
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default XP Total

    I thought I'd just put this here to get peoples opinions on it first. This is the Font and really the only 3 functions you'll need to use this.

    This will allow you to read and reset the "XP Total" counter that is now in Runescape.

    Extract XPChars folder from the zip file attached to the font folder in Simba.

    Code:
    Function SetXPTotal(Open: boolean): boolean;
    begin
      if (GetColor(512, 63) = 4160940) xor Open then
        Mouse(519, 48, 29, 29, true);
    end;
    
    Function GetXPTotal: Integer;
    begin
      SetTotalXP(true);
      While not (GetColor(512, 63) = 4160940) and LoggedIn do
        Wait(10);
      Result := StrToInt(ExtractFromStr(GetTextAtExWrap(452, 55, 512, 69, 0, 5, 4, clWhite, 0, 'XPChars'), numbers));
    end; 
    
    Function ResetXPTotal: boolean;
    begin
      Mouse(519, 48, 29, 29, false);
      result := WaitOption('eset', 1000);
    end;
    Last edited by Wanted; 12-07-2010 at 12:49 AM.
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

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

    Default

    SCAR Code:
    {*******************************************************************************
    function XPBarOpen: Boolean;
    By: Frement
    Description: Returns true if XP bar is open.
    *******************************************************************************}

    function XPBarOpen: Boolean;
    begin
    Result := False;
      if (CountColorTolerance(16777215, 430, 55, 515, 70, 3) >= 50) then
        Result := True;
    end;

    {*******************************************************************************
    function OpenXPBar: Boolean;
    By: Frement
    Description: Opens the XP bar if it already is not open.
    *******************************************************************************}

    function OpenXPBar: Boolean;
    var x, y: Integer;
    begin
    Result := False;
      if not (XPBarOpen) then
        if (FindColorTolerance(x, y, 12317946, 520, 50, 540, 70, 5)) then begin
          Mouse(x, y, 5, 5, True);
          Result := True;
        end;
    end;

    {*******************************************************************************
    function CloseXPBar: Boolean;
    By: Frement
    Description: Closes the XP bar if it already is not closed.
    *******************************************************************************}

    function CloseXPBar: Boolean;
    var x, y: Integer;
    begin
    Result := False;
      if (XPBarOpen) then
        if (FindColorTolerance(x, y, 12317946, 520, 50, 540, 70, 5)) then begin
          Mouse(x, y, 5, 5, True);
          Result := True;
        end;
    end;

    {*******************************************************************************
    function ResetXPBar: Boolean;
    By: Frement
    Description: Resets the XP bar, opens it if its closed and then closes it.
    *******************************************************************************}

    function ResetXPBar: Boolean;
    begin
    Result := False;
      if (XPBarOpen) then begin
        Mouse(RandomRange(450, 490), 65, 5, 5, True);
        Result := True;
      end else begin
        OpenXPBar;
        Mouse(RandomRange(450, 490), 65, 5, 5, True);
        Result := True;
        CloseXPBar;
      end;
    end;

    I think reset function is outdated. As it needs to click on the icon rather then the bar.
    Last edited by Frement; 06-18-2010 at 12:13 AM.
    There used to be something meaningful here.

  3. #3
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    I think its easier to just have one function to open/close it. Oh but I do prefer your name for it "XPBar" although Jagex calls it "XP Total."
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

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

    Default

    Quote Originally Posted by Narcle View Post
    I think its easier to just have one function to open/close it. Oh but I do prefer your name for it "XPBar" although Jagex calls it "XP Total."
    Well those are just some functions I made when it first came.
    There used to be something meaningful here.

  5. #5
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Change the names around. Using "XPTotal" while its not as short it conveys what it is better.
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

  6. #6
    Join Date
    Dec 2008
    Posts
    209
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    PHP Code:
    function XPBarOpenBoolean;
    begin
    Result 
    := False;
      if (
    CountColorTolerance(1677721543055515703) >= 50then
        Result 
    := True;
    end;

    // improved.

    function XPBarOpenBoolean;
    begin
      Result 
    := CountColorTolerance(1677721543055515703) >= 50;
    end
    craiggles.

  7. #7
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    HTML Code:
    {*******************************************************************************
    function CloseXPBar: Boolean;
    By: Frement
    Description: Closes the XP bar if it already is not closed.
    *******************************************************************************}
    function CloseXPBar: Boolean;
    var x, y: Integer;
    begin
    Result := False;
      if ((XPBarOpen) and (FindColorTolerance(x, y, 12317946, 520, 50, 540, 70, 5))) then begin
        Mouse(x, y, 5, 5, True);
        Result := True;
      end;
    end;
    
    {*******************************************************************************
    function ResetXPBar: Boolean;
    By: Frement
    Description: Resets the XP bar, opens it if its closed and then closes it.
    *******************************************************************************}
    procedure ResetXPBar;
    begin
      if (XPBarOpen) then begin
        Mouse(RandomRange(450, 490), 65, 5, 5, True);
      end else begin
        OpenXPBar;
        Mouse(RandomRange(450, 490), 65, 5, 5, True);
        CloseXPBar;
      end;
    end;
    I we're optimizing anyway... And there are no waits in ResetXPBar
    Last edited by masterBB; 06-18-2010 at 09:29 AM.

  8. #8
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    double post...

  9. #9
    Join Date
    Dec 2008
    Posts
    209
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    PHP Code:
    function CloseXPBarBoolean;
    var 
    xyInteger;
    begin
    Result 
    := False;
      if ((
    XPBarOpen) and (FindColorTolerance(xy1231794652050540705))) then begin
        Mouse
    (xy55True);
        
    Result := True;
      
    end;
    end;

    // boolean returning functions with no explicit result assignment return false

    function CloseXPBarBoolean;
    var 
    xyInteger;
    begin
      
    if (XPBarOpen) and (FindColorTolerance(xy1231794652050540705)) then 
      begin
        Mouse
    (xy55True);
        
    Result := True;
      
    end;
    end

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

    Default

    I find this to be useful, commit pl0x?

  11. #11
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by IceFire908 View Post
    I find this to be useful, commit pl0x?
    Only reason I didn't commit is because the font needs to be added to Simba.
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

  12. #12
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default


    This is the font used

    EDIT: Oh, wait.. It's in the first post
    Last edited by Zyt3x; 12-04-2010 at 11:24 AM.

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

    Default

    Quote Originally Posted by Narcle View Post
    Only reason I didn't commit is because the font needs to be added to Simba.
    Should be a pretty easy for who ever can.

  14. #14
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,692
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    Added to Simba repos & online snapshot for Simba. Should autoupdate as soon as you start Simba.

    Code:
    Loaded fonts: UpChars, SmallChars, CharsTrade, LoginChars, XPChars, FriendChars, StatChars, BigChars, CharsNPC



    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

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

    Default

    I think you messed up or something because you put a new folder names Fonts inside of Fonts that has the right chars but it won't work like this.

  16. #16
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    Quote Originally Posted by IceFire908 View Post
    I think you messed up or something because you put a new folder names Fonts inside of Fonts that has the right chars but it won't work like this.
    I saw that too, but I though it was a problem with my Simba! apparently not..

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

    Default

    Also, Wizzup. I noticed that since this thread is old the XPChars have since changed, if you could please reupload these news ones from http://rs2fonts.googlecode.com/svn/trunk/ it would be much appreciated.

    Edit:

    Well I'm done for the day, and I'm absolutely stumped with both SCAR and simba on this one. Simba is mixing up 3s and putting 5s in there. If anyone can debunk this that would be great, just remember to get the new fonts from googlecode when testing.

    SCAR Code:
    {*******************************************************************************
    function IsXPBarOpen: Boolean;
    By: Narcle & IceFire908
    Description: Results True if the XP Bar is showing.
    *******************************************************************************}


    function IsXPBarOpen: Boolean;
    begin
      Result := GetColor(459, 55) = 4095148;
    end;

    {*******************************************************************************
    function ToggleXPBar(Open: Boolean): Boolean;
    By: Narcle & IceFire908
    Description: Opens or closes the XP Bar, true if had to toggle.
    *******************************************************************************}


    function ToggleXPBar(Open: Boolean): Boolean;
    var
      TPA: TPointArray;
      P: TPoint;
    begin
      Result := IsXPBarOpen <> Open;
      if (not (Result)) then
        Exit;
      TPA := TPAFromBox(IntToBox(521, 51, 546, 75));
      FilterPointsPie(TPA, 0, 360, 0, 12, 534, 63);
      P := TPA[Random(Length(TPA))];
      Mouse(P.X, P.Y, 0, 0, True);
    end;

    {*******************************************************************************
    function GetXPBarTotal: LongInt;
    By: Narcle & IceFire908
    Description: Returns the number from your XP Bar.
    *******************************************************************************}


    function GetXPBarTotal: string;
    var
      Previous: Boolean;
      TPA: TPointArray;
      P: TPoint;
      B: TBox;
    begin
      Previous := IsXPBarOpen;
      if (ToggleXPBar(True)) then
        WaitFunc(@IsXPBarOpen, 10, 1500);
      FindColorsTolerance(TPA, clWhite, 372, 50, 515, 76, 1);
      B := GetTPABounds(TPA);
      {$IFDEF Simba}
        B := IntToBox(b.x1-2, b.y1-2, b.x2+2, b.y2+2);
        Result := {StrToInt(ExtractFromStr(}GetTextAtExWrap(B.X1, B.Y1, B.X2, B.Y2, 0, 5, 4, clWhite, 0, 'XPChars'){, Numbers));}
      {$ELSE}
        WriteLn(IsTextInAreaEx(433, 55, 454, 70, P.X, P.Y, 'XP', 0, XPChars, False, False, 0, 2, clWhite));
        Result := StrToIntDef(GetNumbers(GetTextAtEx(B.X1 - 1, B.Y1 - 1, 0, XPChars, False, False, -1, 1, 0, 60, True, tr_AllChars)), 0);
      {$ENDIF}
      if (not (Previous)) then
        Wait(RandomRange(500, 1500));
      ToggleXPBar(Previous);
    end;

    {*******************************************************************************
    function ResetXPTotal: Boolean;
    By: Narcle & IceFire908
    Description: Resets the XP Bar.
    *******************************************************************************}


    function ResetXPTotal: Boolean;
    var
      TPA: TPointArray;
      P: TPoint;
    begin
      TPA := TPAFromBox(IntToBox(521, 51, 546, 75));
      FilterPointsPie(TPA, 0, 360, 0, 12, 534, 63);
      P := TPA[Random(Length(TPA))];
      Mouse(P.X, P.Y, 0, 0, False);
      Result := WaitOptionMulti(['Res', 'ese', 'set'], 1000);
    end;

  18. #18
    Join Date
    Dec 2009
    Location
    Newcastle, Australia
    Posts
    888
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    /me wonders if its possible with reflection. Will check that today.

    Current Script Project
    Pot of flour gatherer - 95% done

    Can't get Simba to work? Click here for a tutorial

  19. #19
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,692
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    Quote Originally Posted by IceFire908 View Post
    Also, Wizzup. I noticed that since this thread is old the XPChars have since changed, if you could please reupload these news ones from http://rs2fonts.googlecode.com/svn/trunk/ it would be much appreciated.
    I noticed this too. But once I updated again it was named XPChars. I committed with the right name, perhaps I messed up the zipping. Or there is a bug in Simba.

    I've updated it to use the latest XPChars.



    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

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

    Default

    Quote Originally Posted by Zyt3x View Post
    I saw that too, but I though it was a problem with my Simba! apparently not..
    Is there an easy way that you could give us bitmaps of every char of any font set?

    Wizzup, sorry last time. Turns out the '3' was one pixel off, its on the same SVN.

    Edit: Committed working versions of the following functions to latest SRL open dev. Simba users update your SR (and manually update your fonts until Wizzup uploads the new '3'), SCAR users update your SRL + Fonts folder.

    SCAR Code:
    // * function IsXPBarOpen: Boolean;                                // by Narcle & IceFire908
    // * function ToggleXPBar(Open: Boolean): Boolean;                 // by Narcle & IceFire908
    // * function GetXPBarTotal: LongInt;                              // by Narcle & IceFire908
    // * function ResetXPTotal: Boolean;                               // by Narcle & IceFire908
    //*****************************************************************//

    {*******************************************************************************
    function IsXPBarOpen: Boolean;
    By: Narcle & IceFire908
    Description: Results True if the XP Bar is showing.
    *******************************************************************************}


    function IsXPBarOpen: Boolean;
    begin
      Result := CountColor(clWhite, 342, 55, 510, 69) > 40;
    end;

    {*******************************************************************************
    function ToggleXPBar(Open: Boolean): Boolean;
    By: Narcle & IceFire908
    Description: Opens or closes the XP Bar, true if had to toggle.
    *******************************************************************************}


    function ToggleXPBar(Open: Boolean): Boolean;
    var
      TPA: TPointArray;
      P: TPoint;
    begin
      Result := IsXPBarOpen <> Open;
      if (not (Result)) then
        Exit;
      TPA := TPAFromBox(IntToBox(521, 51, 546, 75));
      FilterPointsPie(TPA, 0, 360, 0, 12, 534, 63);
      P := TPA[Random(Length(TPA))];
      Mouse(P.X, P.Y, 0, 0, True);
    end;

    {*******************************************************************************
    function GetXPBarTotal: LongInt;
    By: Narcle & IceFire908
    Description: Returns the number from your XP Bar.
    *******************************************************************************}


    function GetXPBarTotal: LongInt;
    var
      Previous: Boolean;
      TPA: TPointArray;
      P: TPoint;
      B: TBox;
    begin
      Previous := IsXPBarOpen;
      if (ToggleXPBar(True)) then
        WaitFunc(@IsXPBarOpen, 10, 1500);
      FindColorsTolerance(TPA, clWhite, 342, 55, 510, 69, 1);
      B := GetTPABounds(TPA);
      B := IntToBox(B.X1 - 2, B.Y1 - 2, B.X2 + 2, B.Y2 + 2);
      {$IFDEF Simba}
        Result := StrToInt(ExtractFromStr(GetTextAtExWrap(B.X1, B.Y1, B.X2, B.Y2, 0, 5, 4, clWhite, 0, 'XPChars'), Numbers));
      {$ELSE}
        IsTextInAreaEx(B.X1, B.Y1, B.X2, B.Y2, P.X, P.Y, 'XP', 0, XPChars, False, False, 0, 1, clWhite);
        Result := StrToIntDef(GetNumbers(GetTextAtEx(P.X, P.Y, 1, XPChars, False, False, 0, 2, clWhite, 60, False, tr_AllChars)), 0);
      {$ENDIF}
      if (not (Previous)) then
        Wait(RandomRange(500, 1500));
      ToggleXPBar(Previous);
    end;

    {*******************************************************************************
    function ResetXPTotal: Boolean;
    By: Narcle & IceFire908
    Description: Resets the XP Bar.
    *******************************************************************************}


    function ResetXPTotal: Boolean;
    var
      TPA: TPointArray;
      P: TPoint;
    begin
      TPA := TPAFromBox(IntToBox(521, 51, 546, 75));
      FilterPointsPie(TPA, 0, 360, 0, 12, 534, 63);
      P := TPA[Random(Length(TPA))];
      Mouse(P.X, P.Y, 0, 0, False);
      Result := WaitOptionMulti(['Res', 'ese', 'set'], 1000);
    end;

  21. #21
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,692
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    Updated to latest.



    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

  22. #22
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    Quote Originally Posted by IceFire908 View Post
    Is there an easy way that you could give us bitmaps of every char of any font set?
    I have tried to create an auto-updater, but the spacing for each charset is different (and the size too.. some is 400x400 others are 200x200 and so on) and some of the characters have no spacing at all (not in this charset though)

    I guess if you made some constants for the spacing of each charset and where the characters starts then it could be done.... I'll try making one again...

    EDIT: For UpText, the spacing between each row (EDIT2: And column!) is 16.. I am starting to think I did something extremely wrong last time I tried! This might be very do-able!
    Last edited by Zyt3x; 12-07-2010 at 09:38 PM.

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
  •