Log in

View Full Version : TPA Support?



CRASH_OVERRIDE
12-05-2012, 08:34 AM
Hey guys,

I have read a few TPA tutorials. I dont believe i am fully understanding them.

Does anyone have any more TPA tutorials they can link me to? Maybe even some examples?

So far i have read:
http://villavu.com/forum/showthread.php?t=90767
http://villavu.com/forum/showthread.php?t=92301

Are their more practices that can be done to learn TPAs? Using the first tutorial, it finds the TPA i chose fine and rightclicked it fine, however it wouldnt work when declaring simba with simba enabled.

If you have some advice i would really appreiate it. I really would love to learn TPAs just notn 100% sure where to begin or learn from:/

P1ng
12-05-2012, 09:22 AM
I don't quite understand what you mean by "it wouldnt work when declaring simba with simba enabled"

Could you please post the TPA function you wrote that worked for you? It's pretty much just trial and error once you have the basics

CRASH_OVERRIDE
12-08-2012, 06:32 AM
Ping, can you use and edit this example of how to do a procedure on right-clicking and selecting mine coal?

I tried using the above tutorials. It doesn't seem to work. what am i doing wrong?

If finds the Coal and right-clicks it when i have SMART Disabled, However when smart is enabled it sometimes right clicks the combat box or it does not click anything.

P1ng
12-08-2012, 07:43 AM
You didn't post the example, so I am not sure where it may be going wrong? Please post the code and I'll check it out for you

CRASH_OVERRIDE
12-08-2012, 09:07 AM
You didn't post the example, so I am not sure where it may be going wrong? Please post the code and I'll check it out for you

Forgot to post im sorry mate.

here:
program TPATest;
{$DEFINE SMART}
{$I SRL/SRL.Simba}
{$I SPS/sps.Simba}
{$IFDEF SIMBAMAJOR980}
{$I SRL/SRL/Misc/PaintSmart.Simba}
{$ELSE}
{$I SRL/SRL/Misc/SmartGraphics.Simba}
{$ENDIF}

Const
Version = '1.0';

SRLStats_Username = 'Anonymous'; //Your SRL Stats Username.
SRLStats_Password = 'anon1337'; //Your SRL Stats Password.

Procedure DeclarePlayers;
Begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

With Players[0] Do
Begin
Name := 'name';
Pass := 'pass';
BoxRewards := ['amp'];
LampSkill := SKILL_MINING;
Active := True;
End;
End;

Procedure MineCoal;
var
tmpCTS, i, l, r, counter:integer;
ImpTPA:TPointArray;
begin
tmpCTS := GetToleranceSpeed;

SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.00, 0.53);

FindColorsTolerance(ImpTPA, 1579544, MSX1, MSY1, MSX2, MSY2, 5);

SetColorToleranceSpeed(tmpCTS);
SetToleranceSpeed2Modifiers(0.02, 0.02);

L := High(ImpTPA)
marktime(counter);
for i := 0 to L do
begin
r := random(L);
wait(randomrange(60, 200));
mmouse(ImpTPA[r].x, ImpTPA[r].y, 2, 2);
if waituptext('oal', 300) then
Break;
if timefrommark(counter) > 3000 then
begin
writeln('We failed to find the Coal!');
Terminatescript;
end;
end;
writeln('We found the Coal!');
clickmouse2(mouse_right);
end;

{Main Loop}
Begin
ClearDebug;
{$IFDEF SMART}
{$IFDEF SIMBAMAJOR980}
Smart_Server := 108;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;
{$ELSE}
SRL_SixHourFix := True;
Smart_FixSpeed := True;
{$ENDIF}
{$ENDIF}

SetUpSRL;
DeclarePlayers;
ActivateClient;

If (Not LoggedIn) Then
LoginPlayer;

Repeat
MineCoal;
Until(InvFull);
Logout;
end.

King
12-08-2012, 02:47 PM
Edited the script you posted, should work now and has a failsafe, I commented in where I added thngs :P Post if it works or not!:spot:


program TPATest;
{$DEFINE SMART}
{$I SRL/SRL.Simba}
{$I SPS/sps.Simba}
{$IFDEF SIMBAMAJOR980}
{$I SRL/SRL/Misc/PaintSmart.Simba}
{$ELSE}
{$I SRL/SRL/Misc/SmartGraphics.Simba}
{$ENDIF}

Const
Version = '1.0';

SRLStats_Username = 'Anonymous'; //Your SRL Stats Username.
SRLStats_Password = 'anon1337'; //Your SRL Stats Password.

Procedure DeclarePlayers;
Begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

With Players[0] Do
Begin
Name := 'name';
Pass := 'pass';
BoxRewards := ['amp'];
LampSkill := SKILL_MINING;
Active := True;
End;
End;

