Results 1 to 8 of 8

Thread: mouse clicking on 1 specific bitmap or color

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

    Default mouse clicking on 1 specific bitmap or color

    Hi so this is the script of finding object! my mouse move to any object that have the same color (4021099) in the runescape screen.

    1. is there anyway i can make it to clicking instead of just moving ?
    2. make it click on 1 specific object instead of multiple one!




    program FindObject;
    {.include SRL\SRL.scar}

    var
    x, y: Integer;

    function FindObject(var fx, fy: Integer): Boolean;
    var
    arP, arAP: TPointArray;
    arC, arUC: TIntegerArray;
    ararP: T2DPointArray;
    tmpCTS, i, j, arL, arL2: Integer;
    P: TPoint;
    H, S, L: Extended;
    X, Y, Z: Extended;
    begin
    tmpCTS := GetColorToleranceSpeed;
    ColorToleranceSpeed(1);

    if not(FindColorsTolerance(arP, 4021099, MSX1, MSY1, MSX2, MSY2, 11)) then
    begin
    Writeln('Failed to find the color, no object found.');
    ColorToleranceSpeed(tmpCTS);
    Exit;
    end;

    arC := GetColors(arP);
    arUC := arC;
    ClearSameIntegers(arUC);
    arL := High(arUC);
    arL2 := High(arC);

    for i := 0 to arL do
    begin
    ColorToHSL(arC[i], H, S, L);

    if (H >= 10.83) and (H <= 10.90) and (S >= 27.37) and (S <= 27.70) and (L >= 30.76) and (L <= 34.73) then
    begin
    ColorToXYZ(arC[i], X, Y, Z);

    if (X >= 9.22) and (X <= 11.94) and (Y >= 9.48) and (Y <= 12.27) and (Z >= 5.20) and (Z <= 6.61) then
    begin
    for j := 0 to arL2 do
    begin
    if (arUC[i] = arC[j]) then
    begin
    SetLength(arAP, Length(arAP) + 1);
    arAP[High(arAP)] := arP[j];
    end;
    end;
    end;
    end;
    end;

    SortTPAFrom(arAP, Point(MSCX, MSCY));
    ararP := SplitTPAEx(arAP, 10, 10);
    arL := High(ararP);

    for i := 0 to arL do
    begin
    if (Length(ararP[i]) < 10) then Continue;
    P := MiddleTPA(ararP[i]);
    MMouse(P.x, P.y, 5, 5);
    Wait(100 + Random(100));
    if (IsUpText('Take')) then
    begin;
    Result := True;
    Break;
    end;
    end;

    ColorToleranceSpeed(tmpCTS);

    if (i = arL + 1) then
    begin
    Writeln('FindObject could not find object.');
    Exit;
    end;

    GetMousePos(fx, fy);
    end;

    begin
    SetupSRL;
    FindObject(x, y);
    end.

    thanks guys!

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

    Default

    SCAR Code:
    program FindObject;
    {.include SRL\SRL.scar}

    var
    x, y: Integer;

    function FindObject(var fx, fy: Integer): Boolean;
    var
    arP, arAP: TPointArray;
    arC, arUC: TIntegerArray;
    ararP: T2DPointArray;
    tmpCTS, i, j, arL, arL2: Integer;
    P: TPoint;
    H, S, L: Extended;
    X, Y, Z: Extended;
    begin
    tmpCTS := GetColorToleranceSpeed;
    ColorToleranceSpeed(1);
    if (FindColorsTolerance(arP, 4021099, MSX1, MSY1, MSX2, MSY2, 11))then
    Mouse(x, y, 2, 2, True);
    if not(FindColorsTolerance(arP, 4021099, MSX1, MSY1, MSX2, MSY2, 11)) then
    begin
    Writeln('Failed to find the color, no object found.');
    ColorToleranceSpeed(tmpCTS);
    Exit;
    end;

    arC := GetColors(arP);
    arUC := arC;
    ClearSameIntegers(arUC);
    arL := High(arUC);
    arL2 := High(arC);

    for i := 0 to arL do
    begin
    ColorToHSL(arC[i], H, S, L);

    if (H >= 10.83) and (H <= 10.90) and (S >= 27.37) and (S <= 27.70) and (L >= 30.76) and (L <= 34.73) then
    begin
    ColorToXYZ(arC[i], X, Y, Z);

    if (X >= 9.22) and (X <= 11.94) and (Y >= 9.48) and (Y <= 12.27) and (Z >= 5.20) and (Z <= 6.61) then
    begin
    for j := 0 to arL2 do
    begin
    if (arUC[i] = arC[j]) then
    begin
    SetLength(arAP, Length(arAP) + 1);
    arAP[High(arAP)] := arP[j];
    end;
    end;
    end;
    end;
    end;

    SortTPAFrom(arAP, Point(MSCX, MSCY));
    ararP := SplitTPAEx(arAP, 10, 10);
    arL := High(ararP);

    for i := 0 to arL do
    begin
    if (Length(ararP[i]) < 10) then Continue;
    P := MiddleTPA(ararP[i]);
    MMouse(P.x, P.y, 5, 5);
    Wait(100 + Random(100));
    if (IsUpText('Take')) then
    begin;
    Result := True;
    Break;
    end;
    end;

    ColorToleranceSpeed(tmpCTS);

    if (i = arL + 1) then
    begin
    Writeln('FindObject could not find object.');
    Exit;
    end;

    GetMousePos(fx, fy);
    end;

    begin
    SetupSRL;
    FindObject(x, y);
    end.

    I added this
    if (FindColorsTolerance(arP, 4021099, MSX1, MSY1, MSX2, MSY2, 11))then
    Mouse(x, y, 2, 2, True);

    if it find it then it will click a random 2 pixels up/down and random 2 pixels left.right, and True means it will left click, if you want it to right click change True to False

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

    Default

    hmm i tried the script it said erro: type mismatch, but i got the idea of the code with left+right click, thank you tho that help me alot, too!

  4. #4
    Join Date
    Dec 2007
    Location
    Michigan, USA
    Posts
    280
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ok firstoff...
    STANDARDS ARE YOUR FREINDS!!!!
    ahh that is so gross to try to read:/

    Secound off.
    Mind posting the code mickey so i can see why your getting the error?
    Kindof Inactive...

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

    Default

    Helli MikeSkater
    this is the error

    Failed when compiling
    Line 20: [Error] (16226:24): Type mismatch in script C:\Users\Phuong\Desktop\45.scar

    thanks!!

  6. #6
    Join Date
    Jan 2008
    Location
    NC, USA.
    Posts
    4,429
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Quote Originally Posted by D1zl3 View Post
    SCAR Code:
    program FindObject;
    {.include SRL\SRL.scar}

    var
    x, y: Integer;

    function FindObject(var fx, fy: Integer): Boolean;
    var
    arP, arAP: TPointArray;
    arC, arUC: TIntegerArray;
    ararP: T2DPointArray;
    tmpCTS, i, j, arL, arL2: Integer;
    P: TPoint;
    H, S, L: Extended;
    X, Y, Z: Extended;
    begin
    tmpCTS := GetColorToleranceSpeed;
    ColorToleranceSpeed(1);
    if (FindColorsTolerance(arP, 4021099, MSX1, MSY1, MSX2, MSY2, 11))then
    Mouse(x, y, 2, 2, True);
    if not(FindColorsTolerance(arP, 4021099, MSX1, MSY1, MSX2, MSY2, 11)) then
    begin
    Writeln('Failed to find the color, no object found.');
    ColorToleranceSpeed(tmpCTS);
    Exit;
    end;

    arC := GetColors(arP);
    arUC := arC;
    ClearSameIntegers(arUC);
    arL := High(arUC);
    arL2 := High(arC);

    for i := 0 to arL do
    begin
    ColorToHSL(arC[i], H, S, L);

    if (H >= 10.83) and (H <= 10.90) and (S >= 27.37) and (S <= 27.70) and (L >= 30.76) and (L <= 34.73) then
    begin
    ColorToXYZ(arC[i], X, Y, Z);

    if (X >= 9.22) and (X <= 11.94) and (Y >= 9.48) and (Y <= 12.27) and (Z >= 5.20) and (Z <= 6.61) then
    begin
    for j := 0 to arL2 do
    begin
    if (arUC[i] = arC[j]) then
    begin
    SetLength(arAP, Length(arAP) + 1);
    arAP[High(arAP)] := arP[j];
    end;
    end;
    end;
    end;
    end;

    SortTPAFrom(arAP, Point(MSCX, MSCY));
    ararP := SplitTPAEx(arAP, 10, 10);
    arL := High(ararP);

    for i := 0 to arL do
    begin
    if (Length(ararP[i]) < 10) then Continue;
    P := MiddleTPA(ararP[i]);
    MMouse(P.x, P.y, 5, 5);
    Wait(100 + Random(100));
    if (IsUpText('Take')) then
    begin;
    Result := True;
    Break;
    end;
    end;

    ColorToleranceSpeed(tmpCTS);

    if (i = arL + 1) then
    begin
    Writeln('FindObject could not find object.');
    Exit;
    end;

    GetMousePos(fx, fy);
    end;

    begin
    SetupSRL;
    FindObject(x, y);
    end.

    I added this
    if (FindColorsTolerance(arP, 4021099, MSX1, MSY1, MSX2, MSY2, 11))then
    Mouse(x, y, 2, 2, True);

    if it find it then it will click a random 2 pixels up/down and random 2 pixels left.right, and True means it will left click, if you want it to right click change True to False
    Disel, you don't have the right parameters in FindColorsSpiralTolerance()
    Quote Originally Posted by irc
    [00:55:29] < Guest3097> I lol at how BenLand100 has become noidea
    [01:07:40] <@BenLand100> i'm not noidea i'm
    [01:07:44] -!- BenLand100 is now known as BenLand42-
    [01:07:46] <@BenLand42-> shit
    [01:07:49] -!- BenLand42- is now known as BenLand420
    [01:07:50] <@BenLand420> YEA

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

    Default

    Quote Originally Posted by noidea View Post
    Disel, you don't have the right parameters in FindColorsSpiralTolerance()
    I just added the mouse function I didnt do that, sorry :P

  8. #8
    Join Date
    Jan 2008
    Location
    NC, USA.
    Posts
    4,429
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Quote Originally Posted by D1zl3 View Post
    I just added the mouse function I didnt do that, sorry :P
    Lol, sorry
    Quote Originally Posted by irc
    [00:55:29] < Guest3097> I lol at how BenLand100 has become noidea
    [01:07:40] <@BenLand100> i'm not noidea i'm
    [01:07:44] -!- BenLand100 is now known as BenLand42-
    [01:07:46] <@BenLand42-> shit
    [01:07:49] -!- BenLand42- is now known as BenLand420
    [01:07:50] <@BenLand420> YEA

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Auto Color Clicking?
    By groog in forum OSR Help
    Replies: 5
    Last Post: 08-01-2008, 04:12 AM
  2. Replies: 4
    Last Post: 04-15-2008, 09:19 AM
  3. i need help with color clicking
    By ummmmm0k in forum OSR Help
    Replies: 2
    Last Post: 02-01-2008, 01:02 AM
  4. mouse clicking
    By xelfarcherdv in forum OSR Help
    Replies: 8
    Last Post: 01-09-2008, 03:06 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
  •