Results 1 to 4 of 4

Thread: FindColorsSpiralTolerance Question

  1. #1
    Join Date
    May 2012
    Posts
    39
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default FindColorsSpiralTolerance Question

    Hi i have a quick question.

    I read somewhere that FindColorsSpiralTolerance starts the search from the centre of the main-screen which is fine, but could the spiral start position be changed to say the top left, top right, bottom left, bottom right?

    I want to know because i was thinking that when looking for a colour and couldn't find it, it could then go to the next function that would do the same search again but from a corner rather then the middle.

    thanks

  2. #2
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    It starts from what you put in the cx, cy parameters (c = centre, so cx = Centre X, cy = Centre Y).

    EDIT: Also, changing corners won't make the colour appear, as it still has to search the entire client area nonetheless.

    But, for learning purposes (if you are unsure of how to approach the solution), you can do something like the following:
    Simba Code:
    var
      I, Colour, Tolerance: Integer;
      centrePoints, Points: TPointArray;
    begin
      Colour := 16777215;  // The colour to look for.
      Tolerance := 16;  // The tolerance you are allowing for.
      centrePoints := [Point(0, 0), Point(MSX2, 0), Point(0, MSY2), Point(MSX2, MSY2)];  // The corners of the client area. If you are using it for RuneScape, then you can just leave it the way it is :)

      // Go and find the colour and each of the four corners, and when found, break out of the loop.
      for I := 0 to High(centrePoints) do
        if(FindColorsSpiralTolerance(centrePoints[I].X, centrePoints[I].Y, Colour, Points, MSX1, MSY1, MSX2, MSY2, Tolerance)) then
        Break;

      // Check if the colour was actually found or not.
      if(I = High(centrePoints) + 1) then
      begin
        Writeln('Could not find the colour in any of the four corners! :-(');
        Exit;
      end;

      // ... Do other stuff here.
    end;



    Please note, I wrote that inside of my browser and off the top of my head, so it may/may not compile and require a few additional changes/fixes.
    Last edited by Daniel; 07-24-2012 at 07:46 AM.
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

  3. #3
    Join Date
    May 2012
    Posts
    39
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    thanks ill give it ago and see what happens

  4. #4
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    Quote Originally Posted by bambe View Post
    thanks ill give it ago and see what happens
    Good luck! Remember what I said, though. Chances are, that if the colour isn't found the first time round, searches immediately after the failed ones will probably result in the same failure: the colour not being found.
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

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
  •