SRL Archive - Help

TPA Help


Footy

2012-08-25 09:49:12

Hey guys, how would I get a for..to..do loop to go through random points in a TPA?

riwu

2012-08-25 09:55:53

for i:=0 to High(TPA) do
begin
MMouse(TPA.x,TPA.y,5,5);
end;

NKN

2012-08-25 09:56:35

I'm confused as to what your question is. You want it to skip some points in a TPA?

putonajonny

2012-08-25 10:00:03

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

2012-08-25 10:01:53

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

2012-08-25 10:02:47

From: Footy
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

2012-08-25 20:13:48

From: putonajonny
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.