var
t, CoalCount: Integer; // define our variables, t and CoalCount as integers

Procedure MineCoal;
var
tmpCTS, i, l, r, counter:integer;
CoalTPA:TPointArray;
begin
tmpCTS := GetToleranceSpeed;

SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.00, 0.53);

//FindColorsTolerance(Coal, 1579544, MSX1, MSY1, MSX2, MSY2, 5);

SetColorToleranceSpeed(tmpCTS);
SetToleranceSpeed2Modifiers(0.02, 0.02);

L := High(CoalTPA)
marktime(counter);
for i := 0 to L do
begin
r := random(L);
wait(randomrange(60, 200));
mmouse(CoalTPA[r].x, CoalTPA[r].y, 2, 2);
if waituptext('oal', 300) then
Break;
if timefrommark(counter) > 3000 then
begin
writeln('We failed to find the Coal!');
Terminatescript; // You could add a repeating failsafe or maybe make i
end; // try again here
end;
writeln('We found the Coal!');
clickmouse2(mouse_right);
ChooseOption('oal'); // This could be added here to make it select the
begin
MarkTime(t); //mark our time
CoalCount := InvCount; //we define coalcount as the inventory before we mine
repeat
wait(50);
until((TimeFromMark(T)>=3000) or (CoalCount = (+1))); // waits until the coal is found or the time from the mark is past or equal to 3 seconds
end;
end;
//You should make it wait here until the coal is mined
// option for the coal. Im not understanding the
// The TPA should find the coal just as well with smart
// on or off.
{Main Loop}
Begin
ClearDebug;
{$IFDEF SMART}
{$IFDEF SIMBAMAJOR980}
Smart_Server := 108;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;
{$ELSE}
SRL_SixHourFix := True;
Smart_FixSpeed := True;
{$ENDIF}
{$ENDIF}

SetUpSRL;
DeclarePlayers;
ActivateClient;

If (Not LoggedIn) Then
LoginPlayer;
Repeat
MineCoal;
Until(InvFull or (TimeFromMark(t)>700000));// add this to keep it from running forever just randomly put it at 70 seconds
Logout;
end.

CRASH_OVERRIDE
12-09-2012, 01:57 AM
So, why dont you use:
//FindColorsTolerance(Coal, 1579544, MSX1, MSY1, MSX2, MSY2, 5);

Is this going to click the closest rock now that you removed the above?


Also its just doing this in the debug box:
We found the Coal!
We found the Coal!
We found the Coal!
We found the Coal!
We found the Coal!
We found the Coal!
We found the Coal!
We found the Coal!
We found the Coal!

And not actually moving the mouse nor clicking anything. With SMART enabled.

Thanks for the help btw mate.

King
12-09-2012, 02:04 AM
So, why dont you use:
//FindColorsTolerance(Coal, 1579544, MSX1, MSY1, MSX2, MSY2, 5);

Is this going to click the closest rock now that you removed the above?


Also its just doing this in the debug box:
We found the Coal!
We found the Coal!
We found the Coal!
We found the Coal!
We found the Coal!
We found the Coal!
We found the Coal!
We found the Coal!
We found the Coal!

And not actually moving the mouse nor clicking anything. With SMART enabled.

Thanks for the help btw mate.

Didnt meant to edit that out:duh:, use it :P

CRASH_OVERRIDE
12-12-2012, 09:07 AM
I could have been wrong being new to TPA but when i went thrpough it it didn't make sense blanking that out lol.

Sorry about the late response. A few of my game servers were hacked and i have been spending a lot of time fixing them and other issues.

Anyways i am back and even if i use the above with using the above re-commenting the FindColorsTolerance it still seems to be failing.

Is the formula 100% correct? could it just be an error when i used ACA2? Or is their actually something wrong with the formula? If its a color issue no worries ill try it again, Ill try a different color and tolerance and hue and saturation anyways in the meantime.

J J
12-12-2012, 09:33 AM
Try this:

Procedure MineCoal;
var
i, l, r, counter:integer;
CoalTPA:TPointArray;

begin
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.00, 0.53);

if FindColorsTolerance(CoalTPA, 1579544, MSX1, MSY1, MSX2, MSY2, 5) then
begin
L := High(CoalTPA)
Marktime(counter);
for i := 0 to L do
begin
if timefrommark(counter) > 3000 then
begin
writeln('We failed to find the Coal!');
break;
end;

r := random(L);
mmouse(CoalTPA[r].x, CoalTPA[r].y, 2, 2);
if waituptext('oal', 300) then
begin
writeln('found coal');
ClickMouse2(1); // Clicks it
break;
end;

end;
end;
end;

CRASH_OVERRIDE
12-12-2012, 10:01 AM
Sweet got it working.


Oooh, thanks J J:/

Yeah now i just need to improve it. So is this the best way formula for this process?