Results 1 to 12 of 12

Thread: [Help]Creating my own Font

  1. #1
    Join Date
    Nov 2012
    Posts
    7
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default [FIXED]Creating my own Font

    Ok, currently I'm experimenting with Simba and working towards making a mining bot for an rsps.

    This thread caught my eye: http://villavu.com/forum/showthread.php?t=60451

    So I gave it a shot in a hope to create the correct UpTexts for the rsps ingame.

    My aim was to help Simba recognise the UpText Font when the mouse hovers over an iron ore rock: The UpText would be 'Mine Rocks / 3 more options'.

    I created a new folder named 'RspsUpChars' and placed it in the directory: 'C:\Simba\Fonts'. Within this folder I have the individual .bmp files for the letters: M, i, n, e, R, o, c, k, s. I didn't feel the need to have every letter in the alphabet since I just want this to work for a mining bot.

    Now, I'm assuming if I restart Simba that the fonts will load and be implemented into Simba.. so to test if my rsps UpText works I made this script:

    Code:
    program CheckFont;
    {$i SRL\SRL.simba}
    
    function CheckText:boolean;
    var
      X, Y: Integer;
    begin
      if FindObj(X, Y, 'ine', 1186611, 20) then //Only using the UpText 'ine' in 'Mine' to test this
      begin
        Mouse(X, Y, 5, 5, false); //Right clicks the rock
        Mouse(X, Y+25, 5, 5, true); //Left clicks option 'Mine Rocks' (Later hope to use Option or WaitOption functions
     if I can get a hang of creating fonts..)
      end;
    end;
    
    begin
    CheckText;
    end.
    When I ran the script the mouse would search for the object and jump from rock to rock but never recognising the UpText.

    At this point I took a look at the UpChars folder (in directory 'C:\Simba\Fonts') and noticed that the images had a red fill for the shadows of the letters. So I created a new set of bmp files for the letters 'M, i, n, e, R, o, c, k, s', this time including the shadows in a red fill (code = 255).

    After running the script again, it's the same as before: the mouse will jump between rocks but never identifying the UpTexts and so never right clicking and left clicking the option to mine the rocks

    I'd really appreciate if someone nudged me in the right direction, I'm new to Simba and scripting so for any help offered I give my thanks in advance

    Oh and this is what my Bmps look like (rescaled heavily.. ^^):


    EDIT: I took a good look at the Bpms that are already in Simba in the UpChars folder and found that they were all 14 pixels in height and had 3 pixels below the letter itself, so I did my Bpms of the rsps again and this is what it looks like:



    Thanks to Wardancer who assisted me in IRC chat I found that I could use the GetTextAtExWrap function to show me what Simba was seeing in the UpText section (i.e. the top left corner of the client).

    Code:
    procedure GetText;
    begin
    Wait(5000);
    writeln((ExtractFromStr((replace((lowercase(GetTextAtExWrap(0, 0, 90, 25, 0, 10, 1, 12896199, 50, RspsUpChars))), '.!', 'i')), Letters)));
    end;
    0, 0, 90, 25 - The coords where Simba will look for any text, 90 units across 25 down from top left corner of client screen covers the UpText area for 'Mine Rocks'.

    0, 10, 1 - Spacing (I have no idea what the spacing is suppose to be or if it's even right).

    12896199, 50 - The color and tolerance of the UpText (color I selected was the white/grey ish color in the UpText 'Mine' ingame.

    RspsUpChars - The folder in directory 'C:\Simba\Fonts' where my Bmps are for the letters M, i, n, e, R, o, c, k, s.

    Using this code I was able to move my mouse over the rocks to bring up the UpText 'Mine Rocks'. However in the debug box I was returned: 'scscn' and sometimes 'scsc' instead of 'Mine'. Has anyone got any idea what I'm suppose to do?

    Edit: Fixed, used LoadFont(RspsUpChars, True); at the beginning of my GetText procedure before the wait and it worked Thank you Hobbit !
    Last edited by runw; 12-03-2012 at 12:49 AM.

  2. #2
    Join Date
    Dec 2011
    Location
    Nj
    Posts
    2,341
    Mentioned
    1 Post(s)
    Quoted
    18 Post(s)

    Default

    Im not much, any, good with bitmaps and fonts. However, I am assuming that the bitmap you have should be black and white?
    That makes most sense to me.
    ~Rez

    For the basics of the basics of pascal, try my TuT. ||Photoshop Editing ||MapleResourceDung Script || Book a flight! BuySellTrip

  3. #3
    Join Date
    Nov 2012
    Posts
    7
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Rezozo View Post
    Im not much, any, good with bitmaps and fonts. However, I am assuming that the bitmap you have should be black and white?
    That makes most sense to me.
    ~Rez
    Yes I did try this before filling the shadows in red, but it's the same result either way. I'm guessing I have yet to load/implement this new font into Simba.. but the tutorial wasn't clear how and I have no idea :/

  4. #4
    Join Date
    Nov 2008
    Location
    Norway, Alesund
    Posts
    924
    Mentioned
    0 Post(s)
    Quoted
    37 Post(s)

    Default

    Quote Originally Posted by runw View Post
    Yes I did try this before filling the shadows in red, but it's the same result either way. I'm guessing I have yet to load/implement this new font into Simba.. but the tutorial wasn't clear how and I have no idea :/
    should bitmaps size be orignal font size? As i see at M it has 1 pixel from middle out (even if it's rescaled it should appear like that)

  5. #5
    Join Date
    Dec 2011
    Location
    Nj
    Posts
    2,341
    Mentioned
    1 Post(s)
    Quoted
    18 Post(s)

    Default

    What I mean is, should the text not be white? What ever you do not need, should be black, what you do need should be white. So background should be black, text white. No red.
    ~Rez

    For the basics of the basics of pascal, try my TuT. ||Photoshop Editing ||MapleResourceDung Script || Book a flight! BuySellTrip

  6. #6
    Join Date
    Nov 2012
    Posts
    7
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Laimonas171 View Post
    should bitmaps size be orignal font size? As i see at M it has 1 pixel from middle out (even if it's rescaled it should appear like that)
    Sorry I don't understand what is meant by "bitmaps size be original font size".. what is the original font size? And I'm not following you on the 1 pixel out from M. But yes this is rescaled but I tried my best to give a somewhat accurate representation of my bmps.

    Quote Originally Posted by Rezozo View Post
    What I mean is, should the text not be white? What ever you do not need, should be black, what you do need should be white. So background should be black, text white. No red.
    ~Rez
    You're right and this is how my bmps were first time when I tried (they were white letters with black background and no red) but the same thing happens, Simba wont recognise the rsps font.

  7. #7
    Join Date
    Nov 2008
    Location
    Norway, Alesund
    Posts
    924
    Mentioned
    0 Post(s)
    Quoted
    37 Post(s)

    Default

    Quote Originally Posted by runw View Post
    Sorry I don't understand what is meant by "bitmaps size be original font size".. what is the original font size? And I'm not following you on the 1 pixel out from M. But yes this is rescaled but I tried my best to give a somewhat accurate representation of my bmps.
    .
    selected area where pixels does't match, have no idea how to get that with recaling so it may cause problems thats. idk maybe not a big deal and it appeared after rescaling though

  8. #8
    Join Date
    Nov 2012
    Posts
    7
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Laimonas171 View Post
    selected area where pixels does't match, have no idea how to get that with recaling so it may cause problems thats. idk maybe not a big deal and it appeared after rescaling though
    Ok I took a good look at the Bpms that are already in Simba in the UpChars folder and found that they were all 14 pixels in height and had 3 pixels below the letter itself, so I did my Bpms of the rsps again and this is what it looks like:


  9. #9
    Join Date
    Feb 2007
    Location
    Het ademt zwaar en moedeloos vannacht.
    Posts
    7,211
    Mentioned
    26 Post(s)
    Quoted
    72 Post(s)

    Default

    C:\Simba\Fonts\UpCharsEx yw

  10. #10
    Join Date
    Mar 2006
    Posts
    13,241
    Mentioned
    228 Post(s)
    Quoted
    267 Post(s)

    Default

    You need to actually load up the custom font or Simba will continue to use default.

    See: http://docs.villavu.com/simba/scriptref/ocr.html
    STOP PM'ING ME

  11. #11
    Join Date
    Nov 2012
    Posts
    7
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Hobbit View Post
    You need to actually load up the custom font or Simba will continue to use default.

    See: http://docs.villavu.com/simba/scriptref/ocr.html
    Thanks a lot dude! Works now

  12. #12
    Join Date
    Dec 2011
    Location
    Nj
    Posts
    2,341
    Mentioned
    1 Post(s)
    Quoted
    18 Post(s)

    Default

    Glad I wasn't able to help
    Props guys, wawy to steaw my thundew
    ~Rez

    For the basics of the basics of pascal, try my TuT. ||Photoshop Editing ||MapleResourceDung Script || Book a flight! BuySellTrip

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
  •