Log in

View Full Version : TPA Help



Footy
08-25-2012, 01:49 PM
Hey guys, how would I get a for..to..do loop to go through random points in a TPA?

riwu
08-25-2012, 01:55 PM
for i:=0 to High(TPA) do
begin
MMouse(TPA[i].x,TPA[i].y,5,5);
end;

NKN
08-25-2012, 01:56 PM
I'm confused as to what your question is. You want it to skip some points in a TPA?

putonajonny
08-25-2012, 02:00 PM
if(GetArrayLength(TPA) <> 0)then
begin
Repeat
R := Random(GetArrayLength(TPA));
MMouse(TPA[R].x, TPA[R].y, 3, 3);
if(WaitUpText('the objct you are looking for', 50+Random(200)))then
begin
ClickMouse2(mouse_Left);
Result := DidRedClick;
break;
end;
inc(Counter);
Until(Counter > 5);
end;

Footy
08-25-2012, 02:01 PM
Say I made a TPA that collected Tpoints of all color A in a box. What I want this to do is go through random points in the TPA instead of in any order.
E: Thanks Putona!

putonajonny
08-25-2012, 02:02 PM
Say I made a TPA that collected Tpoints of all color A in a box. What I want this to do is go through random points in the TPA instead of in any order.

See my post above yours... :)

riwu
08-26-2012, 12:13 AM
if(GetArrayLength(TPA) <> 0)then
begin
Repeat
R := Random(GetArrayLength(TPA));
MMouse(TPA[R].x, TPA[R].y, 3, 3);
if(WaitUpText('the objct you are looking for', 50+Random(200)))then
begin
ClickMouse2(mouse_Left);
Result := DidRedClick;
break;
end;
inc(Counter);
Until(Counter > 5);
end;
That may result in it looping through the same point.
I suggest to use a for loop then delete the point that was already looped using DeleteValueInTPA(TPA, R).

Most of the time we loop through points near the centre first (rather than random points) though, by either using FindColorsSpiralTolerence, or sort the TPA from centre.