Results 1 to 13 of 13

Thread: need help w/ script -- seeing color and mouseclicking target

  1. #1
    Join Date
    Oct 2007
    Posts
    8
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default need help w/ script -- seeing color and mouseclicking target

    I know this should be a very simple script, but I'm having problems putting one together that will work.

    I want SCAR to start the macro when a defined color is presented in a box, and the macro is simply mouseclicking a box that i designate.

    I've read some of the tutorials and played around with it, but am still unable to come up with anything that will work.

    I think i have everything in order, except in the beginning i have var x,y and I'm not really sure if that x,y is supposed to be the coords for the window I am running the game in, or what.

  2. #2
    Join Date
    Jul 2007
    Location
    Ottawa, Canada
    Posts
    930
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    if FindColor(whatevergoeshere) then yourscript;

    that will find the color then go to your procedure of what happens if the color is found.
    ~ Metagen

  3. #3
    Join Date
    Oct 2007
    Posts
    8
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    So far this is what I have.

    program Dupe;

    var (x,y) Integer;
    const DupeColor=(000000);
    if FindColor(DupeColor) then Dupe;

    begin
    procedure MouseClick (x,y, True)

    end.

    I know I have alot of work to do with it ... I need to specify the box where the colors will be appearing, and then I need to identify the color in the box or something I think.

    Any input would be appreciated it

  4. #4
    Join Date
    May 2007
    Location
    Netherlands, Amersfoort
    Posts
    2,701
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    this will find a color in the (x1,y1)+(x2,y2) aria.
    if found that color then click it with left mouse

    SCAR Code:
    if FindColorTolerance (x, y, {the color}, {x1}, {y1}, {x2}, {y2}, {tolerance}) then
    Mouse(x, y, 0, 0, True);

  5. #5
    Join Date
    Oct 2007
    Posts
    8
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I'm getting an error at line 4 (Line 4: [Error] (4:5): Identifier expected in script C:\Program Files\SCAR 3.06\Scripts\dupe.scar ...line 4 is the const line)

    program Dupe;

    var (x,y) Integer;
    const DupeColor=(5131854);

    begin
    if FindColor (x, y, (DupeColor), (131), (663), (491), (740) ) then
    Mouse(x, y, 602, 239, True);

    end.

    Sorry if this seems like a stupid problem ... this is the first time i've tried to script something.

  6. #6
    Join Date
    May 2007
    Location
    Netherlands, Amersfoort
    Posts
    2,701
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    scar 3.12 with srl 4 sub 6.

    go to how to auto to know how to download it

  7. #7
    Join Date
    Oct 2007
    Posts
    8
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks ... I downloaded the latest version and followed the instructions in that thread, however I'm still having problems with the script I posted above.

    Line 3: [Error] (3:5): Identifier expected in script (the line with var (x,y))

  8. #8
    Join Date
    Mar 2007
    Location
    Netherlands->Amersfoort.
    Posts
    1,615
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    program Dupe;
    {.include srl/srl.scar}
    var
      x,y: Integer;
    const
      DupeColor=5131854;

    begin
    SetUpSrl;
    if FindColor(x, y, DupeColor, 131, 66, 491, 740) then
      Mouse(x, y, 602, 239, True);
    end.

    well thats because you use alot of open and close round on the wrong place.. and because you've never called SetUpSrl;

    fixed tough. Good Luck

  9. #9
    Join Date
    Oct 2007
    Posts
    8
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by rikjess View Post
    SCAR Code:
    program Dupe;
    {.include srl/srl.scar}
    var
      x,y: Integer;
    const
      DupeColor=5131854;

    begin
    SetUpSrl;
    if FindColor(x, y, DupeColor, 131, 66, 491, 740) then
      Mouse(x, y, 602, 239, True);
    end.

    well thats because you use alot of open and close round on the wrong place.. and because you've never called SetUpSrl;

    fixed tough. Good Luck
    thanks ... really appreciate it

  10. #10
    Join Date
    Oct 2007
    Posts
    8
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I have one more question ... I would like this to repeat that it will continue to check for white text for over an hour ... how would I insert a repeating loop in this macro?

    program Dupe;
    {.include srl/srl.scar}
    var
    x,y: Integer;
    const
    DupeColor=11119017;

    begin
    repeat
    SetUpSrl;
    if FindColor(x, y, DupeColor, 136, 675, 500, 748) then
    ClickMouse(609, 254, True);
    until(true);
    end.

    Is that correct?
    ----
    Basically the problem I am having is that if I make white text appear in the box right after I click run macro it will click the box, but if I wait a while and then make white text appear the macro does not respond

  11. #11
    Join Date
    Oct 2007
    Posts
    8
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Nevermind, I figured it out

  12. #12
    Join Date
    Oct 2007
    Posts
    8
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ok I thought I had it but apparently I'm still having problems.

    SCAR Code:
    program Dupe;
    {.include srl/srl.scar}
    var
      x,y: Integer;
    const
      DupeColor=11119017;

    begin
    repeat
    SetUpSrl;
    if FindColor(x, y, DupeColor, 136, 675, 500, 748) then
       begin
      ClickMouse(609, 254, True);
       end;
    until(FindColor(x, y, DupeColor, 136, 675, 500, 748));
    end.

    It works, however after running for about 1 minute or so it gives me an error and stops running.

    What's wrong with my script? I would like for it to repeat FindColor for however long it takes for the color to appear ... could be hours.

    The error states:
    SRL Compiled in 67687 msec
    [Runtime Error] : Exception: Can't create compatible DC in line 11 in script C:\Program Files\SCAR 3.12\Scripts\dupe.scar

  13. #13
    Join Date
    Mar 2007
    Location
    Netherlands->Amersfoort.
    Posts
    1,615
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    you use 2 times SetUpsrl;

    ty this:

    SCAR Code:
    program Dupe;
    {.include srl/srl.scar}
    var
      x,y: Integer;
    const
      DupeColor=11119017;

    begin
    SetUpSrl;
      repeat
        if FindColor(x, y, DupeColor, 136, 675, 500, 748) then
        begin
         Mouse(609, 254, 1, 1, True);    //Mouse is better then clickmouse. less change on a ban ;)
        end;
      until(FindColor(x, y, DupeColor, 136, 675, 500, 748));
    end.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. need help with the color finding part of my script!
    By poolikemax in forum OSR Help
    Replies: 2
    Last Post: 02-07-2008, 09:28 AM
  2. need help with a color script
    By Blairmcl in forum OSR Help
    Replies: 3
    Last Post: 11-30-2007, 03:48 PM
  3. script doesn't keep searching for the color.
    By warhawk881 in forum OSR Help
    Replies: 5
    Last Post: 08-19-2007, 07:54 PM
  4. Proper Clicking Of A Moving Target
    By Azzon in forum OSR Help
    Replies: 8
    Last Post: 03-04-2007, 09:12 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
  •