Results 1 to 11 of 11

Thread: Big Map - Cavas - Bitmap Finding

  1. #1
    Join Date
    Dec 2008
    Location
    In a galaxy far, far away...
    Posts
    584
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Big Map - Cavas - Bitmap Finding

    EDIT: [THIS ISSUE HAS BEEN FIXED!]

    Hi Everyone!

    I've been working on this new feature for a few hours, trying to get it right. I've got an idea of searching for a really accurate location of the macroing player, by opening up the World Map, and locating the "You Are Here" position and then using trigonometry to finding distances in pixels between that and name of the closest city. (please ask me to expand if your hacing difficulty understanding, I might just post pictures to guide you.) I've got as far as, getting client's DC screen, copying it onto the canvas and then getting my bitmap of the arrow and trying to locate it. The problem I'm getting is that it hangs on trying to search for the bitmap, and just hangs then crashes SCAR 3.15b....


    WORKING CODE!
    SCAR Code:
    {------------------------------------------------------------------------------------------------------------------------------
     Script: Location Finder [BETA]              
     By: Nadeem (Canvas idea from Wizzup?)
     Note: This only finds the arrow, I will be using this to find Accurate player positioning.            
    ------------------------------------------------------------------------------------------------------------------------------}


    var
      x, y, bmpLoc, ClientBMP: Integer;

    function FindMe(var x, y: Integer): Boolean;
    var
      DC: HDC;
    begin
      try
        Status('Finding Bitmap');
        DC := GetTargetDC;
        bmpLoc := BitmapFromString(37, 35, 'beNrFlz0OwjAMhbNwKW7DFZ' +
         'jZWHoODsLOxsAlYKoYqSi4etVrlCZOSMFUHqrG9tfEL3/OBc9mvYK5ZU9hHnE' +
         '4bp1YNRSBTJJ1Pu0cnD+F+iAxyVMSC6JvX4yKDjJi74fREJuComnuH6Wg+1EH' +
         '+X69uFebhAYg8RT/eclYIH+0deLjNhhHiSAxNGVZbGIHAyJxYn3/fHWNpD3vp' +
         '+rI+wDqGmmFW4DjL/nfiZMBCdQYJbJGCovjhipEf0OaEDX/mYnYjmOLlxQLSe' +
         'R7SjnAoQTRcBJ9050hs+ikqCBWs+iMimRTlTigysoSgQ7qAmBCnQVRZVekcuJ' +
         'yFnHjhFKFp0iX07N8sYVmFEmkJJRVSAoHzaSIKblCIRU4g94Z185SmcbzznJV' +
         'sVwzjXcEy/3OeDe3PKsYn8Tsz5mWp2jjO8J/b0D297sf3l7fk5g7BQ==');
         
        SetTransparentColor(bmpLoc, 0);
        ClientBMP := BitmapFromString(765, 500, '');
        CopyClientToBitmap(ClientBMP, 0, 0, 500, 765);
        SafeDrawBitmap(ClientBMP, GetDebugCanvas, 0, 0);
        SetTargetDC(GetBitmapDC(ClientBMP));
       
        if FindBitmapSpiralTolerance(bmpLoc, x, y, 0, 0, 765, 500, 39) then
        begin
          IncEx(x, 19);
          IncEx(y, 18);
          Result := True;
        end;
      except
        Writeln('Unable to find location arrow...');
      finally
        SetTargetDC(DC);
        FreeBitmap(ClientBMP);
        FreeBitmap(bmpLoc);
      end;
    end;


    procedure ScriptTerminate;
    begin
      FreeBitmap(ClientBMP);
      FreeBitmap(bmpLoc);
    end;


    begin
      if FindMe(x, y) then
        Writeln('Found Points Centered:  ' + IntToStr(x) + ', ' + IntToStr(y))
      else
        Writeln('None found.');
    end.
    Last edited by Nadeem; 04-26-2009 at 02:19 PM.

  2. #2
    Join Date
    Jan 2009
    Location
    Turlock/LA, California
    Posts
    1,494
    Mentioned
    3 Post(s)
    Quoted
    66 Post(s)

    Default

    instead of a bitmap, couldn't u use a DDTM to find the center of the glowing yellow arrows?

    or just a dtm with the mainpointtolerance:=255

    i think that would find it easier (i would just quickly try it out and if u don't like it, change it back)

  3. #3
    Join Date
    Dec 2008
    Location
    In a galaxy far, far away...
    Posts
    584
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Nah I know those work, but I'm just afraid that sometimes if it finds other similar colors on the map, such as bank for example, it may have chances of messing up :S Although, I have been experimenting a bit with colors using Auto Color Aid v2 and figuring out some really good color ranges and HSLs to use in order for it to find only the array It seems to be working perfectly, but im moving around in the map to places i have a doubt for just incase

    Edit: Using color = CHAOS... Because for example, the colors are extremely similar when toleranced, it easily highlights the entire word "Kingdom of Misthalin"
    Last edited by Nadeem; 04-26-2009 at 01:36 PM.

  4. #4
    Join Date
    Jan 2009
    Location
    Turlock/LA, California
    Posts
    1,494
    Mentioned
    3 Post(s)
    Quoted
    66 Post(s)

    Default

    if you make you dtm big enough (like have the subpoints near the far ends of all the arrows) i think it will work well. just a thought though. and i also love autocoloring. its amazing!

    EDIT: gunna go to bed, so i will test out ur script with a dtm i made and see how it works in the morning. i will so go around to any yellowish objects on the map to see if it messes up around them.

  5. #5
    Join Date
    Dec 2008
    Location
    In a galaxy far, far away...
    Posts
    584
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by x[Warrior]x3500 View Post
    if you make you dtm big enough (like have the subpoints near the far ends of all the arrows) i think it will work well. just a thought though. and i also love autocoloring. its amazing!

    EDIT: gunna go to bed, so i will test out ur script with a dtm i made and see how it works in the morning. i will so go around to any yellowish objects on the map to see if it messes up around them.
    kk Especially try the big bolded words in yellow + orange

    - ty! good nite!

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

    Default

    Well, it doesn't find anything when I run it, but it does run successfully, and doesn't hang or anything. Although it does take quite a long time to run.

  7. #7
    Join Date
    Dec 2008
    Location
    In a galaxy far, far away...
    Posts
    584
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    NVM everybody! I was able to fix it with a few small tricks :P

    I posted new working code in the first post for your guys to test if you would like!

  8. #8
    Join Date
    Jan 2009
    Location
    Turlock/LA, California
    Posts
    1,494
    Mentioned
    3 Post(s)
    Quoted
    66 Post(s)

    Default

    Quote Originally Posted by Nadeem View Post
    if FindBitmapSpiralTolerance(bmpLoc, x, y, 0, 0, 765, 500, 39) then
    begin
    IncEx(x, 19);
    IncEx(y, 18);
    Result := True;
    end;
    that was nifty. thx i will test asap


    EDIT:
    Successfully compiled (55 ms)
    Unable to find location arrow...
    None found.
    Successfully executed

    Last edited by x[Warrior]x3500; 04-26-2009 at 11:57 PM.

  9. #9
    Join Date
    Dec 2008
    Location
    In a galaxy far, far away...
    Posts
    584
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    :S did you use the entire code or just that piece?

    if it says "Unable to find location arrow..." that means it was never able to search for the arrow, and Im guessing you probably did not select the DC properly before running it?

    1. Re-Start SCAR
    2. Drag the crosshair in SCAR onto the RS screen
    3. Maybe add ActivateClient; after the last begin.
    4. Start!

    Edit: Still working perfectly for me... I tried it on regular window and SMART.

  10. #10
    Join Date
    Jan 2009
    Location
    Turlock/LA, California
    Posts
    1,494
    Mentioned
    3 Post(s)
    Quoted
    66 Post(s)

    Default

    1. Re-Start SCAR

    maybe thats it... probably is lol. retesting

    do u start it w/ the map open or not? (i have tried both, but i think u r starting it w/ the map open)... still cant get it. i set the DC correctly. but for sum reason, it wont work in varrock bank for me. where are you testing it?
    Last edited by x[Warrior]x3500; 04-27-2009 at 03:29 AM.

  11. #11
    Join Date
    Dec 2008
    Location
    In a galaxy far, far away...
    Posts
    584
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by x[Warrior]x3500 View Post
    1. Re-Start SCAR

    maybe thats it... probably is lol. retesting

    do u start it w/ the map open or not? (i have tried both, but i think u r starting it w/ the map open)... still cant get it. i set the DC correctly. but for sum reason, it wont work in varrock bank for me. where are you testing it?
    Hi, yes with the map open, since its not a complete function yet. Make sure world map is open, and you can see the "You Are Here" text and the crosshair like arrow of your location on the map.

    I've tested it from draynor and GE, worked from both sides.

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
  •