Results 1 to 11 of 11

Thread: Scanning bitmaps for numbers and translating them to text numbers.

  1. #1
    Join Date
    Feb 2009
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Scanning bitmaps for numbers and translating them to text numbers.

    This is in relation to a post I sent last month.
    I was trying to make a walk script that reads the chat box takes the coords and uses them to move.

    So far everything works accordingly regarding basic walk:
    Code:
    procedure Walk(Sq: String);
    begin
      ClickMouse(130, 10, True);
      MoveMouse(209, 261);
      ClickMouse(209, 261, True);
      Wait(100);
      SendKeysvb('m', False);
      SendKeysvb('{DEL}{DEL}{DEL}{DEL}{DEL}{BS}{BS}{BS}{BS}{BS}', False);
      SendKeys(Sq);
      Wait(100);
      MoveMouse(1020, 40);
      ClickMouse(1020, 40, True);
      Wait(100);
      SendKeysvb('~', False);
      Wait(1000);
      ClickMouse(135, 10, True);
      Wait(2000);
    end;
    I want to be able to get an array of bitmapfromstring numbers and convert them to typeable text i am not sure what to do.
    Right now I grab text this way:
    Code:
    procedure WakeUp;
    begin
    if FindBitmapIn(wake, x, y, 350, 455, 600, 485)then
     begin
     if FindColor(a, b, 33023, 250, 455, 600, 485) then
      begin
      ClickMouse(a, b, True);
      Wait(1500);
      SendKeysvb('Yes?^~', False);
      Wait(2500);
      MoveMouse(350, 530);
      ClickMouse(350, 530, True);
      SendKeysvb('whassup?^~', False);
      Wait(2500);
      end;
     end;
    end;
    
    wake := BitmapFromString(35, 10, 'beNq7d/L+PfohhgYGICJJJUEt' +
           'p69uj14WBFQDJIFs2lkEsQVoBcQuZO1zDvYASec5ttvOLIGIT9rbD' +
           'JFq31mFxyK4MiADzbqjlzdCzETWvvfCaogDIOIQ7UARiGD15jysFk' +
           'GUAd0GRGh2QURwBR2aUcgIq0VY9eKKETwWEYwjPBbhT3VwNjBegIx' +
           '1J+eSHXRE+gg5liG2kJoYiE/M1EQAnWOLVA==');
    It works beautifully. Only now I need to capture "walk 3578"
    so that the 3578 gets tralslated to the "Sq" in the Walk procedure.
    I have the individual bitmap numbers, I just don't know what to do with them.
    Any advice?

  2. #2
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    if(WhereToWalk = 'walk '+IntToStr(Path[i]))then
    Walk+Path;

    something like that?

  3. #3
    Join Date
    Nov 2006
    Posts
    2,369
    Mentioned
    4 Post(s)
    Quoted
    78 Post(s)

    Default

    Is this for runescape? if so you could use something like
    GetChatBoxText(Line, TextCol: Integer): String
    or
    GetTextAtEx(x, y, 0, SmallChars, False, False,
    0, 1, -1, 80, False, tr_AllChars): string; if you dont wanna use srl..
    Quote Originally Posted by DeSnob View Post
    ETA's don't exist in SRL like they did in other communities. Want a faster update? Help out with updating, otherwise just gotta wait it out.

  4. #4
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    I'm not sure exactly what you're asking for help with.

    @antti mies: No, this isn't for Runescape.

  5. #5
    Join Date
    Feb 2009
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by senrath View Post
    I'm not sure exactly what you're asking for help with.

    @antti mies: No, this isn't for Runescape.
    That is correct, this is not for RS. This is for something different entirely.
    Sorry for not clarifying. it is a bit vague isn't it.
    Let me see if I can clear this up a bit.
    The only way I can get Chat box text is if I search for it in Bitmap form. Hence "FindBitmapIn". The image from "wake := BitmapFromString(35, 10, 'beNq7d/L+PfohhgYGICJJJUEt'..." is "hello?" in green font.
    Someone will write to me, say, "walk 1667"
    I want to be able to "if FindBitmapIn(walkorder...) then" to find "walk"
    THEN somehow capture the "1667" using bitmap recognition to return a string of "1667" for the "Sq" in the "procedure Walk(Sq: String);"
    I have made individual BMP files of numbers 0-9 in the font required.
    I need to know how to convert the image of numbers to a string of numbers.
    Hope this makes more sense.

  6. #6
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    Okay, that makes a bit more sense. Now, are the numbers always in the same place? If so, you can search for each number in each spot, then stick the results together.

  7. #7
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You can also use a gettextat or something to grab the string, then use GetNumbers.

    ~Sandstorm

  8. #8
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    Quote Originally Posted by Sandstorm View Post
    You can also use a gettextat or something to grab the string, then use GetNumbers.

    ~Sandstorm
    He's tried that. It doesn't work.

  9. #9
    Join Date
    Feb 2009
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by senrath View Post
    Okay, that makes a bit more sense. Now, are the numbers always in the same place? If so, you can search for each number in each spot, then stick the results together.
    yes basically it will come after the walk read bitmap.
    a space " " worth of text. if there is no "walk" text then I don't want it doing anything.
    I will search for walk within the area 251, 467 and 481, 486
    and the numbers will be 1 to 5 digits.
    For example "3" or "12046" Now I was told I should make an array of bitmap numbers (0-9) which I have but how to translate that into code I am stuck.

  10. #10
    Join Date
    Nov 2006
    Posts
    2,369
    Mentioned
    4 Post(s)
    Quoted
    78 Post(s)

    Default

    Post a screenshot?
    Edit: and also the 0-9 bitmaps like you did for the walk bitmap(in text format)
    Edit2:This is what i have made for you... i would just need the screenshots etc..
    SCAR Code:
    program New;

    var
      I, II, x, y, xx, yy, Wake,bmb0,bmb1,bmb2,bmb3,bmb4,bmb5,bmb6,bmb7,bmb8,bmb9: integer;
      IntArray, IntArray2: Array of Integer;

    begin
      wake := BitmapFromString(35, 10, 'beNq7d/L+PfohhgYGICJJJUEt' +
           'p69uj14WBFQDJIFs2lkEsQVoBcQuZO1zDvYASec5ttvOLIGIT9rbD' +
           'JFq31mFxyK4MiADzbqjlzdCzETWvvfCaogDIOIQ7UARiGD15jysFk' +
           'GUAd0GRGh2QURwBR2aUcgIq0VY9eKKETwWEYwjPBbhT3VwNjBegIx' +
           '1J+eSHXRE+gg5liG2kJoYiE/M1EQAnWOLVA==');
      IntArray := [bmb0,bmb1,bmb2,bmb3,bmb4,bmb5,bmb6,bmb7,bmb8,bmb9];
      if FindBitmapIn(wake, xx, yy, 300, 430, 650, 550) then
      for I := 0 to 5 do
      for II := 0 to 9 do
      begin
        WriteLn(Inttostr(II));
        if FindBitmapIn(IntArray[II], x, y, xx+37+i*7, yy-5, xx+44+i*7, yy+12) then
        begin
          WriteLn('Letter ' + IntToStr(I)+' is number' + IntToStr(II));
          SetLength(IntArray2, Length(IntArray2)+1);
          IntArray2[I] := II;
          II := 9;
        end;
      end;
    end.
    Quote Originally Posted by DeSnob View Post
    ETA's don't exist in SRL like they did in other communities. Want a faster update? Help out with updating, otherwise just gotta wait it out.

  11. #11
    Join Date
    Nov 2006
    Location
    in a house on lakemichigan
    Posts
    21
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Now this is interesting !!!

    It's been a long time since i scripted with scar so I'm not going to attempt to make the changes myself But ... Id like to suggest improvements on this design so that it could be submitted to scar for as an additional function where I'm sure that it will be well used!!!

    change the program to a function returning a string like
    function getCustomTextIn(customfont: array; x1, y1, x2, y2:integer):string;
    sorry not sure on syntax

    returning a string will be easier for most users than an array

    Make IntArray array a multidimensional array or an array of type so that we can have width and height as well as font glyphs.

    Add variables and sort array for the widest, narrowest and tallest glyph values,

    First scan the screen for text, storing the coordinates of each letter found in an array. Scan the array for the lowest x y combination to find the first letter. Store the first letter

    Loop to find the rest of the text

    Use the coordinate, letter_width, and spacing between letters to adjust the start point of the box to scan for the next letter.

    get width of next letter to scan, set endpoint and scan.
    if letter found store it, set start point cords, get next letter width ...

    if all letters were scanned and NO letter was found clear the array used before the loop to find the first letter. Extend search box end x to the end of the line, scan each letter storing cords of any found letters in the cleared array

    at this point you have a great way to search for test in a single line you could ad multi-line text finding by adding an outer loop and adjusting the search box start position down by the max font height from the original start point and loop down the screen

    vary nice work antti mies I think that these changes would make this function vary popular for scripting games other then runescape

    at this point this function is ready to add to scar but it could use supporting tutorial like how to set the font array and a good tutorial on how to make bitmap masks

    thanks for posting this and I really do hope that you develop this into a working find text solution. The scar community really could use it to find unusual fonts in other games

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. The numbers are attacking me =S
    By Floor66 in forum OSR Help
    Replies: 7
    Last Post: 04-12-2008, 10:43 AM
  2. How to get numbers???
    By RusinaRange in forum OSR Help
    Replies: 1
    Last Post: 12-05-2007, 01:29 PM
  3. Numbers recognition
    By deiwis in forum OSR Help
    Replies: 9
    Last Post: 07-27-2007, 05:29 AM

Posting Permissions

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