Results 1 to 3 of 3

Thread: Amount.scar FindCoins();

  1. #1
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default Amount.scar FindCoins();

    The colors were just outdated. I also switched the hard coded bank screen coords to the SRL constant ones.

    SCAR Code:
    {*******************************************************************************
    function FindCoins(var X, Y: Integer; Area: string): Boolean;
    By: ZephyrsFury
    Description: Finds coins in Area and stores the coords in x and y.
    *******************************************************************************}


    function FindCoins(var X, Y: Integer; Area: string): Boolean;
    var
      B: TBox;
      CTS, I, J, H, L: Integer;
      Pts, tPts: TPointArray;
      ATPA: T2DPointArray;
      V: array [0..1] of TVariantArray;
    begin
      case Lowercase(Area) of
        'inv', 'inventory': B := IntToBox(MIX1, MIY1, MIX2, MIY2);
        'bank': B := IntToBox(MBx1, MBy1, MBx2, MBy2);
        'trade': B := IntToBox(323, 73, 509, 302);
        'your trade': B := IntToBox(9, 73, 196, 302);
      end;
      V[0] := [1606307, 4, 0.09, 1.32]; //Darker colour (top of coins)
      V[1] := [2209251, 8, 0.04, 1.08]; //Lighter colour (rest of the coins)
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetLength(tPts, 0);
      try
        for I := 0 to 1 do
        begin
          SetColorSpeed2Modifiers(V[I][2], V[I][3]);
          FindColorsTolerance(Pts, V[I][0], B.X1, B.Y1, B.X2, B.Y2, V[I][1]);
          if (Length(Pts) < 10) then Exit;
          ATPA := SplitTPAEx(Pts, 10, 10);
          h := High(ATPA);
          L := High(tPts) + 1;
          SetLength(tPts, L + h + 1);
          for J := 0 to H do
            tPts[L + j] := MiddleTPA(ATPA[J]);
        end;
        ATPA := SplitTPAEx(tPts, 20, 20);
        H := High(ATPA);
        for I := 0 to H do
          if (High(ATPA[I]) = 1) then
            Break;
        if (I > H) then Exit;
        Result := True;
        MiddleTPAEx(ATPA[I], X, Y);
      finally
        ColorToleranceSpeed(CTS);
        SetColorSpeed2Modifiers(0.2, 0.2);
      end;
    end;
    Last edited by Bebe; 03-01-2010 at 12:10 AM.

  2. #2
    Join Date
    Apr 2007
    Location
    Perth, Australia
    Posts
    3,926
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Commited, Thanks

  3. #3
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    No problem

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
  •