Results 1 to 10 of 10

Thread: following a color line

  1. #1
    Join Date
    Apr 2007
    Location
    Colchester, UK
    Posts
    1,220
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default following a color line

    how do i get the mouse to move along a line of a specific color??

    so in paint if you draw a red line how can you get the mouse to follow it from start to finish?

    thanks

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

  3. #3
    Join Date
    Apr 2007
    Location
    Colchester, UK
    Posts
    1,220
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    yes but how would i go about doing that, i have tryed by using findcolor but it just goes to the same place even if i give it a diffrent cords

  4. #4
    Join Date
    Jun 2007
    Location
    Wednesday
    Posts
    2,446
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    SCAR Code:
    procedure FollowLine(color, tol: Integer);
    var
      x, y, mY: Integer;
    begin
      MoveMouse(4000,4000);
      GetMousePos(x,mY);
      x := 1;
      while FindColorTolerance(x, y, color, x, 1, x + 1, mY, tol) do
      begin
        MoveMouse(x,y);
        Inc(x);
        Wait(10);
      end;  
    end;

    That *should* work, though I'm not sure.
    By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.

  5. #5
    Join Date
    Apr 2007
    Location
    Colchester, UK
    Posts
    1,220
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    nope didnt work for me, all it did was move the mouse to the bottom right of the screen, but thanks for the try.

    if any one els has a idea that would be great.

    edit:

    nope still does the same, the wait is now 1000 and still nothing

  6. #6
    Join Date
    Jun 2007
    Location
    Wednesday
    Posts
    2,446
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Try increasing the Wait time as it may be that it just went along the entire line to quickly then ran out of colours so failed.
    By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.

  7. #7
    Join Date
    Sep 2007
    Posts
    415
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    this'll work on any line, curved or w/e, as long as it doesn't overlap

    SCAR Code:
    program New;
    {.include srl/srl.scar}
    Procedure followline(color,x1,y1,x2,y2:integer);
    var
      TTPA:tpointarray;
      ATPA: T2dPointArray;
      x,y,l: integer;
    begin
      findcolorstolerance(TTPA,color,x1,y1,x2,y2,0);
      ATPA := SplitTPA(TTPA,3);
      for l := 0 to high(TTPA) do
      begin
        MoveMouse(ATPA[0][l].x,ATPA[0][l].y);
        wait(5);
      end;
    end;
    begin
      setupsrl;
      ActivateClient;
    end.
    Quote Originally Posted by That guy that wrote forefeathers
    <munklez>haha im too lazy, girls annoy me
    <munklez> they always wanna like, do stuff
    <munklez> and i just wanna program
    <munklez> and they always take all my money

  8. #8
    Join Date
    Apr 2007
    Location
    Colchester, UK
    Posts
    1,220
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    thanks it works great in a straigth line but if its curved it basiclay starts in the middle and goes both ways along the line, can it only go one way, so from left to right? thanks

  9. #9
    Join Date
    Sep 2007
    Posts
    415
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    program New;
    {.include srl/srl.scar}
    Procedure followline(color,x1,y1,x2,y2:integer);
    var
      TTPA:tpointarray;
      ATPA: T2dPointArray;
      x,y,l: integer;
    begin
      findcolorsspiraltolerance(0,0,TTPA,color,x1,y1,x2,y2,0);
      ATPA := SplitTPA(TTPA,3);
      for l := 0 to high(TTPA) do
      begin
        MoveMouse(ATPA[0][l].x,ATPA[0][l].y);
        wait(1);
      end;
    end;
    begin
      setupsrl;
      ActivateClient;
    end.
    maybe that will do? if not edit the "0,0" in findcolorsspiraltolerance to about where you want the line to start, i'm sure that will work
    Quote Originally Posted by That guy that wrote forefeathers
    <munklez>haha im too lazy, girls annoy me
    <munklez> they always wanna like, do stuff
    <munklez> and i just wanna program
    <munklez> and they always take all my money

  10. #10
    Join Date
    Apr 2007
    Location
    Colchester, UK
    Posts
    1,220
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    nice, that works brilliantly, had to change the findcolorspiraltolerace to starting position for it to work, thanks

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 5
    Last Post: 07-31-2007, 07:23 PM
  2. Useing grass color as road color??????
    By ronny.m.p in forum OSR Help
    Replies: 7
    Last Post: 04-28-2007, 09:42 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
  •