Results 1 to 7 of 7

Thread: Need to distinguish an object from points.

  1. #1
    Join Date
    Oct 2007
    Location
    http://ushort.us/oqmd65
    Posts
    2,605
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default Need to distinguish an object from points.

    Problem solved, Different Issue, scroll down.

    I have this set of points. (image)

    (Ignore the box, the box is from a mouse click procedure i made for clicking the hopper).

    I want it to click the lever based on the points, but as you can see, there are some points being found below the lever..

    Im using this var + procedure i made to get the points.

    SCAR Code:
    ColorPoints := FindCPoints(5798020,Point(Msx1,MSY1),Point(Msx2,MSY2)); // In a different procedure.
     
    Function FindCPoints(colord:integer;Point1,Point2: Tpoint): TPointArray;
    Begin
      ColorToleranceSpeed(3);
      SetColorSpeed3Modifiers(10);
      FindColorsSpiralTolerance(MSCX, MSCY, Result, colord, Point1.X, Point1.Y, Point2.X, Point2.Y, 2);
      SetColorSpeed3Modifiers(4);
      ColorToleranceSpeed(1);
    End;

    ideas to do this???
    I do visit every 2-6 months

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

    Default

    If you can figure out which general area the lever is in, count the concentration level (at a few different points), and then compare it to an average?

    ~Sand

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

    Default

    make small atpa's and go through each one. test the ones with the smallest width, and also do count colour checks.
    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

  4. #4
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    search for the distance from the white color of the wall.

  5. #5
    Join Date
    Oct 2007
    Location
    http://ushort.us/oqmd65
    Posts
    2,605
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    K, This is what I have mormonman

    SCAR Code:
    //This is my clicking procedure.
    ColorPoints := FindCPoints(5798020,20,Point(Msx1,MSY1),Point(Msx2,MSY2));
      SecondaryPoints := FindCPoints(12046035,28,Point(Msx1,MSY1),Point(Msx2,MSY2));
      FilteredPoints := FilterPoints(ColorPoints,SecondaryPoints,30);

      LeverPoints := PointsInArray(ColorPoints,FilteredPoints);
    Iss := random(length(FilteredPoints));
      wait(5000+random(400));
      mouse(FilteredPoints[Iss].x,FilteredPoints[Iss].y,0,0,true);
     


    Function FilterPoints(TPA1,TPA2:TPointArray;distance:Integer):TPointArray;
    var
      I, D, Distances : Integer;
      Temppoint1,Temppoint2 : TPoint;
    begin
      setlength(result,0);
      for i := 0 to high(TPA1)do
      begin
        Temppoint1 := TPA1[I];
        For D :=0 to high(TPA2)do
        begin
          TempPoint2 := TPA2[D];
          Distances := Iabs(temppoint2.x-temppoint1.x);
          Distances := Distances + (Iabs(temppoint2.y-temppoint1.y));
          if(Distances<Distance)then
          begin
            setlength(result, Length(Result)+ 1);
            result[high(result)] := Temppoint1;
            setlength(result, Length(Result)+ 1);
            result[high(result)] :=Temppoint2;
          end;
        end;
       
      end;
    end;

    Function PointequalPoint(Point1,Point2:TPoint):boolean;
    begin
      If(Point1.x=Point2.x)then
        result := Point2.y=Point1.y;
    end;

    Function PointsInArray(Points, ArrayToCheck: TPointArray): TPointArray;
    Var
      I, D : integer;
      Temp1,Temp2 : Tpoint;
    begin
      setlength(Result,0);
      for I := 0 to high(Points)do
      begin
        Temp1 := Points[I];
          For D := 0 to High(ArrayToCheck)do
          begin
            Temp2 := ArrayToCheck[D];
            If(PointequalPoint(Temp1,Temp2))then
            begin
              setlength(result, Length(Result)+ 1);
              result[high(result)] := Temp1;
            end;
          end;
      end;
    end;

    It works 100% now, but now it is really slow, takes 20+ seconds to filter + check. How can I make this faster???
    I do visit every 2-6 months

  6. #6
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Maybe use the color of the hopper instead of the wall seeing as there is a lot of that offwhite on the screen.

  7. #7
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    PointInTPA is in Wizzy AFAIK.
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

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
  •