Results 1 to 13 of 13

Thread: Color Finding

  1. #1
    Join Date
    Mar 2008
    Location
    Look behind you.
    Posts
    795
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default Color Finding

    In my script, when it looks for a color the mouse goes crazy moving around the screen to check if the uptext is correct. Is there any way to make the color finding precise so that it only moves the mouse over a tree, and clicks the first time it hovers over a pixel?

    For example, in Coh3n's willow chopper it moves the mouse directly to the tree and doesn't try to look around the whole screen. How can i modify my script so it does this?
    Last edited by DeSnob; 05-14-2010 at 09:39 PM.

  2. #2
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    Check a tutorial on TPA and ToleranceSpeed
    Experient with Dimensional TPA's and SplitTPA()

  3. #3
    Join Date
    Mar 2008
    Location
    Look behind you.
    Posts
    795
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Did what you told me, went to Naum's tut :P and got a much better tree finding procedure. Although it doesn't meet my standards *yet*, it finds trees much faster! Sometimes even on the first attempt

    Here's my function:
    SCAR Code:
    function IsTreeThere: boolean;
    var
      TreeTPA: TPointArray;
      ATPA: Array of TPointArray;
      CTS: integer;
    begin
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(1);
      SetColorSpeed2Modifiers(0.98, 1.93);
     
     
      FindColorsSpiralTolerance(MSCX, MSCY, TreeTPA, 3303258, MSX1, MSY1, MSX2, MSY2, 10);
      ColorToleranceSpeed(CTS);
     
      SortTPAFrom(TreeTPA, Point(MSCX+50, MSCY+50));
      ATPA := TPAToATPAEx(TreeTPA, 50, 50);
     
      SortATPASize(ATPA, True);
     
      For I := 0 to High(ATPA) do
      begin
        MiddleTPAEx(ATPA[i], x, y);
        MMouse(x, y, 2, 2);
        wait(200+random(500));
        {If (IsUpTextMultiCustom(['hop', 'Tre'])) then
        begin
           Mouse(x, y, 0, 0, True);
        end;}

      end;
    end;

    Please tell me if i'm doing anything wrong, as I'm still a TPA nooby xD

  4. #4
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    I think you're doing great! That procedure is close to perfect
    Keep on experimenting and trying out different stuff and you'll fully understand this in no time

  5. #5
    Join Date
    Mar 2008
    Location
    Look behind you.
    Posts
    795
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Thanks!

    Right now I'm trying to learn tpa walking.. which is complicated! Wish me luck

  6. #6
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    i do beleive you need to change ColorToleranceSpeed(1); to ColorToleranceSpeed(2);

    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

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

    Default

    Just lower the tolerance a little bit and try to use a more unique color of the tree that has few other occurrences on the screen.

    Once you do that you should be good to go.

  8. #8
    Join Date
    Mar 2008
    Location
    Look behind you.
    Posts
    795
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by NCDS View Post
    Just lower the tolerance a little bit and try to use a more unique color of the tree that has few other occurrences on the screen.

    Once you do that you should be good to go.
    Alright, and about the unique color, it's hard to find in a forest with green and brown floors xD

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

    Default

    Quote Originally Posted by DeSnob View Post
    Alright, and about the unique color, it's hard to find in a forest with green and brown floors xD
    Yeah I know what your saying. Try using the brightest/darkest colors of green on the tree. You should really lower the tolerance though. Try it at 5, that should be plenty.

  10. #10
    Join Date
    Mar 2008
    Location
    Look behind you.
    Posts
    795
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    I tried the brightest color i could find, and switched up how the atpas were sorted and have an even better function !

    SCAR Code:
    function FindTree: boolean;
    var
      TreeTPA: TPointArray;
      ATPA: Array of TPointArray;
      CTS: integer;
    begin
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(1);
      SetColorSpeed2Modifiers(0.98, 1.93);

      repeat
      FindColorsSpiralTolerance(MSCX, MSCY, TreeTPA, 6264456, MSX1, MSY1, MSX2, MSY2, 5);
      ColorToleranceSpeed(CTS);
     
      if (Length(TreeTPA) = 0) then Result := False;

      SortTPAFrom(TreeTPA, Point(MSCX+50, MSCY+50));
      ATPA := TPAToATPAEx(TreeTPA, 50, 50);

      SortATPASize(ATPA, False);

      For I := 0 to High(ATPA) do
      begin
        MiddleTPAEx(ATPA[i], x, y);
        MMouse(x, y, 2, 2);
        FindNormalRandoms;
        wait(200+random(500));
        if IsUptext('ak') or IsUptext('ew') then exit;
        If (IsUpTextMultiCustom(['hop', 'Tre'])) then
        begin
           Mouse(x, y, 0, 0, True);
           repeat
             wait(20);
           until(not(IsMoving))
        end;
      end;
      until((InvFull) or (not(LoggedIn)))
    end;

  11. #11
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    SCAR Code:
    ColorToleranceSpeed(1);
    Should be:
    SCAR Code:
    ColorToleranceSpeed(2);

    Looks good, nonetheless.

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

    Default

    A little confused here:
    SCAR Code:
    SortTPAFrom(TreeTPA, Point(MSCX+50, MSCY+50));
    Why do yo sort it 50 px from you?


    Your FindNormalRandoms is called in kind of a silly spot.
    Perhaps pluck it in here:
    SCAR Code:
    repeat
      wait(20);
    until(not(IsMoving))
    That way, it will be called while your chopping the tree, not in the middle of clicking it.

    Last thing,
    SCAR Code:
    if IsUptext('ak') or IsUptext('ew') then exit;
    Could just be:
    SCAR Code:
    if IsUptext('ak') or IsUptext('ew') then Continue;
    That way, it will just continue looping through the ATPA instead of exiting the function and making you continually call it.

    Overall looks good, Just some pointers

  13. #13
    Join Date
    Mar 2008
    Location
    Look behind you.
    Posts
    795
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by NCDS View Post
    A little confused here:
    SCAR Code:
    SortTPAFrom(TreeTPA, Point(MSCX+50, MSCY+50));
    Why do yo sort it 50 px from you?


    Your FindNormalRandoms is called in kind of a silly spot.
    Perhaps pluck it in here:
    SCAR Code:
    repeat
      wait(20);
    until(not(IsMoving))
    That way, it will be called while your chopping the tree, not in the middle of clicking it.

    Last thing,
    SCAR Code:
    if IsUptext('ak') or IsUptext('ew') then exit;
    Could just be:
    SCAR Code:
    if IsUptext('ak') or IsUptext('ew') then Continue;
    That way, it will just continue looping through the ATPA instead of exiting the function and making you continually call it.

    Overall looks good, Just some pointers
    I sort it 50 px away from the center, so that it starts looking for the TPAs/ATPAs that aren't where the player is (Trees aren't found under a player) That way, it looks a little further and usually clicks the tree closest to the character ;o)

    About the Isuptext, thanks! It actually fixed a little problem i was having

    Quote Originally Posted by Naum View Post
    SCAR Code:
    ColorToleranceSpeed(1);
    Should be:
    SCAR Code:
    ColorToleranceSpeed(2);

    Looks good, nonetheless.
    Alright, switched. Thank you!

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
  •