Results 1 to 14 of 14

Thread: GetTextAtEx Help

  1. #1
    Join Date
    Oct 2007
    Location
    Denmark
    Posts
    409
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default GetTextAtEx Help

    Been trying for some time to read this text, can anyone help me?


    I tried with different coords, but I never quite understood the function.

  2. #2
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Here:

    http://www.villavu.com/forum/showthread.php?t=31983, Make sure it finds the color of it (put a find color before the text grab), because it needs exact co-ords.

  3. #3
    Join Date
    Oct 2007
    Location
    Denmark
    Posts
    409
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by NaumanAkhlaQ View Post
    Here:
    Where?

  4. #4
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    In the post, silly..

    must have loaded it just as i put the link in (I had to get it from my signature)

  5. #5
    Join Date
    Oct 2007
    Location
    Denmark
    Posts
    409
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Read it through and ended up with this:
    SCAR Code:
    function Opponent: String;
    var
      x, y, Color, Mode: Integer;
    begin
      Color := 39423;
      Mode := 0;
      FindColor(x, y, Color, 45, 37, 105, 55);
      Result := GetTextAtEx(x - Mode, y - Mode, 10, StatChars, False, False, 0, 10, Color, 25, False, tr_AllChars);
    end;

    That was for the Rating text.
    changed the var Mode from -5 to 5 but it never found the text..
    What am I doing wrong?

  6. #6
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    Noes, someone else is making a FoG script.

    And thanks Nauman for the link.

  7. #7
    Join Date
    Oct 2007
    Location
    Denmark
    Posts
    409
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Richard View Post
    Noes, someone else is making a FoG script.

    And thanks Nauman for the link.
    You are too?
    Well, I can't finish if I don't get this GetTextAtEx-thing straightened out..

  8. #8
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

  9. #9
    Join Date
    Oct 2007
    Location
    Denmark
    Posts
    409
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I picked the color and it's static.
    Just ran this:
    SCAR Code:
    function Opponent: String;
    var
      x, y, Color: Integer;
    begin
      Color := 39423;
      for x := 45 to 65 do
        for y := 35 to 45 do
          Writeln(GetTextAtEx(x, y, 50, StatChars, False, False, 0, 5, Color, 6, False, tr_AllChars));
    end;

    Put it outputs this:
    Code:
          
          
     :    
     : :  
     i :  
     i i: 
     I: i:
     I:Ir:
     I:::i
         i
         i
          
          
     :    
     : :  
     i :  
     i i: 
     I: i:
     I:Ir:
     I:::i
         i
         i
          
          
     :    
     : :  
     i :  
     i i: 
     I: i:
     I:Ir:
     I:::i
         i
         i
          
          
     :    
     : :  
     i :  
     i i: 
     I: i:
     I:Ir:
     I:::i
         i
         i
          
          
     :    
     : :  
     i :  
     i i: 
     I: i:
     I:Ir:
     I:::i
         i
         i
          
          
    :     
    : :   
    i :   
    i i:  
    I: i: 
    I:Ir::
    I:::i:
         i
         i
          
          
    :     
    : :   
    i :   
    i i:  
    I: i: 
    I:Ir::
    I:::i:
        i 
        i 
          
          
    :     
    : :   
    i :   
    i i:  
    I: i: 
    I:Ir::
    I:::i:
        i 
        i 
          
          
    :     
    : :   
    i :   
    i i:  
    I: i: 
    I:Ir::
    I:::i:
        i 
        i 
          
          
    :     
    : :   
    i :   
    i i:  
    I: i: 
    I:Ir::
    I:::i:
        i 
        i 
          
          
    :     
    : :   
    i :   
    i i:  
    I: i: 
    I:Ir::
    I:::i:
        i 
        i 
          
          
         :
     :   :
     :   i
     i:   
    : i:  
     Ir:: 
     :::i:
        i 
        i 
          
          
         :
     :   :
     :   i
     i:   
    : i:  
    :Ir:: 
     :::i:
        i 
        i 
          
          
         :
     :   :
     :   i
     i:   
    : i:  
    :Ir:: 
    :::i::
        i 
        i 
          
          
         :
     :   :
     :   i
     i:   
     i:  I
    :Ir:: 
    :::i::
       i  
       i  
          
          
         :
     :   :
     :   i
     i:   
     i:  I
    :Ir:: 
    :::i::
       i  
       i  
          
          
         :
     :   :
     :   i
     i:   
     i:  I
    :Ir:: 
    :::i::
       i  
       i  
          
          
        : 
     :   :
     :   i
     i:   
     i:  I
    :Ir:: 
    :::i::
       i  
       i  
          
          
        : 
     :   :
     :   i
     i:   
     i:  I
    :Ir:: 
    :::i::
       i  
       i  
          
          
        : 
    :   ::
    :   i 
    i:   i
    i:  I 
    Ir:: I
    : i:: 
       i  
       i  
          
          
        : 
    :   ::
    :   i 
    i:   i
    i:  I 
    Ir:: I
    : i:: 
       i  
       i
    Is should find the text 'Rating' but it doesn't.

  10. #10
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    If you are trying to find the opponents name, the colour is 6976375.

    I'm having the same troubles, its returning a blank.

  11. #11
    Join Date
    Oct 2007
    Location
    Denmark
    Posts
    409
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Think I figured out, it's SmallChars. It finds the whole text except a 'i'. Perhaps the 'i' in the Char folder is broken?

    Richard: It was the orange test with 'Rating'. Tested on that since I didn't have to enter all the time to search for that

    This can be closed as I have solved it. This is what I ended up with if anyone is curious (Richard )
    SCAR Code:
    function Return(S: String): Variant;
    begin
      case Lowercase(S) of
        'rating': Result := StrToIntDef(GetNumbers(GetTextAtEx(96, 40, 50, SmallChars, False, False, 0, 5, OrColor, 6, False, tr_AllChars)), 0)
        'charged': Result := StrToIntDef(GetNumbers(GetTextAtEx(350, 42, 50, SmallChars, False, False, 0, 5, BeigeColor, 6, False, tr_AllChars)), 0);
        'hunting': Result := (pos('ng:', GetTextAtEx(350, 47, 50, SmallChars, False, False, 0, 5, BeigeColor, 6, False, tr_AllChars)) > 0);
        'opponent': Result := Trim(GetTextAtEx(393, 47, 10, SmallChars, False, False, 0, 5, NameColor, 50, False, tr_AllChars));
      end;
    end;
    Last edited by Frt; 06-22-2009 at 01:27 AM.

  12. #12
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Sometimes you have to play with the max spacing and the min spacing values to find the text, it happens to me a lot

  13. #13
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    Quote Originally Posted by Frt View Post
    Think I figured out, it's SmallChars. It finds the whole text except a 'i'. Perhaps the 'i' in the Char folder is broken?

    Richard: It was the orange test with 'Rating'. Tested on that since I didn't have to enter all the time to search for that

    This can be closed as I have solved it. This is what I ended up with if anyone is curious (Richard )
    SCAR Code:
    function Return(S: String): Variant;
    begin
      case Lowercase(S) of
        'rating': Result := StrToIntDef(GetNumbers(GetTextAtEx(96, 40, 50, SmallChars, False, False, 0, 5, OrColor, 6, False, tr_AllChars)), 0)
        'charged': Result := StrToIntDef(GetNumbers(GetTextAtEx(350, 42, 50, SmallChars, False, False, 0, 5, BeigeColor, 6, False, tr_AllChars)), 0);
        'hunting': Result := (pos('ng:', GetTextAtEx(350, 47, 50, SmallChars, False, False, 0, 5, BeigeColor, 6, False, tr_AllChars)) > 0);
        'opponent': Result := Trim(GetTextAtEx(393, 47, 10, SmallChars, False, False, 0, 5, NameColor, 50, False, tr_AllChars));
      end;
    end;
    My coords were loads different to that, probably my problem

    With the hunting part (I assume you are trying to work out whether you are being hunted or not?), well I'd use a GetColor call here as it would be considerably more efficient.

    Mind if I take those values?

  14. #14
    Join Date
    Oct 2007
    Location
    Denmark
    Posts
    409
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Richard View Post
    My coords were loads different to that, probably my problem

    With the hunting part (I assume you are trying to work out whether you are being hunted or not?), well I'd use a GetColor call here as it would be considerably more efficient.

    Mind if I take those values?
    Go ahead and use them

Thread Information

Users Browsing this Thread

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

Tags for this Thread

Posting Permissions

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