Results 1 to 13 of 13

Thread: FindColoredAreaToleranceEx

  1. #1
    Join Date
    Sep 2010
    Location
    Azeroth
    Posts
    395
    Mentioned
    0 Post(s)
    Quoted
    17 Post(s)

    Exclamation FindColoredAreaToleranceEx

    can there be a function like this one? FindColoredAreaTolerance is great but is limited to searcharea.. any like it but with more flexable perameters???


    im tring to find an area of color thats about 20 by 5 so it needs to be specified...

  2. #2
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    FindColoredArea should work just fine for what you are trying to do.

    It is not at all limited...

    because you can specify the co-ordinates.
    Last edited by Abu; 04-20-2012 at 06:41 AM.

  3. #3
    Join Date
    Sep 2010
    Location
    Azeroth
    Posts
    395
    Mentioned
    0 Post(s)
    Quoted
    17 Post(s)

    Default

    yeah i thought about that one but it still uses area and thats not great for rectangles... i think findobjex has a custimized search function something like that but yeah...

    what i am trying to do is detect weather the door is closed or open by grabbing the the top color of the doors when they are closed... it makes a long brown line...

  4. #4
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    Quote Originally Posted by wantonman View Post
    yeah i thought about that one but it still uses area and thats not great for rectangles...
    /facepalm


    You can put the area of the rectangle in the function. Get the top left co-ordinate of the door and the bottom right. Then replace those co-ordinates with xs, ys, xe, ye in the function.
    Last edited by Abu; 04-22-2012 at 12:31 PM.

  5. #5
    Join Date
    Sep 2010
    Location
    Azeroth
    Posts
    395
    Mentioned
    0 Post(s)
    Quoted
    17 Post(s)

    Question

    okay okay yeah this leads me to beleive that the cordinates arent static... which is a good thing....

    so your saying even though the cooradinates are at the top left of the screen it still will retain the shape but also find it at bottom left?

  6. #6
    Join Date
    Mar 2012
    Location
    127.0.0.1
    Posts
    3,383
    Mentioned
    95 Post(s)
    Quoted
    717 Post(s)

    Default

    Yes, yes it will.

  7. #7
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    Quote Originally Posted by wantonman View Post
    okay okay yeah this leads me to beleive that the cordinates arent static... which is a good thing....

    so your saying even though the cooradinates are at the top left of the screen it still will retain the shape but also find it at bottom left?
    The co-ordinates are whatever you set it to.

    MSX1, MSY1, MSX2, MSY2 are simply used by SRL to grab the mainscreen. You can replace them with whatever you want. For example:

    25, 289, 20, 295 (made up co-ordinates)

  8. #8
    Join Date
    Sep 2010
    Location
    Azeroth
    Posts
    395
    Mentioned
    0 Post(s)
    Quoted
    17 Post(s)

    Default

    my worry is that the door is not always going to be in the same place...

    so having small coords. will not alway work...



    uh.. yeah... uhm hmm....




    here is my debug...

    as you can see what i am looking for...


    many ways but mainly just a simble boolean is all.........

  9. #9
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    You can use co-ordiantes which would create a box slightly bigger than the door. That way if you move left and right the door will still be within those co-ordinates. It's better than using the whole screen....

  10. #10
    Join Date
    Dec 2011
    Location
    The Netherlands
    Posts
    1,631
    Mentioned
    47 Post(s)
    Quoted
    254 Post(s)

    Default

    FindObjTPA(X, Y, {color}, {tol}, {CTS}, {ObjWidth}, {ObjHeight}, {mincount}, {uptext})

    By using CTS 2 and ACA you can get it pretty accurate

    I also made the code for you:

    Simba Code:
    procedure Test;
    var
      X, Y: integer;

    begin
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.17, 1.15);
      if FindObjTPA(X, Y, 2172974, 4, 2, 100, 5, 250, ['Open', 'Open door']) then
        begin
          ClickMouse2(1);
          WriteLn('We have clicked on the door, because it has been closed');
        end else
        begin
          WriteLn('The door is still open');
        end;
    end;
    You must choose high values for the FindObjTpa because it can possibly find other objects otherwise that have different uptexts. This one with 100x5 px works great
    Last edited by J J; 04-20-2012 at 07:58 PM.

    Script source code available here: Github

  11. #11
    Join Date
    Sep 2010
    Location
    Azeroth
    Posts
    395
    Mentioned
    0 Post(s)
    Quoted
    17 Post(s)

    Default

    true abu but what if im not to the left or right sometimes? it can hic-up at times... but hmm...


    and findobjex it good but i dont want the mouse to spazz around the screen each time i do the door check lol...

    like i said just a simple boolean... and abu is on the right track =]]

    but man too bad objex didnt have to have up text and too bad it cannot just match that shape everytime ...

  12. #12
    Join Date
    Dec 2011
    Location
    The Netherlands
    Posts
    1,631
    Mentioned
    47 Post(s)
    Quoted
    254 Post(s)

    Default

    You should try that code because it doesn't "spazz around the screen" at all. You just have to fill in the correct numbers to make it work properly.

    Script source code available here: Github

  13. #13
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Step 1: Use 'FindColorsSpiralTolerance' (preferably with CTS 2 + modifiers) to get a TPA of all of your "door colors".

    Step 2: Use 'SplitTPAEx' to split that TPA into 20x5 TPAs.

    Step 3: For each box, get the middle point of each TPA (middleTPA), move the mouse to that middle point, search for the door's uptext.

    Step 4: If correct uptext is found for one of your TPAs, break the loop, click/right-click the door.

    Easy peasey.

    Edit:
    Refer to this thread for all TPA-related methods.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


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
  •