SRL Archive - OSR Help

how to focus one 1 object out of many?


ogustuce

2013-01-04 22:40:50

how to focus one 1 object out of many identic others?

so what i want to do is with a DTM (or TPA) draw a box around it and make the script focus on the first it find(DTM or TPA) and forget about the others.

What i want the script to do:
go to a place and click many times on one thing (but that thing is with many others). so how can i make it focus on a single one and forget the others? Make it focus on the first it finds

riwu

2013-01-04 22:47:04

Use TPA finding, then sort the TPA by the same method (eg. from centre) every time, then just click on the first index of the TPA. if your relative pos to your object dont change, it should result in the same obj being on the first (zeroth) index.

ogustuce

2013-01-04 22:50:09


var
MyTPA : TPointArray;
MyPoint : TPoint;
x, y, i : Integer;
begin
FindColorsSpiralTolerance(MSCX,MSCY,MyTPA,12539990,MSX1,MSY1,MSX2,MSY2,6);
if Length(MyTPA) = 0 then
FindColorsSpiralTolerance(MSCX,MSCY,MyTPA,12539990,MSX1,MSY1,MSX2,MSY2,6);
for i := 0 to High(MyTPA)do
begin
MyPoint := MyTPA[i]
MMouse (MyPoint.x, MyPoint.y, 3, 3);
if (IsUpTextMultiCustom(['Icosa', 'ile','Pile','edron Pil','hedron','cosahedro','cosahedron Pil'])) then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, true);
exit;
end;
end;

this start searching from middle of the screen but sometimes it doesnt get the closest one

thats what im using……works 50/50 of the times, im looking for something better =p

riwu

2013-01-04 22:57:22

You could possibly determine the direction of the object relative to you and only search within a radian of that direction?

But why wouldn't you want to click on another identical object if it becomes nearer to the one you are clicking? What are you scripting this for?

ogustuce

2013-01-04 23:02:34

the script is MTA enchant room. its to gather the rocks to enchant. and the procedure i posted sometimes goes wrong…….

ex:
im standing right in front of a pile, clicks it a bunch of times then it clicks on another one that is not the closest then it makes move the character and it click a bunch of piles while the account is moving……doesnt look human lol