Log in

View Full Version : why is...



Waddo
05-13-2008, 04:03 PM
why is SB100's findobjcustom2 not included in the srl includes
if it is please tell me where

if it isnt

please add it

so you nice devs dont have to go looking fo it here it is

starblasters findobjcustom2

function FindObjCustom2(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray; Tolerance: Integer): Boolean;
var
a, b, c, i, x1, y1, x2, y2: Integer;
Start: Boolean;
begin
for b := 0 to (GetArrayLength(Color)-1) do
begin
if (FindColorSpiralTolerance(cx, cy, color[b], MSX1, MSY1, MSX2, MSY2, Tolerance)) then
begin
Start := True;
Break;
end;
end;
if(Start)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
else 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 else
if (a = 2) then
begin
y1 := y1 - 20;
y2 := y2 - 20;
end else
if (a = 3) then
begin
x1 := x1 - 30;
x2 := x2 - 30;
end else
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;
for b := 0 to (GetArrayLength(Color)-1) do
begin
if (FindColorTolerance(cx, cy, Color[b], x1, y1, x2, y2, tolerance)) then
begin
MMouse(cx, cy, 3, 3);
Wait(5+Random(10));
if (IsUpTextMultiCustom(Text)) then
begin
Result := True;
Exit;
end;
end;
end;
end;
if (a = 4) then
a := 0;
until (x2 > 515) or (Result = True);
end;
end;

Richard
05-13-2008, 06:25 PM
It might be in one of the other includes, in which case you'll have to write that one in aswell.

Zyt3x
05-13-2008, 06:41 PM
It looks like it searches in a small place, note:


x1 := 245;
y1 := 165;
x2 := 277;
y2 := 185;

so sb100 made it for himself then.

EDIT: And btw, i think its a long time since he made it, theres not 'Case a of' in there.

mixster
05-13-2008, 06:50 PM
Zytex, it expands the search range inside the function so I'm guessing it spirals outwards from the center in steps and not all people like using case's - especially with multiple lines of code as it looks ugly :)

Zyt3x
05-13-2008, 07:12 PM
I think cases looks better :D
I cant see it spirals outwards from the center in steps i can only see that is spirals outwards from the center in a 20*32 box...?

mixster
05-13-2008, 07:16 PM
There's a nicely slipped in repeat until in there so it continuously expands the box until it succeeds or fails at full MS size :)

Waddo
05-23-2008, 11:45 PM
yep it is a brillent peice of work