Results 1 to 13 of 13

Thread: HELP Restricting Area

  1. #1
    Join Date
    Dec 2011
    Location
    -bash
    Posts
    515
    Mentioned
    0 Post(s)
    Quoted
    27 Post(s)

    Default HELP Restricting Area

    I want to find an object on the screen, but I want to restrict the searching to only a specific area instead of the entire screen. How do I do this?
    Last edited by Recursive; 05-16-2012 at 07:05 AM.

  2. #2
    Join Date
    Oct 2011
    Location
    Australia, Vic
    Posts
    1,517
    Mentioned
    2 Post(s)
    Quoted
    120 Post(s)

    Default

    Simba Code:
    (*
    FindObjEx
    ~~~~~~~~~

    .. code-block:: pascal

        function FindObjEx(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray;
        Tol, Step, xs, ys, xe, ye: Integer): Boolean;

    Searches for an object using an array of colors and texts within the area
    you specify. Will start searching from the middle and returns true if found.
    Parameters:

        - cx, cy:           Coordinate Position of object if result is true
        - Text:             Array of string you want to search for
        - Color:            Array of colors you want to search for
        - Tol:              Tolerance of the colors you will allow
        - Step:             How big you want to make the search squares.
                            50 = Default. 30-70 Recommended
        - xs, ys, xe, ye:   Bounds you want to search in

    .. note::

        by Starblaster100


    Example:

    .. code-block:: pascal

    *)

    Very basic but good to start off with.

  3. #3
    Join Date
    Dec 2011
    Location
    -bash
    Posts
    515
    Mentioned
    0 Post(s)
    Quoted
    27 Post(s)

    Default

    Dam for a sec I thought you whipped that up that fast, then I noticed the blue writing.

    Anyways, any idea of what the xe, ye, xs, ys mean? Also I used points for the cx cy as in Point(#1,#2), is that what it was asking for?

  4. #4
    Join Date
    Mar 2012
    Posts
    426
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    The xs,ys means x,y starting points and xe,ye means x,y ending points. So basically the top left corner and bottom right corner of what ever area you want to search in.

    The cx,cy are the coordinates where that object is located if it is found. So if you were searching for an altar near the middle of the screen it would look like this:

    Simba Code:
    FindObjEx(x, y, ['alt','tar','altar'], [232765,556749,997456], 5, 5, 180, 80, 340, 250)
    Last edited by iBlank; 05-16-2012 at 07:48 AM.

  5. #5
    Join Date
    Dec 2011
    Location
    -bash
    Posts
    515
    Mentioned
    0 Post(s)
    Quoted
    27 Post(s)

    Default

    Umm, after the 3rd comma, what is that you have in brackets? I feel that colour is supposed to be in there
    Last edited by Recursive; 05-16-2012 at 07:40 AM.

  6. #6
    Join Date
    Mar 2012
    Posts
    426
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    You can have multiple colors in there. I was just using those as "example" colors.

    Edit - I changed it to more "color like" numbers. Hopefully that helps.

  7. #7
    Join Date
    Dec 2006
    Location
    Program TEXAS home of AUTOERS
    Posts
    7,934
    Mentioned
    26 Post(s)
    Quoted
    237 Post(s)

    Default

    Im going to give a example, hopefully you understand it.

    Simba Code:
    FindColorTolerance(x,y,1713186, 184, 151, 334, 305, 1)
    //FindColorTolerance(x,y, COLOR, X1, Y1 , X2 , Y2 , TOL)


    the x1,y1,x2,y2 : that is where the coords are placed.
    So if you put MSX1 MSY1 MSX2 MSY2 : that is the whole main screen.
    To make it custom and restrict you must use the color picker and choose from one side(left top) to the the other side (bottom right). As a imaginary Box, although make sure not to accidentally have the coords interfering with the restricted area.

    Hope you understood that, if it wasn't 3 am for me I would totally draw this all out to you on Paint... Lol.

  8. #8
    Join Date
    Mar 2012
    Posts
    426
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    Quote Originally Posted by P1nky View Post
    Im going to give a example, hopefully you understand it.

    Simba Code:
    FindColorTolerance(x,y,1713186, 184, 151, 334, 305, 1)
    //FindColorTolerance(x,y, COLOR, X1, Y1 , X2 , Y2 , TOL)


    the x1,y1,x2,y2 : that is where the coords are placed.
    So if you put MSX1 MSY1 MSX2 MSY2 : that is the whole main screen.
    To make it custom and restrict you must use the color picker and choose from one side(left top) to the the other side (bottom right). As a imaginary Box, although make sure not to accidentally have the coords interfering with the restricted area.

    Hope you understood that, if it wasn't 3 am for me I would totally draw this all out to you on Paint... Lol.
    I know how to use this function, and I'm not exactly sure what you meant by the part in bold haha

  9. #9
    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 alevere4 View Post
    I know how to use this function, and I'm not exactly sure what you meant by the part in bold haha
    Ok, look at the area you want to search in. Got it? Good.

    Now imagine that area as a box, picture it in your mind. Now open Simba and select the Color Picker Tool, it looks like an eyedrop.

    What you want to do now is go back to Runescape and click the top-left hand corner your imaginary box. Done it? Good. Write down the co-ordinates given within the brackets.

    Now click the bottom-right hand corner of your imaginary box and note down the co-ordinates again.

    So now you have two sets of co-ordinates, which means 4 numbers.

    Replace xe and ye With the first two co-ordinates you got, then replace xs and ys with the second two co-ordinates you got.

    It should now search for your colour within your imaginary box

  10. #10
    Join Date
    Dec 2011
    Location
    -bash
    Posts
    515
    Mentioned
    0 Post(s)
    Quoted
    27 Post(s)

    Default

    You guys are really helpful, it's like there is always a help police patrolling this forum day and night. Thanks, I really understand now but I could have other questions so hang on guys while I try this

    EDIT: If this is getting a bit repetitive, I apologise but after doing all I read, I put this into my code to see what happens:

    Code:
    FindObjEx(100, 228,['Ope', 'n Doo'],[3358795,33424846,3358796], 5, 5, 293, 140, 269, 74);
      ClickMouse2(true);
    And when I hit compile, I get this:
    [Error] (819:13): Variable Expected at line 818
    Compiling failed.
    EDIT2: When Abu says "look at the area you want to search in", does he mean look on minimap or on the main screen?

    EDIT3: Nvm about the compiling error, I guess I don't have to put in numbers for the cx, cy

    And WOOT!, It worked! Thanks a lot guys! This is what I used:
    Simba Code:
    FindObjEx(x,y,['Ope', 'n Doo'],[3358795,33424846,3358796], 5, 5, 269, 74,293, 140);
      ClickMouse2(true);

    Thank you guys soo much!
    Last edited by Recursive; 05-16-2012 at 05:14 PM.

  11. #11
    Join Date
    Oct 2011
    Location
    Australia, Vic
    Posts
    1,517
    Mentioned
    2 Post(s)
    Quoted
    120 Post(s)

    Default

    Instead of using:
    Simba Code:
    FindObjEx(x,y,['Ope', 'n Doo'],[3358795,33424846,3358796], 5, 5, 269, 74,293, 140);
      ClickMouse2(true);
    Use:
    Simba Code:
    FindObjEx(x,y,['Ope', 'n Doo'],[3358795,33424846,3358796], 5, 5, MSX1, MSY1, MSX2, MSY2);
      ClickMouse2(true);


    Heres a list of globals if you need a bit more of an explanation.

    Simba Code:
    { const MMX1, MMY1, MMX2, MMY2;
      Description: MiniMap Edge Points. }

    const
      MMX1 = 550;
      MMY1 = 8;
      MMX2 = 703;
      MMY2 = 161;

    { const MMCX, MMCY;
      Description: MiniMap Centre Point. }

    const
      MMCX = 627;
      MMCY = 85;

    { const MSX1, MSY1, MSX2, MSY2;
      Description: Main Screen EdgePoints. }

    const
      MSX1 = 4;
      MSY1 = 4;
      MSX2 = 515;
      MSY2 = 337;

    { const MSCX, MSCY;
      Description: Main Screen Centre Points. }

    const
      MSCX = 259;
      MSCY = 170;

    { const MIX1, MIY1, MIX2, MIY2;
      Description: Inventory EdgePoints. }

    const
      MIX1 = 547;
      MIY1 = 202;
      MIX2 = 737;
      MIY2 = 466;

    { const MICX, MICY;
      Description: Inventory Centre Points. }

    const
      MICX = 642;
      MICY = 334;

    { const MCX1, MCY1, MCX2, MCY2;
      Description: Chat Screen EdgePoints. }

    const
      MCX1 = 4;
      MCY1 = 342;
      MCX2 = 514;
      MCY2 = 475;

    { const MCCX, MCCY;
      Description: Chat Screen Centre Points. }

    const
      MCCX = 250;
      MCCY = 401;
     
    { const MBX1, MBY1, MBX2, MBY2;
      Description: BankScreen EdgePoints (where you click the items, does not include tabs). }

    const
      MBX1 = 26;
      MBY1 = 84;
      MBX2 = 480;
      MBY2 = 292;

    { const DBX1, DBY1, DBX2, DBY2;
      Description: Deposit box edgepoints (only where the item appear) }

    const
      DBX1 = 91;
      DBY1 = 57;
      DBX2 = 443;
      DBY2 = 262;

    I understand that you are searching a custom area of the screen this time around, but this is just for future knowledge.

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

    Default

    Don't listen to John, the function he told you to use will search the whole Main Screen and not just in the area you want it to.

    However, in future you will want to search the whole area of something (MainScreen, Inventory etc..) so take into account what he's said

  13. #13
    Join Date
    Oct 2011
    Location
    Australia, Vic
    Posts
    1,517
    Mentioned
    2 Post(s)
    Quoted
    120 Post(s)

    Default

    Quote Originally Posted by John View Post
    I understand that you are searching a custom area of the screen this time around, but this is just for future knowledge.
    Quote Originally Posted by abu_jwka View Post
    Don't listen to John, the function he told you to use will search the whole Main Screen and not just in the area you want it to.

    However, in future you will want to search the whole area of something (MainScreen, Inventory etc..) so take into account what he's said
    I realized what i said when i posted, but was to tired to change it :P

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
  •