Results 1 to 2 of 2

Thread: function FindObjTPAMulti

  1. #1
    Join Date
    Feb 2007
    Location
    South East England
    Posts
    2,906
    Mentioned
    2 Post(s)
    Quoted
    8 Post(s)

    Default function FindObjTPAMulti

    SCAR Code:
    {*******************************************************************************
    function FindObjTPAMulti(var X, Y: integer; Color: TIntegerArray; Tol, CTS, ObjWidth, ObjHeight, minCount :Integer; UpText: TStringArray): Boolean;
    By: Wizzup?, Modified by Torrent of Flame
    Description: This is a modification of FindObjTPA, which uses a TIntegerArray for the Colors.
    Date: 29th August 2009
    *******************************************************************************}

    function FindObjTPAMulti(var X, Y: Integer; Colour: TIntegerArray; Tol, CTS, ObjWidth, ObjHeight, minCount: Integer; UpText: TStringArray): Boolean;
    var
      i, tCTS: Integer;
      myPoint: TPoint;
      aPoints: T2DPointArray;
      ATPA: T2DPointArray;
      TPA: TPointArray;
    begin
      Result := False;
      if not LoggedIn then exit;
      tCTS := GetColorToleranceSpeed;
      if CTS * 9 mod 3 <> 0 then
        CTS := 1;
      ColorToleranceSpeed(CTS);
      SetLength(ATPA, Length(Colour));
      for i := 0 to High(Colour) do
      begin
        FindColorsSpiralTolerance(x, y, ATPA[i], Colour[i], MSX1, MSY1, MSX2, MSY2, Tol);
      end;
      TPA := MergeATPA(ATPA);
      if Length(TPA) = 0 then
      begin
        ColorToleranceSpeed(tCTS);
        Exit;
      end;
      ColorToleranceSpeed(1);
      aPoints := TPAtoATPAEx(TPA, ObjWidth, ObjHeight);
      for I := 0 to High(aPoints) do
      begin
        if Length(aPoints[I]) < minCount then
          Continue;
        myPoint := MiddleTPA(aPoints[I]);
        MMouse(myPoint.x, myPoint.y, 0, 0);
        if WaitUpTextMulti(UpText, 300) then
        begin
          GetMousePos(X, Y);
          Result := True;
          ColorToleranceSpeed(tCTS);
          Exit;
        end;
      end;
      ColorToleranceSpeed(tCTS);
    end;

    I noticed there was a gap in SRL. A lot of people are currently using FindObjTPA in their scripts, but not a FindObjTPAMulti.

    This uses a TInteger array to find the tree so if you want to use multiple colours in the function you would have to declare about 4 and then do for i := 0 to 4, etc, whereas with this you can declare is as such;

    SCAR Code:
    procedure TreeVariables;
    begin
      TreeCol := [3241318, 2119755, 2645844, 3240035];
      UpTextz := ['Tree', 'Tre', 'ree'];
    end;

    begin
      FindObjTPAMulti(x, y, TreeCol, 30, 2, 15, 25, 10, UpTextz);
    end;

    Or you can just put the Variables straight into the funciton.
    Last edited by Torrent of Flame; 08-29-2009 at 08:31 PM.
    Jus' Lurkin'

  2. #2
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    commited.

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

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
  •