Results 1 to 20 of 20

Thread: DidClick(Red: boolean, Time: integer): boolean; - Mouse.scar

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

    Default DidClick(Red: boolean, Time: integer): boolean; - Mouse.scar

    SCAR Code:
    Function DidClick(Red: Boolean; Time: integer);
    var
      TimeOut, x, y, Trash: integer;
    begin
      GetMousePos(x, y);
      TimeOut := GetSystemTime + Time;
      while not GetSystemTime > TimeOut do
      begin
        wait(25);
        if FindColor(Trash, Trash, 255, x - 5, y - 5, x + 5, y + 5) then
        begin
          if Red then
            Result := true
          else
            Result := false;
          break;
        end;
       
        if FindColor(Trash, Trash, 128, x - 5, y - 5, x + 5, y + 5) then
        begin
          if not Red then
            Result := true
          else
            Result := false;
          break;
        end;
      end;
    end;

    Function DidRedClick: boolean;
    begin
      Result := DidClick(true, 500);
    end;

    Function DidYellowClick: boolean;
    begin
      Result := DidClick(false, 500);
    end;

    {
      useful to check if we clicked something correctly
    }

    what do you guys think?

    ~RM

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

  2. #2
    Join Date
    Sep 2007
    Location
    Pennsylvania
    Posts
    3,396
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ooh, nice. I was thinking about something like this the other day. Will be useful. Rep++

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

    Default

    Didn't somebody suggest this before, RM?

  4. #4
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yes. I still don't know what it would be use for, though.

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

    Default

    Quote Originally Posted by Da 0wner View Post
    Didn't somebody suggest this before, RM?

    probably, but it didn't get added, so here it is again.

    ~RM

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

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

    Default

    Might i just ask how this function works?

  7. #7
    Join Date
    Feb 2006
    Posts
    3,044
    Mentioned
    4 Post(s)
    Quoted
    21 Post(s)

    Default

    Quote Originally Posted by DeSnob View Post
    Might i just ask how this function works?
    After you have called Mouse(x,y,0,0) [As Example] You will call Some of above functions to check is X Red or Yellow

    I hope i helped

    ~Home

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

    Default

    When you click a spot on RuneScape the cursor is red if an action other than move is performed, and it is red if you equipped an item, clicked an NPC, etc.

    Edit: Ninja'd .

  9. #9
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Not very original, but still nice to bring it up.

    For the people who act like,"wtf, doez noez understandzz???".
    When you click on the mainscreen, on the place you clicked will be an X which will be yellow or either red, AFAIK a yellow X means walking a different action will be a red X.

    I think this is pretty clear .
    ~Hermen

  10. #10
    Join Date
    May 2007
    Location
    UK
    Posts
    4,007
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default

    ooh this could be useful for failsafe, say if you tried to click something but accidentally missed you could call this to check if you clicked it right?

    T~M

  11. #11
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by The Man View Post
    ooh this could be useful for failsafe, say if you tried to click something but accidentally missed you could call this to check if you clicked it right?

    T~M
    Yes, possible but there are other things too.
    ~Hermen

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

    Default

    RM If you could maybe add one for getting the color after a click is Red. It would be useful for updating coal rock colors.

    Such as:
    SCAR Code:
    Function UpdateColor(x, y : Integer) : TColor;
    Begin  
      While DidRedClick Do
        Wait(800)
      Else
        Result :=  GetColor(x, y);
    End;
    Last edited by Naum; 07-19-2009 at 02:54 AM.

  13. #13
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    Function DidClick(Red: Boolean; Time: integer): Boolean;
    var
      X, Y, tmpX, tmpY, TimeOut: Integer;
      col: Byte;

    begin
      GetMousePos(x, y);
      TimeOut := (GetSystemTime + Time);
      if (Red) then
        col := 255
      else
        col := 128;
       
      while (GetSystemTime < TimeOut) do
      begin
        Wait(15 + Random(10));
        Result := FindColor(tmpX, tmpY, col, X - 5, Y - 5, X + 5, Y + 5);
        if (Result) then exit;
      end;
    end;

    Function DidRedClick: Boolean;
    begin
      Result := DidClick(True, 500);
    end;

    Function DidYellowClick: Boolean;
    begin
      Result := DidClick(False, 500);
    end;


    begin
    end.

    By the way, I think I saw this in some fighter.
    Might've been one of Narcle's.


    By the way, why do you need two colorchecks?

  14. #14
    Join Date
    Feb 2007
    Location
    Access Violation at 0x00000000
    Posts
    2,865
    Mentioned
    3 Post(s)
    Quoted
    18 Post(s)

    Default

    Add an 'AreaSize' param? And make the max like 20.
    Ce ne sont que des gueux


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

    Default

    Quote Originally Posted by Floor66 View Post
    Add an 'AreaSize' param? And make the max like 20.
    SCAR Code:
    Function DidClick(Bx, By : Integer; Red: Boolean; Time: integer): Boolean;
    var
      X, Y, tmpX, tmpY, TimeOut: Integer;
      col: Byte;

    begin
      If (Bx > 20) Then BX := 20;
      If (By > 20) Then BY := 20;  
      GetMousePos(x, y);
      TimeOut := (GetSystemTime + Time);
      if (Red) then
        col := clRed
      else
        col := 128;
       
      while (GetSystemTime < TimeOut) and (Not (Result)) Do
      begin
        Wait(15 + Random(10));
        Result := FindColor(tmpX, tmpY, col, X - Bx, Y - By, X + Bx, Y + By);
      end;
    end;

    Function DidRedClick: Boolean;
    begin
      Result := DidClick(5, 5, True, 500);
    end;

    Function DidYellowClick: Boolean;
    begin
      Result := DidClick(5, 5, False, 500);
    end;

    Function UpdateColor(Var x, y : Integer) : TColor;
    Begin
      While DidRedClick Do
        Wait(800)
      Else
        Result :=  GetColor(x, y);
    End;

    Btw, It was suggested before here: http://www.villavu.com/forum/showthread.php?t=1320
    Last edited by Naum; 07-19-2009 at 05:09 AM.

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

    Default

    EC: i did two color checks because if it is the yellow x it obviously isn't the red x, and therefore if you want the red one AND you find a yellow one it avoids further looking for it.

    ~RM

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

  17. #17
    Join Date
    Dec 2006
    Location
    Canada, BC
    Posts
    728
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    haha i made something like that before, i think i showed it to you kyle that might be what you were thinking of.
    Lance. Da. Pants.

  18. #18
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    What what? Colour 128 is maroon, not yellow..
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

  19. #19
    Join Date
    Jul 2008
    Location
    England
    Posts
    763
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I used a simplified version of this in my goblin killer - it's very useful to check if you've clicked the goblin.
    lol

  20. #20
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    I think this is a good idea but it should be put in some MouseEx() function or something?
    SCAR Code:
    function MouseEx(x, y, rx, ry: integer; red: boolean): boolean;
    var
      col, tmp, T: integer;
    begin
      col := Integer(red)*127 + 128;
      Mouse(x, y, rx, ry, true);
      T := GetSystemTime + 300;
      while (GetSystemTime < T) do
      begin
        result := FindColor(tmp, tmp, col, x-5, y-5, x+5, y+5);
        if result then exit;
      end;
    end;

    and i think the box parameters BX, BY are useless. just make the box 10*10, there's no need to make it any bigger nor smaller.

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
  •