Log in

View Full Version : TPA Help



Deadly Serious
01-14-2012, 04:00 AM
This procedure is suppose to click a tiara, then click the alter and then proceed through the options and create an air tiara but it doesn't seem to be registering anything it just skips the procedure. I have got it in my main loop as well.

Procedure Crafting;
Var
I, x, y: integer;
Path: TStringArray;
TPA : TPointArray;
ATPA : T2DPointArray;

begin
if not loggedin then exit;
FindNormalRandoms;
Antiban;
DidRedClick;


begin
FindColorsTolerance(TPA, 12500679, MIX1, MIY1, MIX2, MIY2, 3); // Thanks to Naums' Tutorial
ATPA := TPAToATPAEx(TPA, 18, 28);
For I := 0 To High(ATPA) Do
Begin
If MiddleTPAEx(ATPA[I], X, Y) Then
begin
Writeln('Clicking on the Talisman');
MMouse(X, Y, 5, 5);
ClickMouse2(True);
Wait(500+random(250));
end;

begin
If FindObjCustom(x, y, ['raft', 'Rune'], [5591380, 5920344, 5723222, 5525587, 5525843, 5722966, 5723222], 3) then
begin
Writeln('Crafted Air runes')
Getmousepos(x, y)
MMouse(X, Y, 15, 15);
ClickMouse2(True);

end;

begin
Path:= ['256:404:4:1:7:582:116:1:7:570:104:1:7:574:63:1:7: 584:48'];

for I := 0 to 0 do
ObjDTM_Walk(Path[i], 0, 100, 80, True);

Wait(2000+Random(500));

end;

begin
FindColorsTolerance(TPA, 2108211, MSX1, MSY1, MSX2, MSY2, 3); // Thanks to Naums' Tutorial
ATPA := TPAToATPAEx(TPA, 58, 48);
For I := 0 To High(ATPA) Do
Begin
If MiddleTPAEx(ATPA[I], X, Y) Then
begin
Writeln('Clicking on the option');
MMouse(X, Y, 5, 5);
ClickMouse2(True);
Wait(4000+random(250));
end;
end;
end;
end;
end;
end;
end;

Brandon
01-14-2012, 04:45 AM
I cannot tell if you fully understand the concepts of TPA's (well for object finding at least) due to the fact that your using FindObjCustom and that you don't have failsafes such as if Length(ATPA[I]) = 0 then exit.. etc..

Umm Look up RAaSTPA.. Stands for Re-ArrangeAndShortenArray.. it will leave ONE point for each object found.. That way if it finds multiple points of the same colour for one object, it won't iterate through every single point found..

Example for one tiara it can prob find like iunno 50 pixels of the same/similar colour thus the TPA would hold 50 points for that ONE invent item.. lets say you have 28 of them and then the finder will iterate through each and every point! Now with RAaSTPA, it will only have 1 point per item found.. thus 28 items = 28 points and iterating through them will result in 28 iterations thus it will be very fast! And it will work.

Deadly Serious
01-14-2012, 05:02 AM
I cannot tell if you fully understand the concepts of TPA's (well for object finding at least) due to the fact that your using FindObjCustom and that you don't have failsafes such as if Length(ATPA[I]) = 0 then exit.. etc..

Umm Look up RAaSTPA.. Stands for Re-ArrangeAndShortenArray.. it will leave ONE point for each object found.. That way if it finds multiple points of the same colour for one object, it won't iterate through every single point found..

Example for one tiara it can prob find like iunno 50 pixels of the same/similar colour thus the TPA would hold 50 points for that ONE invent item.. lets say you have 28 of them and then the finder will iterate through each and every point! Now with RAaSTPA, it will only have 1 point per item found.. thus 28 items = 28 points and iterating through them will result in 28 iterations thus it will be very fast! And it will work.

I do understand how to use them and implement them into scripts. Even though it is finding multiple points it shouldn't just automatically skip to the next function.
I'll search up "RAaSTPA" later.
I used findobjcustom because it has never failed me, why change something which isn't broken?

Brandon
01-14-2012, 05:06 AM
I do understand how to use them and implement them into scripts. Even though it is finding multiple points it shouldn't just automatically skip to the next function.
I'll search up "RAaSTPA" later.
I used findobjcustom because it has never failed me, why change something which isn't broken?

Not suggesting you change just wasn't sure as it tends to mess up quite a bit depending on what your finding which is why I assume you have that many colours for the altar :S

Why would it just skip? All the points are in the TPA it's still iterating through them.

It's like:
//Multiple points for one item.
TPA:= [Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y)];
For I:= 0 To High(TPA) do
writeln(TPA[I]);


vs

//All points in this is UNIQUE for EACH item.
TPA:= [Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y)];
For I:= 0 To High(TPA) do
writeln(TPA[I]);

