Results 1 to 6 of 6

Thread: color coordinates and mouse clickS?

  1. #1
    Join Date
    Dec 2008
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default color coordinates and mouse clickS?

    howdy =) i just learned a bit about scripting scar. wondering if some one could help me here.

    SCAR Code:
    function FindColor(var -294, -157: Integer; 16711680, xs, ys, xe, ye): true;
    i dont understand how to get scar to set "var -294, -157"(above) as the coordinates for the click mouse procedure(below).
    SCAR Code:
    procedure ClickMouse(x, y, True);
    help? =)

  2. #2
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It's used like this:

    FindColor(X, Y, 500, MSX1, MSY1, MSX2, MSY2);
    ClickMouse(x, y, True);

    You don't need to declare the Function, Var, Integer, etc. in it.

  3. #3
    Join Date
    Dec 2008
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    awesome thanks alot =)

    so say i wanted to set a variable for the color, would this work?

    SCAR Code:
    var
    i: integer;

    const
     i:= (color);

    FindColor(X, Y, i, MSX1, MSY1, MSX2, MSY2);
    ClickMouse(x, y, True);

    i'm kinda thinking thats realy wrong

  4. #4
    Join Date
    Oct 2006
    Location
    United States
    Posts
    672
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by droppeD:) View Post
    awesome thanks alot =)

    so say i wanted to set a variable for the color, would this work?
    yeah it would work, this is just a bit different though.
    SCAR Code:
    var
      thecolor, x, y: integer;

    const
      thecolor = 678768678; // Your color

    begin
      FindColor(X, Y, thecolor, MSX1, MSY1, MSX2, MSY2);
      ClickMouse(x, y, True);
    end;

  5. #5
    Join Date
    Dec 2008
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    kinda works

    SCAR Code:
    program New;

    var
     x, y: integer;
     MSX1, MSY1, MSX2, MSY2: integer;
    const
     thecolor =  9822460;//your color

    begin
      FindColor(X, Y, thecolor, MSX1, MSY1, MSX2, MSY2);
      ClickMouse(x, y, true);
    end.

    this compiles right. but it doesn't do any thing when its executed.
    and i guess it wouldn't let me put 'thecolor' as a variable and a constant. kept getting this(below)
    SCAR Code:
    Line 7: [Error] (7:1): Duplicate identifier 'thecolor' in script
    Failed when compiling

  6. #6
    Join Date
    Dec 2007
    Posts
    2,766
    Mentioned
    2 Post(s)
    Quoted
    37 Post(s)

    Default

    FindColor is a function which stores the location of the color in the two first variables [integers] in the line.

    As example :

    SCAR Code:
    FindColor(x,y,3525929,0,0,252,591);

    Here x and y are the variables [integers] where the location will be stored.

    So we need to declare x and y :

    SCAR Code:
    var
      x,y : Integer;

    3525929 is the color we're searching for.

    0,0 : these are the start locations of the box we'll be searching in.

    252,591 : these are the end locations of the box we'll be searching in.

    like : 0,0 is the upper left corner of that box
    and 252,591 is the down right corner of that box.

    However, since FindColor is a boolean, we use it as failsafes and many other things.

    To make it useful in a script, use :

    SCAR Code:
    Procedure ClickSomething;
    begin
      If FindColor(x,y,5258285,0,0,515,712) then
      begin
        ClickMouse(x,y,true);
      end;
    end;

    Now :

    It stored the location of color in x and y.

    And ClickMouse(x,y,true); makes it move the mouse to the x and y location and click there.

    However that method is unsafe as it moves the mouse at an incredible speed.

    Not going to make a tutorial out of this post but I reccomend you to keep going !

    Good luck.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Check color at mouse co-ordinates
    By Pheter in forum OSR Help
    Replies: 14
    Last Post: 02-19-2009, 05:19 PM
  2. Auto Color Clicks Once and Screws Up...
    By groog in forum OSR Help
    Replies: 5
    Last Post: 08-01-2008, 06:59 PM
  3. Mouse Goes to Top Left Corner Clicks, stops.
    By Tails111 in forum OSR Help
    Replies: 12
    Last Post: 08-07-2007, 07:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •