Results 1 to 24 of 24

Thread: getTextAt, getTextAtEx, getTextAtExpWrap

  1. #1
    Join Date
    May 2012
    Posts
    17
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default getTextAt, getTextAtEx, getTextAtExpWrap

    So, I am fairly new to this whole Simba/SRL thing and I was just wondering if anyone could possibly explain to me what the difference between those 3 were, and which one would the best to use for reading text that is NOT runescape-related, such as reading the font "Tahoma" off a webpage or something similiar to that. Basically, I want to read a font (such as Tahoma) NOT on runescape. Any help would be greatly appreciated, thanks.

  2. #2
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    I don't have time to finish it but it gives a hint on how to load your own font.. When I get some time I'll edit or finish it.. Just load the font into a finder function.

    Simba Code:
    {$I SRL/SRL.Simba}
    {$I SRL/SRL/Misc/Debug.Simba}

    Procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
      with Players[0] do
      begin
        Name        := '';
        Pass        := '';
        Pin         := '';
        WorldInfo   := [27, 42, 45, 46, 48, 52, 59, 70, 72, 78, 79, 87, 104, 115, 117];
        BoxRewards  := ['XP','xp','lamp'];
        LampSkill   := Skill_Slayer;
        Active      := True;
      end;
    end;

    Function GetTextCustomFont: String;
    var
      Font, Testing: TFont;
    begin
      Font:= TFont.Create;
      Font.Style:= [fsBold, fsItalic];
      Font.Color:= 65535;
      Font.Name:= 'Courier';
      Font.Height:= -11;
      Font.PixelsPerInch:= 96;


      //Result := GetTextAtExWrap(4, 4, 50, 10, 0, 5, 2, 65535, 10, Font.Name);

      Font.Free;
    end;

    begin
      {$IFDEF SMART}
        SMART_SERVER:= 72;
        SMART_SIGNED:= True;
        SMART_MEMBERS:= True;
        SMART_SUPERDETAIL:= False;
      {$ENDIF}

      SetupSRL;
      DeclarePlayers;
      GetTextCustomFont;
    end.
    I am Ggzz..
    Hackintosher

  3. #3
    Join Date
    May 2012
    Posts
    17
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I tried doing this:
    Simba Code:
    program ReadingTextUsingFont;

    Function GetTextCustomFont: String;
    var
      Font: TFont;
    begin
      Font:= TFont.Create;
      Font.Style:= [fsBold, fsItalic];
      Font.Color:= 0;
      Font.Name:= 'Tahoma';
      Font.Height:= 10;
      Font.PixelsPerInch:= 96;
      Result := GetTextAtExWrap(3,3,35,18,0,5,1,0,20,Font.Name);
      Font.Free;
    end;

    begin
    Writeln(getTextCustomFont);
    end.

    And I got this error:
    Error: Exception: Font [Tahoma] not found. at line 13
    Line 13 is: Result := GetTextAtExWrap(3,3,35,18,0,5,1,0,20,Font.Name);

    Please help?

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

    Default

    Not sure you're allowed to use that font. Isn't it only the fonts from Simba\Fonts that you can use and any you create yourself...

  5. #5
    Join Date
    May 2012
    Posts
    17
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by abu_jwka View Post
    Not sure you're allowed to use that font. Isn't it only the fonts from Simba\Fonts that you can use and any you create yourself...
    Well, I guess that's partially what I'm trying to ask. How can I create my own font?

  6. #6
    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 Galaxy View Post
    Well, I guess that's partially what I'm trying to ask. How can I create my own font?
    I think this still works:
    http://villavu.com/forum/showthread....highlight=Font

  7. #7
    Join Date
    May 2012
    Posts
    17
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by abu_jwka View Post
    So basically after I'm done creating the font that I want, I can just add it to the Simba/fonts folder and then I can use it inside the getTextAt methods?

  8. #8
    Join Date
    Dec 2007
    Posts
    289
    Mentioned
    4 Post(s)
    Quoted
    86 Post(s)

    Default

    Quote Originally Posted by Galaxy View Post
    So basically after I'm done creating the font that I want, I can just add it to the Simba/fonts folder and then I can use it inside the getTextAt methods?
    Yes.

    Your Font bitmaps would be located in:
    \Simba\Fonts\FontName\ (\Simba\Fonts\Tahoma\ for example)

  9. #9
    Join Date
    May 2012
    Posts
    17
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by honeyhoney View Post
    Yes.

    Your Font bitmaps would be located in:
    \Simba\Fonts\FontName\ (\Simba\Fonts\Tahoma\ for example)
    Ohh alright I see. Another question, does it matter what size the letters are?
    (Not referring to the size of the bitmaps, but the size of the letters themself)

  10. #10
    Join Date
    Dec 2007
    Posts
    289
    Mentioned
    4 Post(s)
    Quoted
    86 Post(s)

    Default

    Quote Originally Posted by Galaxy View Post
    Ohh alright I see. Another question, does it matter what size the letters are?
    (Not referring to the size of the bitmaps, but the size of the letters themself)
    Yes it does. Each font size will require a different set of bitmaps.
    For example; you can't use a set of bitmaps made from Tahoma size 12 to identify Tahoma size 14 (potentially you could get close, but it wouldn't be accurate and it is much better to create a new set).

    Your Fonts folder would have to contain /Tahoma12/ and /Tahoma14/ (for example) if you wanted to accurately identify the text on the page that uses the font Tahoma in both size 12 and 14.

  11. #11
    Join Date
    May 2012
    Posts
    17
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by honeyhoney View Post
    Yes it does. Each font size will require a different set of bitmaps.
    For example; you can't use a set of bitmaps made from Tahoma size 12 to identify Tahoma size 14 (potentially you could get close, but it wouldn't be accurate and it is much better to create a new set).

    Your Fonts folder would have to contain /Tahoma12/ and /Tahoma14/ (for example) if you wanted to accurately identify the text on the page that uses the font Tahoma in both size 12 and 14.
    Ah I see. ;P Alright thanks a lot man. And I heard that the text has to be white, and the background black, correct?

  12. #12
    Join Date
    Dec 2007
    Posts
    289
    Mentioned
    4 Post(s)
    Quoted
    86 Post(s)

    Default

    Quote Originally Posted by Galaxy View Post
    Ah I see. ;P Alright thanks a lot man. And I heard that the text has to be white, and the background black, correct?
    The set of bitmaps must have white characters with a black background yes.

    However, it can still identify text that is other colors (providing you set it to search for the text in a specific color).

    The white characters with black background is necessary as they're used as a bitmap mask (think of your font set as a silhouette or template for the shapes it searches for).

    Edit: hope that made sense... xD Don't hesitate to ask again if I confused you... :L

  13. #13
    Join Date
    May 2012
    Posts
    17
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by honeyhoney View Post
    The set of bitmaps must have white characters with a black background yes.

    However, it can still identify text that is other colors (providing you set it to search for the text in a specific color).

    The white characters with black background is necessary as they're used as a bitmap mask (think of your font set as a silhouette or template for the shapes it searches for).

    Edit: hope that made sense... xD Don't hesitate to ask again if I confused you... :L
    Answered my next question. xD My next question was is it possible to read text of the same font & size, but different colour, but you already answered it. :P Thanks. Also, could you explain what it means by horizontal spacing and vertical spacing? (The parameters inside the getTextAt methods)

  14. #14
    Join Date
    Dec 2007
    Posts
    289
    Mentioned
    4 Post(s)
    Quoted
    86 Post(s)

    Default

    Quote Originally Posted by Galaxy View Post
    Answered my next question. xD My next question was is it possible to read text of the same font & size, but different colour, but you already answered it. :P Thanks. Also, could you explain what it means by horizontal spacing and vertical spacing? (The parameters inside the getTextAt methods)
    As far as I'm aware* vertical spacing is simply the space between lines of text.
    The vertical spacing (distance) between this line and the line above is 5 pixels (for example).
    Often there is a minimum and maximum value required.

    Horizontal spacing is the distance between each character. This is generally uniform so it only takes 1 value.

    *(I'm no expert, this is all from my experience of messing around with those functions until they work lol)

  15. #15
    Join Date
    May 2012
    Posts
    17
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by honeyhoney View Post
    As far as I'm aware* vertical spacing is simply the space between lines of text.
    The vertical spacing (distance) between this line and the line above is 5 pixels (for example).
    Often there is a minimum and maximum value required.

    Horizontal spacing is the distance between each character. This is generally uniform so it only takes 1 value.

    *(I'm no expert, this is all from my experience of messing around with those functions until they work lol)
    Oh I see, so if there was more than 1 line of text you would want to read, you would put the minimal and maximum spacing between each line?

  16. #16
    Join Date
    Dec 2007
    Posts
    289
    Mentioned
    4 Post(s)
    Quoted
    86 Post(s)

    Default

    Quote Originally Posted by Galaxy View Post
    Oh I see, so if there was more than 1 line of text you would want to read, you would put the minimal and maximum spacing between each line?
    I would assume so. I dont think I've ever needed to read more than 1 line at a time though! (and if I have, I've done it 1 line at a time :P)

  17. #17
    Join Date
    May 2012
    Posts
    17
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by honeyhoney View Post
    I would assume so. I dont think I've ever needed to read more than 1 line at a time though! (and if I have, I've done it 1 line at a time :P)
    Ah I see. :P Alright cool thanks.

    One last question (kind of irrelevant to the thread topic) but one of my friend's wants to know if you can use this on private servers? (Like the actual runescape methods, like the walking methods, grabbing methods, etc etc, stuff like that) Is it possible?

  18. #18
    Join Date
    Dec 2007
    Posts
    289
    Mentioned
    4 Post(s)
    Quoted
    86 Post(s)

    Default

    Quote Originally Posted by Galaxy View Post
    Ah I see. :P Alright cool thanks.

    One last question (kind of irrelevant to the thread topic) but one of my friend's wants to know if you can use this on private servers? (Like the actual runescape methods, like the walking methods, grabbing methods, etc etc, stuff like that) Is it possible?
    From what I've seen (I've never tried personally), they don't work. I know Uptext doesn't work, but I guess the only way to find out is to try!

    It'd probably still be worth checking out the SRL Functions/Procedures to see how it's done and then customise it slightly to work with the private server.

  19. #19
    Join Date
    May 2012
    Posts
    17
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by honeyhoney View Post
    From what I've seen (I've never tried personally), they don't work. I know Uptext doesn't work, but I guess the only way to find out is to try!

    It'd probably still be worth checking out the SRL Functions/Procedures to see how it's done and then customise it slightly to work with the private server.
    Ah, I see, alright thanks I'll tell him. It is kind of interesting though because some of these private servers are so realistic that you'd think these methods would work on anything identical to runescape, but oh well xD

  20. #20
    Join Date
    May 2012
    Posts
    17
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Alright actually another question about the fonts & the bitmaps, I was looking at the some of the images of the fonts inside Simba/Fonts and I noticed that the images aren't perfectly cropped, does it matter how much black space you leave?

  21. #21
    Join Date
    Dec 2007
    Posts
    289
    Mentioned
    4 Post(s)
    Quoted
    86 Post(s)

    Default

    Quote Originally Posted by Galaxy View Post
    Alright actually another question about the fonts & the bitmaps, I was looking at the some of the images of the fonts inside Simba/Fonts and I noticed that the images aren't perfectly cropped, does it matter how much black space you leave?
    They all look uniform to me.

  22. #22
    Join Date
    May 2012
    Posts
    17
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by honeyhoney View Post
    They all look uniform to me.
    So does it matter how much blackspace you leave?

  23. #23
    Join Date
    Dec 2007
    Posts
    289
    Mentioned
    4 Post(s)
    Quoted
    86 Post(s)

    Default

    Quote Originally Posted by Galaxy View Post
    So does it matter how much blackspace you leave?
    I'd assume so. Each letter is unique and therefore has a different amount of spacing between them. (from what I can gather from the bitmaps I've seen)

  24. #24
    Join Date
    May 2012
    Posts
    17
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by honeyhoney View Post
    I'd assume so. Each letter is unique and therefore has a different amount of spacing between them. (from what I can gather from the bitmaps I've seen)
    Yeah, I'm not sure if this is a coincidence or not, but each letter's height is 13, so I'm assuming that is also important.

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
  •