WT-Fakawi
06-10-2006, 01:30 AM
FindObjectMulti finds an Object using a maximum three different Uptext values i.e.'Att','tta','ack', using max three different colors. It will try to find the Object Turns times, thus restricting the functions mouse movements. Usefull for non crucial Object finding like Bones / Cows / Goblins / Potatoes.
FindObjectMulti is a small loop in itself. Dont use to high Turns values. 4-10 should be sufficient.
Why three Uptexts and Three Colors?
Well because SCAR OCR's isnt 100% and because The RS Client spreads out
{************************************************* ******************************
function FindObjectMulti(Text1, Text2, Text3 : String; color1, color2, color3, tolerance, Turns : Integer; MultiText, MultiTimes : Boolean) : Boolean;
By: Stupid3ooo / Kernel Klink / Mutant Squirrle / WT-Fakawi
Description: Finds Object From Screen Center
************************************************** *****************************}
function FindObjectMulti(Text1, Text2, Text3 : String; color1, color2, color3, tolerance, Turns : Integer; MultiText, MultiTimes : Boolean) : Boolean;
var
x, y, a, c, i, x1, y1, x2, y2, count: Integer;
begin
if (FindMSColorTol(x, y, color1, tolerance)) or
(FindMSColorTol(x, y, color2, tolerance)) or
(FindMSColorTol(x, y, color3, tolerance)) then
begin
x1 := 245;
y1 := 165;
x2 := 277;
y2 := 185;
repeat
if (not (Loggedin)) then
break;
a := a + 1;
if (a = 1) then
c := c + 1;
if (a = 3) then
c := c + 1;
for i := 1 to c do
begin
if (a = 1) then
begin
x1 := x1 + 30;
x2 := x2 + 30;
end;
if (a = 2) then
begin
y1 := y1 - 20;
y2 := y2 - 20;
end;
if (a = 3) then
begin
x1 := x1 - 30;
x2 := x2 - 30;
end;
if (a = 4) then
begin
y1 := y1 + 20;
y2 := y2 + 20;
end;
if (x1 = 485) and (x2 = 517) then
x2 := x2 - 2;
if (y1 = 325) and (y2 = 345) then
y2 := y2 - 7;
if (x2 > 515) then
Break;
if (FindColorTolerance(x, y, color1, x1, y1, x2, y2, tolerance)) or
(FindColorTolerance(x, y, color2, x1, y1, x2, y2, tolerance)) or
(FindColorTolerance(x, y, color3, x1, y1, x2, y2, tolerance)) then
begin
MMouse(x, y, 0, 0);
if (IsUpText(Text1)) or ((IsUpTextMulti(Text1, Text2, Text3)) and (MultiText)) then
begin
Result := True;
Break;
end;
end;
end;
if (a = 4) then
a := 0;
Count := Count + 1;
until ((Count = Turns) and (MultiTimes)) or ((Result = True) and (MultiTimes))
end;
end;
FindObjectMulti is a small loop in itself. Dont use to high Turns values. 4-10 should be sufficient.
Why three Uptexts and Three Colors?
Well because SCAR OCR's isnt 100% and because The RS Client spreads out
{************************************************* ******************************
function FindObjectMulti(Text1, Text2, Text3 : String; color1, color2, color3, tolerance, Turns : Integer; MultiText, MultiTimes : Boolean) : Boolean;
By: Stupid3ooo / Kernel Klink / Mutant Squirrle / WT-Fakawi
Description: Finds Object From Screen Center
************************************************** *****************************}
function FindObjectMulti(Text1, Text2, Text3 : String; color1, color2, color3, tolerance, Turns : Integer; MultiText, MultiTimes : Boolean) : Boolean;
var
x, y, a, c, i, x1, y1, x2, y2, count: Integer;
begin
if (FindMSColorTol(x, y, color1, tolerance)) or
(FindMSColorTol(x, y, color2, tolerance)) or
(FindMSColorTol(x, y, color3, tolerance)) then
begin
x1 := 245;
y1 := 165;
x2 := 277;
y2 := 185;
repeat
if (not (Loggedin)) then
break;
a := a + 1;
if (a = 1) then
c := c + 1;
if (a = 3) then
c := c + 1;
for i := 1 to c do
begin
if (a = 1) then
begin
x1 := x1 + 30;
x2 := x2 + 30;
end;
if (a = 2) then
begin
y1 := y1 - 20;
y2 := y2 - 20;
end;
if (a = 3) then
begin
x1 := x1 - 30;
x2 := x2 - 30;
end;
if (a = 4) then
begin
y1 := y1 + 20;
y2 := y2 + 20;
end;
if (x1 = 485) and (x2 = 517) then
x2 := x2 - 2;
if (y1 = 325) and (y2 = 345) then
y2 := y2 - 7;
if (x2 > 515) then
Break;
if (FindColorTolerance(x, y, color1, x1, y1, x2, y2, tolerance)) or
(FindColorTolerance(x, y, color2, x1, y1, x2, y2, tolerance)) or
(FindColorTolerance(x, y, color3, x1, y1, x2, y2, tolerance)) then
begin
MMouse(x, y, 0, 0);
if (IsUpText(Text1)) or ((IsUpTextMulti(Text1, Text2, Text3)) and (MultiText)) then
begin
Result := True;
Break;
end;
end;
end;
if (a = 4) then
a := 0;
Count := Count + 1;
until ((Count = Turns) and (MultiTimes)) or ((Result = True) and (MultiTimes))
end;
end;