Results 1 to 3 of 3

Thread: how to find the objtpa furthest away.

  1. #1
    Join Date
    Jul 2007
    Posts
    124
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default how to find the objtpa furthest away.

    EDIT: my bad, didnt use the function i had .............. sorry =(

  2. #2
    Join Date
    Mar 2006
    Posts
    3,051
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    If you're using a color search, you can use FindColorsSpiralTolerance to grab all the matching colors, then search through the array of colors backwards. It should work fine, I think.

    One of the FindObject type procedures uses FindColorsSpiralTolerance. You can modify that one to search from the end of the color array and try it out.


  3. #3
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    SCAR Code:
    {*******************************************************************************
    function FindObjTPA(var x, y: integer; color, tol, cts, ObjWidth, ObjHeight, minCount :Integer; UpText: tstringarray): Boolean;
    By: Wizzup?
    Description: Finds object using WizzyPlugin functions.
    Starts with a Spiral from x and y.
    Put in the color, Tolerance and ColorToleranceSpeed.
    If you don't know what colortolerancespeed to choose, put in -1.
    ObjWidth and ObjHeight are the parameters TPAToATPAEx uses, thus filtering
    the MS's FindColorsSpiralTolerance points in boxes defined by
    ObjWidth and ObjHeigth.
    minCount is the amount of colors it should at least find in a Object box.
    UpText, is ofcourse the text the object should have. In the Multi variant the
    UpText is a string array.

    *******************************************************************************}


    function FindObjTPA(var x, y: integer; color, tol, cts, ObjWidth, ObjHeight, minCount :Integer; UpText: tstringarray; Closest: Boolean): Boolean;
    var
       I, j, tcts: Integer;
       myPoint: TPoint;
       Points: TPointArray;
       aPoints: T2DPointArray;
       s: string;
    begin
      tcts := GetColorToleranceSpeed;
      if not (cts >= 0) and (cts <= 2) then
        cts := 1; // Standard.
      ColorToleranceSpeed(cts);
      FindColorsSpiralTolerance(x, y, Points, Color, MSX1, MSY1, MSX2, MSY2, Tol);
      aPoints := TPAtoATPAEx(Points, ObjWidth, ObjHeight);
      If Not Closest Then InvertTPA(aPoints);
      SetLength(Points, 0);
      for I := 0 to Length(aPoints) - 1 do
      begin
        if Length(aPoints[I]) < minCount then
          Continue;
        myPoint := MiddleTPA(aPoints[I]);
        MMouse(myPoint.X, myPoint.Y, 0, 0);
        Wait(100 + Random(50));
        ColorToleranceSpeed(1);
        s := rs_getuptext;
        for j := 0 to high(uptext) do
          if pos(uptext[j], s) <> 0 then
          begin
            x := myPoint.X;
            y := myPoint.Y;
            Result := True;
            ColorToleranceSpeed(tcts);
            Exit;
          end;
        ColorToleranceSpeed(cts);
      end;
      ColorToleranceSpeed(tcts);
    end;

    Added a Closest boolean param, set to true for closest, False for the farest (Sp?).

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. how did i ever find this...?
    By legendaryhero90 in forum Music, Movies and TV
    Replies: 9
    Last Post: 02-03-2008, 12:53 AM
  2. Find Gas
    By Lacky in forum Research & Development Lounge
    Replies: 4
    Last Post: 11-04-2007, 12:56 PM
  3. Cant find a bmp
    By Diabloizzle in forum OSR Help
    Replies: 5
    Last Post: 07-06-2007, 01:55 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
  •