Sockz
02-21-2012, 09:15 AM
Hello :D
I'm trying to do a little bit of coding that will search for a colour, if unable to detect the colour will try searching for a new colour and use that as the colour to be searched from then on.
Basically I need this because the colours will change slightly between users / logouts and what not. My problem is objectTPAs don't seem to stop searching until it finds the colour, I tried objcustom function and it still took to long to find the colour. What i need is if it can't find the colour straight away, as in not move the cursor all around the screen, then begin looking for a new colour. If anyone has any ideas they think may help post please! Thanks guys for reading. :D code is below
Procedure NewColourPatch;
var
i: Integer;
begin
case i of
0:
begin
PatchColour:= 5664128
i:= i + 1
writeln('1')
end;
1:
begin
PatchColour:= 4700000
i:= i + 1
writeln('2');
end;
2:
begin
PatchColour:= 4939375
i:= 0
writeln('3');
end;
end;
end;
Procedure WalkPatch;
var
x, y: Integer;
walked: boolean;
begin
repeat
Path:= Patch
Walk;
repeat
Wait(100);
until(IsMoving = false);
x:=MSCx
y:=MSCy
if FindObjTPA(x, y, PatchColour, 5, 1, 10, 10, 5, ['arming patch']) then
begin
mouse(x, y, 5, 5, 0);
if WaitOption('alk here', 300) then
walked:= true
end else
begin
walked:= false
NewColourPatch;
end;
until(walked = true)
end;
I'm trying to do a little bit of coding that will search for a colour, if unable to detect the colour will try searching for a new colour and use that as the colour to be searched from then on.
Basically I need this because the colours will change slightly between users / logouts and what not. My problem is objectTPAs don't seem to stop searching until it finds the colour, I tried objcustom function and it still took to long to find the colour. What i need is if it can't find the colour straight away, as in not move the cursor all around the screen, then begin looking for a new colour. If anyone has any ideas they think may help post please! Thanks guys for reading. :D code is below
Procedure NewColourPatch;
var
i: Integer;
begin
case i of
0:
begin
PatchColour:= 5664128
i:= i + 1
writeln('1')
end;
1:
begin
PatchColour:= 4700000
i:= i + 1
writeln('2');
end;
2:
begin
PatchColour:= 4939375
i:= 0
writeln('3');
end;
end;
end;
Procedure WalkPatch;
var
x, y: Integer;
walked: boolean;
begin
repeat
Path:= Patch
Walk;
repeat
Wait(100);
until(IsMoving = false);
x:=MSCx
y:=MSCy
if FindObjTPA(x, y, PatchColour, 5, 1, 10, 10, 5, ['arming patch']) then
begin
mouse(x, y, 5, 5, 0);
if WaitOption('alk here', 300) then
walked:= true
end else
begin
walked:= false
NewColourPatch;
end;
until(walked = true)
end;