Recursive
2012-05-16 02:08:08
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?
2012-05-16 02:08:08
2012-05-16 02:14:32
(*
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
*)2012-05-16 03:05:00
2012-05-16 03:14:05
FindObjEx(x, y, ['alt','tar','altar'], [232765,556749,997456], 5, 5, 180, 80, 340, 250)
2012-05-16 03:34:27
2012-05-16 03:47:35
2012-05-16 04:04:12
FindColorTolerance(x,y,1713186, 184, 151, 334, 305, 1)
//FindColorTolerance(x,y, COLOR, X1, Y1 , X2 , Y2 , TOL)
2012-05-16 04:13:49
From: P1nky
Im going to give a example, hopefully you understand it.
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.
2012-05-16 11:53:39
From: alevere4
I know how to use this function, and I'm not exactly sure what you meant by the part in bold haha :p
2012-05-16 12:50:33
FindObjEx(100, 228,['Ope', 'n Doo'],[3358795,33424846,3358796], 5, 5, 293, 140, 269, 74);
ClickMouse2(true); [Error] (819:13): Variable Expected at line 818
Compiling failed.
FindObjEx(x,y,['Ope', 'n Doo'],[3358795,33424846,3358796], 5, 5, 269, 74,293, 140);
ClickMouse2(true);2012-05-17 05:50:25
FindObjEx(x,y,['Ope', 'n Doo'],[3358795,33424846,3358796], 5, 5, 269, 74,293, 140);
ClickMouse2(true);Use:FindObjEx(x,y,['Ope', 'n Doo'],[3358795,33424846,3358796], 5, 5, MSX1, MSY1, MSX2, MSY2);
ClickMouse2(true);{ 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;2012-05-17 15:09:30
2012-05-17 19:44:45
From: John
I understand that you are searching a custom area of the screen this time around, but this is just for future knowledge.
From: abu_jwka
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 :)