Results 1 to 22 of 22

Thread: Get a number out of the GE

  1. #1
    Join Date
    Jun 2012
    Location
    THE Students-City of Holland
    Posts
    332
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default Get a number out of the GE

    Hello,

    I am trying to read this numbers:


    On this screeen, I need to:
    - find the price (84,239,920) and I need that in an Integer.
    - "You sold a total of x" (5) , which also could be 21,234 (need it in an integer too)
    - " for a total price of y gp" (52,649,950) and I need that in an Integer;
    - Quantity: Z (8), which also could be 10,128 (need it in an integer too)

    How do I get such numbers out of this screen? I hope someone knows the awnser, or at least which function I could use best.

    Greetz,
    MasterCrimez

  2. #2
    Join Date
    Mar 2012
    Location
    Color :D
    Posts
    938
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I used GetTextAtExWrap for my GE script. I believe the font is UpCharsEx.

  3. #3
    Join Date
    Oct 2011
    Location
    UK
    Posts
    1,322
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    GetTextAtExWrap with GetNumbers

    GetNumbers extracts numbers from a string of text (get's rid of commas etc..)

  4. #4
    Join Date
    Jun 2012
    Location
    THE Students-City of Holland
    Posts
    332
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Quote Originally Posted by CephaXz View Post
    I used GetTextAtExWrap for my GE script. I believe the font is UpCharsEx.
    Okay thanks.
    Quote Originally Posted by putonajonny View Post
    GetTextAtExWrap with GetNumbers

    GetNumbers extracts numbers from a string of text (get's rid of commas etc..)
    Ah nice! So getnumbers will make 8112235 from the string '8,112,235' ?

    Thanks

  5. #5
    Join Date
    Mar 2012
    Location
    Color :D
    Posts
    938
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by MasterCrimez View Post
    Okay thanks.


    Ah nice! So getnumbers will make 8112235 from the string '8,112,235' ?

    Thanks
    Yes, and you will still need to use StrtoInt to make it into an integer.

  6. #6
    Join Date
    Jun 2012
    Location
    THE Students-City of Holland
    Posts
    332
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    GetTextAtExWrap
    Simba Code:
    function GetTextAtExWrap(const xs,ys,xe,ye, minvspacing, maxvspacing, hspacing,color, tol: integer;const font: string): string;
    A wrapper function for the previously mentioned function. Required to work arounds bugs in the interpreter.

    I almost understand the whole function, but what does minvspacing mean? and maxvspacing?
    and hspacing?

    does that have to do something with the space between the letters? and what values do I need for reading text from the GE?

  7. #7
    Join Date
    Dec 2011
    Location
    The Netherlands
    Posts
    1,631
    Mentioned
    47 Post(s)
    Quoted
    254 Post(s)

    Default

    If you search for the function on Google like this you often get some useful code:
    https://www.google.nl/search?q=site%...ient=firefox-a

    Simba Code:
    function GetMidPrice: Integer;
    var
        Text: String;
    begin
        Text:= GetTextAtExWrap(296, 186, 440, 199, 0, 10, 1, 6400255, 5, 'UpCharsEx');
        writeln(Text);  //easier than calling the func again..
        Result:= StrToIntDef(GetNumbers(Text), -1);
    end;

    I used this in my Gop script:
    Simba Code:
    procedure GetWaitTime;
    var
      i: Integer;
      Bound: TBox;
      Pts: TPointArray;
      WaitTimeString: String;
      NumbersCheck: Array of String;

    begin
      ColorToleranceSpeed(1);
      FindColorsTolerance(Pts, 0, 140, 380, 500, 450, 0);
      Bound := GetTPABounds(Pts);
      //SMART_DrawBox(Bound);
      WaitTimeString := GetTextAtExWrap(Bound.x1 - 5, Bound.y1 - 5, Bound.x2 + 5, Bound.y2 + 5, 0, 0, 2, 0, 0, UpChars);
      WriteLn(WaitTimeString);

      NumbersCheck := ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];

      for i:=0 to 9 do
        begin
          if Pos(NumbersCheck[i], WaitTimeString) > 0 then
            begin
              WaitTime := StrToInt(GetNumbers(WaitTimeString));
              SMART_DrawDotsEx(False, ActionBoxTPA, RGBtoColor(194, 178, 146));
              SMART_DrawText(290, 429, UpChars, 'kicked, waiting '+IntToStr(WaitTime)+' minutes', clWhite);
              Exit;
            end;
        end;
    end;

    I believe minvspacing is the minimum vertical spacing = 0
    max vertical spacing = 0 aswell becaues you are reading one line.
    Hspacing = horizontal spacing = 2 because it sometimes messes up when you use 1 I believe. Hope it helps.

    Script source code available here: Github

  8. #8
    Join Date
    Jun 2012
    Location
    THE Students-City of Holland
    Posts
    332
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Quote Originally Posted by J J View Post
    If you search for the function on Google like this you often get some useful code:
    https://www.google.nl/search?q=site%...ient=firefox-a

    Simba Code:
    function GetMidPrice: Integer;
    var
        Text: String;
    begin
        Text:= GetTextAtExWrap(296, 186, 440, 199, 0, 10, 1, 6400255, 5, 'UpCharsEx');
        writeln(Text);  //easier than calling the func again..
        Result:= StrToIntDef(GetNumbers(Text), -1);
    end;

    I used this in my Gop script:
    Simba Code:
    procedure GetWaitTime;
    var
      i: Integer;
      Bound: TBox;
      Pts: TPointArray;
      WaitTimeString: String;
      NumbersCheck: Array of String;

    begin
      ColorToleranceSpeed(1);
      FindColorsTolerance(Pts, 0, 140, 380, 500, 450, 0);
      Bound := GetTPABounds(Pts);
      //SMART_DrawBox(Bound);
      WaitTimeString := GetTextAtExWrap(Bound.x1 - 5, Bound.y1 - 5, Bound.x2 + 5, Bound.y2 + 5, 0, 0, 2, 0, 0, UpChars);
      WriteLn(WaitTimeString);

      NumbersCheck := ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];

      for i:=0 to 9 do
        begin
          if Pos(NumbersCheck[i], WaitTimeString) > 0 then
            begin
              WaitTime := StrToInt(GetNumbers(WaitTimeString));
              SMART_DrawDotsEx(False, ActionBoxTPA, RGBtoColor(194, 178, 146));
              SMART_DrawText(290, 429, UpChars, 'kicked, waiting '+IntToStr(WaitTime)+' minutes', clWhite);
              Exit;
            end;
        end;
    end;

    I believe minvspacing is the minimum vertical spacing = 0
    max vertical spacing = 0 aswell becaues you are reading one line.
    Hspacing = horizontal spacing = 2 because it sometimes messes up when you use 1 I believe. Hope it helps.
    thanks!
    I have
    quantity:= GetTextAtExWrap(80,180,230,205, 0, 0, 2, 6400255, 0, UpCharsEx);
    now and it works
    shall I use 0 tolerance ? Or just do 1 or 2 for if jagex changes colors?

  9. #9
    Join Date
    Oct 2011
    Location
    UK
    Posts
    1,322
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by MasterCrimez View Post
    thanks!
    I have
    quantity:= GetTextAtExWrap(80,180,230,205, 0, 0, 2, 6400255, 0, UpCharsEx);
    now and it works
    shall I use 0 tolerance ? Or just do 1 or 2 for if jagex changes colors?
    I'd use 0, if jagex changes the colour it will likely be dramatically so you will need to update anyway, a good way though would be to use a constant for the colour, put it just under DeclarePlayers so that you can very easily update it if there ever is a change...

  10. #10
    Join Date
    Jun 2012
    Location
    THE Students-City of Holland
    Posts
    332
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    thanks for your advice, that's exactly how i've done it now.

    But, now I have a problem... It seems to not be able to read these two:

    Simba Code:
    ItemsTotalX := StrToIntDef(GetNumbers(GetTextAtExWrap(218,271,320,283, 0, 0, 2, 39372, 5, UpCharsEx)),0);//you sould/bought a total of x
          PriceTotalX := StrToIntDef(GetNumbers(GetTextAtExWrap(218,286,320,299, 0, 0, 2, 39372, 5, UpCharsEx)),0);//for a total price of x gp

    I'm 100% sure I've got the color right, but still it doesnt read them. maybe it's another font? How can I know? Or do the minvspacing/maxvspacing/hspacing need another value maybe?

  11. #11
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    Quote Originally Posted by MasterCrimez View Post
    I'm 100% sure I've got the color right, but still it doesnt read them. maybe it's another font? How can I know? Or do the minvspacing/maxvspacing/hspacing need another value maybe?
    Try changing the maxspacing - it shouldn't be 0. Keep putting it higher (by 1) till it can finally read it.

    If ti still can't, try different fonts.

  12. #12
    Join Date
    Jun 2012
    Location
    THE Students-City of Holland
    Posts
    332
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    ugghh this is horrible.. tried many fonts, and many vmaxspacings... but only 1 in 10 it works a little

  13. #13
    Join Date
    Jun 2012
    Location
    THE Students-City of Holland
    Posts
    332
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    I will test more tomorrow and I hope I find a solution myself.

    But if someone who knows a lot about fonts wants to help, I would apreciate it a lot.

    I will make a test script tomorrow for it because then I can test it faster and in forloops to see many results at once

    I really doubt if I have the right font. UpChars works better than UpCharsEx, but still very sporadic :S

    Well anyway, I will post here tomozz when I have worked on it. cyaz

  14. #14
    Join Date
    Jun 2012
    Location
    THE Students-City of Holland
    Posts
    332
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Hello... I've just tested, and I think I've figured it out. Whatever I do with the minspacing and maxspacing and other things, the letters wont change. Which font I use also doesnt matter, none of them works.

    Code:
    0 = 0
    1 = l (L lowercase)
    2 = 2
    3 = J or T
    4 = k
    5 = 5
    6 = 6
    7 = z
    8 = 8
    9 = 3
    , = '
    This is the outcome for the best font : UpCharsEx


    So, is there a way to read these small texts?
    I'm talking about: "You bought a total of XXXXXX"
    and " for a total price of XXXXX"

    All I really need is numbers and a comma, so can't I create a new little font myself only for these 11 characters? Would be nice if that worked.

    Every help is apreciated! I really need this function, else I cannot further develop my bot!

    Edit: the quantity and gp price DO work! Only the "You bought xxxxx for a total price of xxxxx" does not work.
    Last edited by Master BAW; 06-20-2012 at 04:06 AM.

  15. #15
    Join Date
    Jun 2012
    Location
    THE Students-City of Holland
    Posts
    332
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default



    ^ I've just made this What now ?

  16. #16
    Join Date
    Jun 2012
    Posts
    29
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    how much profit/hr is there to be made with a ge script if you start with say 50m?

  17. #17
    Join Date
    Jun 2012
    Location
    THE Students-City of Holland
    Posts
    332
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Quote Originally Posted by Wildo View Post
    how much profit/hr is there to be made with a ge script if you start with say 50m?
    There is no working GE script ATM haha. Although not that I know.

    but anyway I just made the ,0123456789 all in bmp black and white. onto the next step. need to find out how to put them into my own new font.
    Last edited by Master BAW; 06-20-2012 at 04:59 AM.

  18. #18
    Join Date
    Jun 2012
    Location
    THE Students-City of Holland
    Posts
    332
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    OH MY FUCKING GOD!
    I feel so stupid!
    I've made my own font, been working an hour on it, and before that I read all forums and everything because I couldn't find anything that helped! But now I have the awnser! LOL

    The fond I need is: StatChars

    Sorry for my spamming all night ... ignore it
    Last edited by Master BAW; 06-20-2012 at 05:32 AM.

  19. #19
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    In future, refrain from double and quadruple posting.

    If you want to make another post, edit your current one.


    EDIT: Like this.

  20. #20
    Join Date
    Jun 2012
    Location
    THE Students-City of Holland
    Posts
    332
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Okay, will do sir.
    I understand how to edit, and often I do it but sometimes I forget ^^

  21. #21
    Join Date
    Oct 2011
    Location
    UK
    Posts
    1,322
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    is your text recognition working now?

  22. #22
    Join Date
    Jun 2012
    Location
    THE Students-City of Holland
    Posts
    332
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Quote Originally Posted by putonajonny View Post
    is your text recognition working now?
    YES 100%

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
  •