Results 1 to 13 of 13

Thread: MouseColorUptext & WaitFindColorSpiral

  1. #1
    Join Date
    May 2007
    Location
    England
    Posts
    4,141
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default MouseColorUptext & WaitFindColorSpiral

    What they do:

    MouseColorUptext:

    If it find colour Col at X, Y, it moves the mouse there with Rx, Ry randomness. If the uptext Uptxt is found, it performs Action, and returns true. The correct choices for Action are:
    - 0 = Nothing
    - 1 = Left click
    - 2 = Right click

    WaitFindColorSpiral:

    Exactly like WaitFindColor except that it uses FindColorSpiralTolerance instead of FindColorTolerance.

    Comments?

    SCAR Code:
    {*******************************************************************************
    function MouseColorUptext(X, Y, Rx, Ry : Integer; Cx1, Cy1, Cx2, Cy2, Col, Tol, MaxTime, Action : Integer; UpTxt : string) : Boolean;
    By: R1ch
    Description: Waits for a color at X, Y with tolerance Tol, then checks for uptext.
                 If uptext is found, then performs Action. 0 = Nothing
                                                           1 = Left click
                                                           2 = Right click
                 Returns true if Action is performed
    *******************************************************************************}


    function MouseColorUptext(X, Y, Rx, Ry : Integer; Cx1, Cy1, Cx2, Cy2, Col, Tol, MaxTime, Action : Integer; UpTxt : string) : Boolean;
    begin
      if not InRange(Action, 0, 2) then
      begin
        SRL_Warn('MouseColorUptext', 'Incorrect action: ' + IntToStr(Action), warn_AllVersions);
        Exit;
      end;
      if WaitFindColor(X, Y, Cx1, Cy1, Cx2, Cy2, Col, Tol, MaxTime) then
      begin
        MMouse(X, Y, Rx, Ry);
        if WaitUptext(Uptext, MaxTime) then
        begin
          GetMousePos(X, Y);
          if Action > 0 then
            1, 2 : Mouse(X, Y, 0, 0, Action = 1);
        Result := True;
        end;
      end;
    end;





    {*******************************************************************************
    function WaitFindColorSpiral(X1, Y1, X2, Y2, Col, Tol, MaxTime: Integer) : Boolean;
    By: R1ch
    Description: Waits for a color spiraling with tolerance Tol, returns true if found
    *******************************************************************************}

    function WaitFindColorSpiral(X1, Y1, X2, Y2, Col, Tol, MaxTime: Integer) : Boolean;
    var
      Time: Integer;
    begin
      Time := GetSystemTime + MaxTime;
      while GetSystemTime < Time do
      Begin
        Result := FindColorSpiralTolerance(MSCX, MSCY, Col, X1, Y1, X2, Y2, Tol);
        If Result then Exit;
      end;
    end;

    EDIT: Some credits to Richard for improving and shortening.
    Last edited by Rich; 07-05-2009 at 08:02 PM.
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

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

    Default

    lookin good i like the first one, i would use it a lot
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  3. #3
    Join Date
    May 2007
    Location
    England
    Posts
    4,141
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    Ooh, thanks! What about the second one?

    Also, congratulations on the cup! I can see you worked hard for that. You really deserve it.

    Richard.
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

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

    Default

    the second one, its not bad, but a good addition to the little collection of "wait" procedures, and can be usefull :P

    and as for the cup, to be honest, i got it by solving my boredness at night when i couldnt sleep, i acutally didnt know you got it by helping with srl, but on the plus side, i can has avvy
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  5. #5
    Join Date
    May 2007
    Location
    England
    Posts
    4,141
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    Are there any suggestions you have to improve either of them?

    Richard.
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

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

    Default

    hmm, nope. its better than what i would do tbh

    hopefully some one else would post feed back
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  7. #7
    Join Date
    May 2007
    Location
    England
    Posts
    4,141
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    Lol, yeah, that's what I'm hoping for to be honest, and thanks for the great feedback. Meh, might as well rep+ you for your functions, and feedback.
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

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

    Default

    then i might as well do the same, for the same reasons =P
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  9. #9
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    SCAR Code:
    function MouseColorUptext(X, Y, Rx, Ry : Integer; Cx1, Cy1, Cx2, Cy2, Col, Tol, MaxTime, Action : Integer; UpTxt : string) : Boolean;
    begin
      if not InRange(Action, 0, 2) then
      begin
        SRL_Warn('MouseColorUptext', 'Incorrect action: ' + IntToStr(Action), warn_AllVersions);
        Exit;
      end;
      if WaitFindColor(X, Y, Cx1, Cy1, Cx2, Cy2, Col, Tol, MaxTime) then
      begin
        MMouse(X, Y, Rx, Ry);
        if WaitUptext(Uptext, MaxTime) then
        begin
          GetMousePos(X, Y);
          if Action > 0 then
            1, 2 : Mouse(X, Y, 0, 0, Action = 1);
        Result := True;
        end;
      end;
    end;

    Got rid of the "end else Exit", as it was at the end so would be useless, got rid of "Result := False" as all booleans are false by default.

    Where you had the case, you had " 0: Exit;" which meant that the function would never reach the point to result true, so I changed it all to:

    SCAR Code:
    if Action > 0 then
            1, 2 : Mouse(X, Y, 0, 0, Action = 1);


    SCAR Code:
    function WaitFindColorSpiral(X1, Y1, X2, Y2, Col, Tol, MaxTime: Integer) : Boolean;
    var
      Time: Integer;
    begin
      Time := GetSystemTime + MaxTime;
      while GetSystemTime < Time do
      Begin
        Result := FindColorSpiralTolerance(MSCX, MSCY, Col, X1, Y1, X2, Y2, Tol);
        If Result then Exit;
      end;
    end;

    Just a few small shortenings on that one.

  10. #10
    Join Date
    May 2007
    Location
    England
    Posts
    4,141
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    Thanks Richard. I'll change them in the first post.
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

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

    Default

    I'll add the second function although you can't give yourself full credit for adding one word to it. The first one, I don't think I'll add, its more or less just a combination of two Timing.scar functions and only works for colours anyway. Thanks.

  12. #12
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    What about MousePointUpText ?

  13. #13
    Join Date
    May 2007
    Location
    England
    Posts
    4,141
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    Ok, thanks Zephy.
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

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
  •