Deadly Serious
01-14-2012, 05:11 AM
Not suggesting you change just wasn't sure as it tends to mess up quite a bit depending on what your finding which is why I assume you have that many colours for the altar :S

Why would it just skip? All the points are in the TPA it's still iterating through them.

It's like:
//Multiple points for one item.
TPA:= [Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y)];
For I:= 0 To High(TPA) do
writeln(TPA[I]);


vs

//All points in this is UNIQUE for EACH item.
TPA:= [Point(X, Y), Point(X, Y), Point(X, Y), Point(X, Y)];
For I:= 0 To High(TPA) do
writeln(TPA[I]);


That's what I'm saying. It's just skipping onto the next procedure. It completely avoids that one.

Brandon
01-14-2012, 05:20 AM
That's what I'm saying. It's just skipping onto the next procedure. It completely avoids that one.

What? No it does not skip anything at all.. See here:

Every single point in the TPA is iterated through.. there is no skipping due to the for loop.


For I := 0 To High(ATPA) Do
Begin
If MiddleTPAEx(ATPA[I], X, Y) Then
begin
Writeln('Clicking on the Talisman');
MMouse(X, Y, 5, 5);
ClickMouse2(True);
Wait(500+random(250));
end;
//Next procedure here.. is done then it goes back to the for loop and looks for points on the same ITEM!


See my post on the 3rd page of NAUM's tutorial.. The image explains it better. I'm really bad at explaining but I try.

Deadly Serious
01-14-2012, 05:24 AM
What? No it does not skip anything at all.. See here:

Every single point in the TPA is iterated through.. there is no skipping due to the for loop.


For I := 0 To High(ATPA) Do
Begin
If MiddleTPAEx(ATPA[I], X, Y) Then
begin
Writeln('Clicking on the Talisman');
MMouse(X, Y, 5, 5);
ClickMouse2(True);
Wait(500+random(250));
end;
//Next procedure here.. is done then it goes back to the for loop and looks for points on the same ITEM!


See my post on the 3rd page of NAUM's tutorial.. The image explains it better. I'm really bad at explaining but I try.

Okay, I'll go check it out, thanks for your help.
I'm just saying when I use this procedure it doesn't click or even hover onto the air talisman. The color is correct it works fine with banking.

Brandon
01-14-2012, 05:33 AM
Okay, I'll go check it out, thanks for your help.
I'm just saying when I use this procedure it doesn't click or even hover onto the air talisman. The color is correct it works fine with banking.

If this doesn't find your talisman, then the colour is wrong OR your tolerance is too low.

EDIT!!! This finds the fire talisman and clicks it perfectly well.. so just change the colour:


{$I SRL/SRL.Simba}
{$I SRL/SRL/Misc/Debug.Simba}

Procedure Craft;
var
TPA: TPointArray;
ATPA: T2DPointArray;
X, Y, I: Integer;
begin
if not loggedin then exit;
FindNormalRandoms;

if FindColorsTolerance(TPA, 1120371, MIX1, MIY1, MIX2, MIY2, 3) then //FireTalisman Colour..
if Length(TPA) = 0 then
exit
else
ATPA := TPAToATPAEx(TPA, 18, 28);

if Length(ATPA) = 0 then
exit;

For I := 0 To High(ATPA) Do
Begin
MiddleTPAEx(ATPA[I], X, Y);
Writeln('Clicking on the Talisman');
MMouse(X, Y, 5, 5);
wait(500);
if (isUptextMultiCustom(['talisman', 'isman'])) then //change this..
ClickMouse2(True);
Wait(500+random(250));
end;

//Do next procedure here..
end;

begin
SetupSRL;
Craft;
end.

Deadly Serious
01-14-2012, 05:36 AM
If this doesn't find your talisman, then the colour is wrong OR your tolerance is too low.

{$I SRL/SRL/Misc/Debug.Simba}

Procedure Craft;
begin
if not loggedin then exit;
FindNormalRandoms;
Antiban;
DidRedClick;


begin
if FindColorsTolerance(TPA, 12500679, MIX1, MIY1, MIX2, MIY2, 3) then // Thanks to Naums' Tutorial
if Length(TPA) = 0 then
exit
else
ATPA := TPAToATPAEx(TPA, 18, 28);

if Length(ATPA) = 0 then
exit;

For I := 0 To High(ATPA) Do
Begin
DebugTPA(ATPA[I], '');
MiddleTPAEx(ATPA[I], X, Y);
Writeln('Clicking on the Talisman');
MMouse(X, Y, 5, 5);
if (isUptextMultiCustom(['talisman', 'isman'])) then //change this..
ClickMouse2(True);
Wait(500+random(250));
end;

//Do next procedure here..
end;


I'll implement in the uptext and see if it makes the difference. It definitely is the right color and tolerance, I copied it straight from my banking procedure which is working fine.