Results 1 to 9 of 9

Thread: FindDucks - a general duckfinder

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

    Default FindDucks - a general duckfinder

    FindDucks - a general duckfinder

    This function doesn't work, but does compile, and would be /is really slow.

    I posted it so people could learn

    SCAR Code:
    Function FindDuck(Var Dx, Dy: Integer; Safe: Boolean): Boolean;
    Var
      CTS, I, L, X, Y, z, II, S, Ll: Integer;
      TPAA, ATPA : Array of TPointArray;
      TPA, dTPA: TPointArray;
      TP: TPoint;
      TB: TBox;
    Begin
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      FindColorsSpiralTolerance(MSCX, MSCY, TPA, 11241076, MSX1, MSY1, MSX2, MSY2, 0);
      TPAA := SplitTPAEx(TPA, 1, 1);
      SortATPASize(TPAA, True);
      If GetArrayLength(TPA) < 1 Then
        Exit;
      SetArrayLength(TPA, 0);
      TPA := TPAA[0];
      ATPA := TPAToATPAEx(TPA, 40, 40);
      Ll := High(ATPA);
      For S := 0 To L Do
      Begin
        TPA := ATPA[s];
        TPAA := FindGapsTPA(TPA, 18);
        L := High(TPAA);
        For I := 0 To L Do
          TPA := CombineTPA(TPA, TPAA[i]);
        TB := GetTPABounds(TPA);
        TP.x := TB.x2 - TB.x1 shr 1;
        TP.y := TB.y2 - TB.y1 shr 1;
        SetColorSpeed2Modifiers(0.4, 0.4);
        FindColorsSpiralTolerance(TP.x, TP.y, dTPA, 8822696, TB.x1, TB.y1, TB.x2, TB.y2, 15);
        SetColorSpeed2Modifiers(0.2, 0.2);
        SetArrayLength(TPAA, 0);
        TPAA := TPAToATPAEx(dTPA, 15, 15);
        L := High(TPAA);
        For I := 0 To L Do
        Begin
          TB := GetTPABounds(TPAA[i]);
          TP.x := TB.x2 - TB.x1 shr 1;
          TP.y := TB.y2 - TB.y1 shr 1;
          SortTPAFrom(dTPA, TP);
          SetArrayLength(TPA, 64);
          For II := 0 To 63 Do
            Try
              TPA[ii] := dTPA[i];
              z := z + 1;
            Except
              Break;
            End;
          SetArrayLength(TPA, z);
          If Z > 24 Then
          Begin
            MiddleTPAEx(TPA, Dx, Dy);
            If FindColorTolerance(X, Y, 3229752, Dx - 12, Dy - 12, Dx + 12, Dy + 12, 20) Then
              Result := True // Male duck, and also a definite duck.
            Else
              If Safe Then
              Begin
                MMouse(Dx, Dy, 2, 2);
                If Not IsUpTextMulti('Duck', 'Duc', 'uck') Then
                  Continue;
              End;
            Result := Not(FindColor(X, Y, 65280, Dx - 15, Dy - 20, Dx + 15, Dy + 10));
            If Result Then
              Result := Not(FindColor(X, Y, 255, Dx - 15, Dy - 20, Dx + 15, Dy + 10));
            If Result Then
              Break;
          End;
        End;
      End;
      ColorToleranceSpeed(CTS);
    End;

  2. #2
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    I think you mean
    SCAR Code:
    TP.x := TB.x2 + TB.x1 shr 1;
        TP.y := TB.y2 + TB.y1 shr 1;
    ?

    And you never reset Z to 0?


    Anyway, here's my FindDuck:

    SCAR Code:
    function FindDuck(var dx, dy: Integer): Boolean;
    var
      i, c, l, cts, ms, x, y: Integer;
      p, tp: TPointArray;
      t: TPointArrayArray;
      CheckBars: Boolean;
    begin
      if not LoggedIn then Exit;
      cts := GetColorToleranceSpeed;
      ms := MouseSpeed;
      MouseSpeed := 18;
      ColorToleranceSpeed(2);
      FindColorsSpiralTolerance(MSCX, MSCY, p, 8230813, 15, 30, 510, 330, 15);
      FindColorsSpiralTolerance(MSCX, MSCY, tp, 3493436, 15, 30, 510, 330, 15);
      ColorToleranceSpeed(cts);
      p := CombineTPA(p, tp);
      t := SplitTPAEx(p, 3, 3);
      SetLength(p, 0);
      SetLength(tp, 0);
      l := Length(t);
      for c := 0 to 1 do
      begin
        if Result then Break;
        case c of
          0: CheckBars := True;
          1: CheckBars := False;
        end;
        for i := 0 to l -1 do
          if InRange(Length(t[i]), 14, 35) then
          begin
            MiddleTPAEx(t[i], dx, dy);
            if CheckBars then
            begin
              if (not FindColor(x, y, 65280, dx -15, dy - 30, dx + 15, dy)) then
                if (not FindColor(x, y, 255, dx -15, dy - 30, dx + 15, dy)) then
                begin
                  MMouse(dx, dy, 2, 2);
                  Wait(100 + Random(100));
                  if IsUpText('Duck') then
                  begin
                    Result := True;
                    GetMousePos(dx, dy);
                    Break;
                  end;
                end;
            end else
            begin
              MMouse(dx, dy, 2, 2);
              Wait(100 + Random(100));
              if IsUpText('Duck') then
              begin
                Result := True;
                GetMousePos(dx, dy);
                Break;
              end;
            end;
          end;
      end;
      MouseSpeed := ms;
      SetLength(t, 0);
    end;
    Hup Holland Hup!

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

    Default

    I didn't post it to be fixed, neither to be rated in any ways x) Thx anyhow

    EDIT: Thx, thats what I meant with the shr stuff

  4. #4
    Join Date
    Jul 2007
    Posts
    1,431
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Lol'ed - FindDuck - General duckfinder...
    Anyways, 1 question, what GetTPABounds(); does? And Markus said it's slow, and there should be an alternative method instead this...?
    [CENTER][SIZE="4"]Inactive[/SIZE]I forgot my password[/CENTER]

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

    Default

    It gets the x1, y1, x2, y2 of the box formed by the tpa.

  6. #6
    Join Date
    Jun 2007
    Posts
    785
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    FindDuck... ok, whats the use of it? aah Screw it! i learned mroe about PTA's *Cheers at N3ss3s* thanks

    [22:20] <[-jesus-]> freddy, go uninstall yourself

  7. #7
    Join Date
    Nov 2006
    Location
    NSW, Australia
    Posts
    3,487
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    What the heck, N3ss3s? How do you know about all the miscellaneous TPA functions that are in SCAR. How'd you find out about FindGapsTPA?
    [CENTER][img]http://signatures.mylivesignature.com/54486/113/4539C8FAAF3EAB109A3CC1811EF0941B.png[/img][/CENTER]
    [CENTER][BANANA]TSN ~ Vacation! ~ says :I Love Santy[/BANANA][/CENTER]

    [CENTER][BANANA]Raymond - Oh rilie? says :Your smart[/BANANA][/CENTER]

  8. #8
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by Santa_Clause View Post
    What the heck, N3ss3s? How do you know about all the miscellaneous TPA functions that are in SCAR. How'd you find out about FindGapsTPA?
    Raymond added it to SRL for (I'm assuming) his new FindTalk. According to him, it shouldn't be used in object finding, also =/

    If you really want to be a Master Object Finder (MOJ), you HAVE TO USE Color Speed 2 Modifiers!

    EDIT: SHIT, I HAVE A PIMPLE ON MY FOREHEAD!

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

    Default

    /tells the girls to run away from bullzeye

    According to him, it shouldn't be used in object finding, also =/
    Screw that, he is trying to stop creativity


    How do you know about all the miscellaneous TPA functions that are in SCAR. How'd you find out about FindGapsTPA?
    Miscellaneous eh? This is not a miscellaneous link.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. general scripting help
    By ben600006 in forum OSR Help
    Replies: 3
    Last Post: 02-02-2009, 12:02 PM
  2. General treefinder...
    By Negaal in forum Research & Development Lounge
    Replies: 22
    Last Post: 02-14-2008, 02:23 PM
  3. General FailSafes
    By Pyro in forum Outdated Tutorials
    Replies: 24
    Last Post: 07-05-2007, 01:48 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
  •