SRL Archive - Outdated Tutorials

The Simple TPA Power! - FindObjTPA


Sir R. M8gic1an

2008-03-30 15:36:31

oh so you've heard about TPAs but they sounded too complicated? Got some hope when i said it was simple? Well it is!

You don't need to know much about TPAs to use their power because there is an obscure function in srl called FindObjTPA.

function FindObjTPA(var x, y: integer; color, tol, cts, ObjWidth, ObjHeight, minCount :Integer; UpText: tstringarray): Boolean;


Did that scare you away? i hope not!
i supposed i do not need to explain this part.. "ar x, y: integer; color, tol," it's simple enough. tol stands for tolerance if your not sure.

now comes the part that you might not fully understand.
cts stands for ColorToleranceSpeed. In simple terms it will search for a color in a different way; if you want to know more about cts make sure to check out n3ss3s TPA tut in the advanced section.
otherwise we'll use -1 as cts, because the function will automatically set it for you if you use -1.

"ObjWidth, ObjHeight, minCount" - MinCount is the minimum number of TPoints in a rectangle of ObjWidth and ObjHeight for it to be considered as what you're looking for.

so if we have
ObjWidth = 10
ObjHeight = 10
MinCount = 50

it means that in a square of 10*10 the color you chose has to be in at least 50 pixels for it to be considered as the object. (tol is being used, it does count for this)

Remember that after finding that square it'll move the mouse over it and check for uptext.

"UpText: tstringarray" might be a little complicated. all it means is that you can look for as much text that you want but it has to be in this form:

['UpText1', 'UpText2', 'UpText3', 'UpText4', 'UpText5']

and that's all about using the TPA power without knowing much about them! definitely faster than FindObjCustom!


So how do i use this?

FindObjCustom(x, y, ['Willow'], [2772296, 124356, 000000], 11);

//change to ...

if FindObjTPA(x, y, 2772296, 11, -1, 7, 7, 15, ['Willow']) then

// simple fast and easy!

i hope you enjoyed the tut and will now use the TPA power more often!

Feel free to post any questions, rate this thread or rep me. I'll make sure i answer the questions as best as i can.

RM Advice:
–There are many functions in the srl files that are not commonly known about but are extremely useful. Before starting every script make sure you check the srl folders for functions that you might use, especially if it's skill related. Also skim through the SRL folders at every new revision to find new functions that might suit your needs.

~RM

Torrent of Flame

2008-03-30 16:02:17

Well, I think I might understand them more now, but how do you put them into a script?

Sir R. M8gic1an

2008-03-30 16:09:45

if you intent to use this method all you have to do is replace FindObjCustom By FindObjTPA ;)

if you intend to do the whole TPA function yourself your better of reading ray's or n3ss3s' tut, or asking them, cus i don't have anything close to their knowledge of TPAs or the skill to explain it :p

~RM

EvilChicken!

2008-03-30 16:10:41

YOU WIN.

From: Rasta Magician

"ObjWidth, ObjHeight, minCount" - MinCount is the minimum number of TPoints in a rectangle of ObjWidth and ObjHeight for it to be considered as what you're looking for.

so if we have
ObjWidth = 10
ObjHeight = 10
MinCount = 50

it means that in a square of 10*10 the color you chose has to be in at least 50 pixels for it to be considered as the object. (tol is being used, it does count for this).


I actually didn't know this, now I understand. It has to do with TPA splitting, right? So, if I set it to find the color 255 (red) with 0 tol, and have 10 in both objheight and objwidth, and 50 as MinCount, it has to find a minimum of 50 pixels with the color 255 within the 10*10 box?

Again, you win.

drizzt

2008-03-30 16:12:09

for this function, all you need to do is use it like findobjcustom, just findobjTPA instead, and idk how you would learn more about TPA's from this tut, this tut is pretty much a shortcut around learning them

EDIT: Rasta beat me to it :(

EDIT: evilchicken, that way i think, i think, meaning i'm not sure, but i think findobjtpa uses TPAtoATPAex, not SplitTPAex, which (again i think) will spread out infinitely as long as there is a color in that box, whereas TPAtoATPAex has a set box

Torrent of Flame

2008-03-30 16:14:37

So I'm right in saying that this would be better then FindObjCustom:

procedure ChopTree;
var CuttingTime: integer;
Tries: integer;
begin
MarkTime(CuttingTime);
MakeCompass('S');
EntFinder;
FindEnt(x, y, True);
repeat
if FindObjTPA(x, y, 3760987, 20, -1, 10, 10, 20, ['Willow']) then
begin
case (Random(4)) of
0: begin
Mouse(x, y, 4, 4, false);
Wait(5000+random(2500));
ChooseOption('hop')
end;
1: begin
Wait(5000+ random(2500));
Mouse(x, y, 4, 4, true);
end;
2: begin
Mouse(x, y, 1, 2, true);
end;
3: begin
Mouse(x, y, 4, 5, false);
ChooseOption('hop')
end;
end;
AntiBan;
if (FindDTM(BrokenAxe, x, y, 547, 206, 734, 464)) then
begin
IsAxeBroke;
end;
if (not (FindObjTPA(x, y, 3760987, 20, -1, 10, 10, 20, ['Willow']))) then
Wait(100+random(100));
Tries := Tries + 1;
if(Tries = 50)then
begin
Writeln ('Willow Logs not found. Switching Players..');
Logout;
NextPlayer(True);
end;
end;
until(InvFull) or (TimeFromMark(CuttingTime) > 800000+random(60000));
end;

Instead of using:

procedure ChopTree;
var CuttingTime: integer;
Tries: integer;
begin
MarkTime(CuttingTime);
MakeCompass('S');
EntFinder;
FindEnt(x, y, True);
repeat
if FindObjCustom(x, y, ['Wil', 'low'], [1989969, 3760987, 2844763], 7) then
begin
case (Random(4)) of
0: begin
Mouse(x, y, 4, 4, false);
Wait(5000+random(2500));
ChooseOption('hop')
end;
1: begin
Wait(5000+ random(2500));
Mouse(x, y, 4, 4, true);
end;
2: begin
Mouse(x, y, 1, 2, true);
end;
3: begin
Mouse(x, y, 4, 5, false);
ChooseOption('hop')
end;
end;
AntiBan;
if (FindDTM(BrokenAxe, x, y, 547, 206, 734, 464)) then
begin
IsAxeBroke;
end;
if (not (FindObjCustom(x, y, ['Wil', 'low'], [1989969, 3760987, 2844763], 7))) then
Wait(100+random(100));
Tries := Tries + 1;
if(Tries = 50)then
begin
Writeln ('Willow Logs not found. Switching Players..');
Logout;
NextPlayer(True);
end;
end;
until(InvFull) or (TimeFromMark(CuttingTime) > 800000+random(60000));
end;


?

Sir R. M8gic1an

2008-03-30 16:15:59

From: EvilChicken!
YOU WIN.

I actually didn't know this, now I understand. It has to do with TPA splitting, right? So, if I set it to find the color 255 (red) with 0 tol, and have 10 in both objheight and objwidth, and 50 as MinCount, it has to find a minimum of 50 pixels with the color 255 within the 10*10 box?

Again, you win.


exactly :) (about the color thing)

drizzt is right about the dividing of the TPA, it uses TPAToATPAEx. but it does have to do with the way that it looks for it.

thank you!

@Torrent: yes, it should work better than FindObjCustom. although it can only use one color at a time.

@drizzt: I beat you to this, but you beat me to a cowkiller ;)

~RM

ShowerThoughts

2008-03-30 16:17:32

Tpa Should work better, that is a fact.

Zezi

2008-03-30 16:17:50

So what is better, using findobjcustom or using tpa?

What's faster / easier / less bannable? :S

Please reply :D

drizzt

2008-03-30 16:18:09

@ToF, it should be, but you will need to edit these " 20, -1, 10, 10, 20," for the optimal effect of the TPA

and wonderful tut rasta, even though IMO learning TPA's will be best to find objects the way you want, still, wonderful for beginners

Torrent of Flame

2008-03-30 16:20:19

So, they should be like 7, 7, 18? Or what?

What is good to use?

EvilChicken!

2008-03-30 16:51:38

From: boxcrop
So what is better, using findobjcustom or using tpa?

What's faster / easier / less bannable? :S

Please reply :D


Ofcourse this. It has far more advanced way of detecting colors.

And, RM, rep++ for you. Thanks!

Sir R. M8gic1an

2008-03-31 13:55:29

From: Torrent of Flame
So, they should be like 7, 7, 18? Or what?

What is good to use?


it depends on waht you want to find. for trees i use 7, 7, 15. but for new rocks i'd use something like 4, 4, 7

you have to think about how big it is and how accurate your color is. but remember that something like 20, 20, x wouldn't be too good cus it'd lag quite a bit.

i'd say something between 3 - 15 is the best. and the smaller it is the more minimum points there should be, but remember that minimum points can't ever be > than Width*Height

Thanks evil :)

i'm glad you all appreciated it so much :)

~RM

Torrent of Flame

2008-03-31 14:14:01

Ok, thanks RM :]

Lee Lok Hin

2008-04-01 22:30:21

Oh! I finally get TPAs, A bit, at least…

Rep++ for you, tackling n3ss3ss tutorial now, tried it two times before, still no result instead of a huge headache.

Thanks!

faster789

2008-04-01 23:56:10

nice tut..rep+ but still kinda confused..heard of IMO does any1 know wher i can find tuts on IMO's?

HyperSecret

2008-04-02 00:13:01

From: faster789
nice tut..rep+ but still kinda confused..heard of IMO does any1 know wher i can find tuts on IMO's?


r u serious?

faster789

2008-04-02 15:56:56

From: HyperSecret
r u serious?


lol yup i kno…its sad :( ..so like wat the heck does IMO stand 4 and are there any tuts?

Sir R. M8gic1an

2008-04-03 01:51:59

IMO = in my opinion ;)

thx everyone :)

~RM

PvH

2008-04-03 02:10:35

very nice tut!
rep++ for you
i learned a bit from it:)

weequ

2008-04-03 11:01:50

Great tutorial but does TPA find the middle pixel?

…
... Red pixel is the middle :)
…

Sir R. M8gic1an

2008-04-03 16:36:46

From: antti mies
Great tutorial but does TPA find the middle pixel?


yes it does ;)

~RM

Richard

2008-04-03 16:42:28

Great tut mate. Repped and rated thread 5* ;)

ShowerThoughts

2008-04-03 16:48:18

i don't get the minamount part or something :(

weequ

2008-04-04 10:39:01

Could someone make me 1 that results the nearest object that results true?
(not the one that has best results..)

Sir R. M8gic1an

2008-04-04 17:31:14

From: Hermpie
i don't get the minamount part or something :(



it's simple, i'll try explaining differently. we have hight and width which make a rectangle.

let's imagine we have 10 hight and 25 width.

10*25 = 250 pixels
minimum amount = 100

it means that at least 100/250 pixels have to match the color you chose.


@antti mies: i suggest looking at other tutorials, this one i specifically about this function.

~RM

vikrant60

2008-05-07 19:11:11

I love this!
It fixed my problems with finding the dumb deposit hole lol.

EvilChicken!

2008-05-07 23:29:27

Instead of using -1 CTS, use at least 1. Makes no difference, and I mean that its less "scaring" for the beginners. Tell then to use CTS 2 for added accuracy.

(Search for DebugATPA to see the difference if you want..)

Griff

2008-05-19 16:16:47

great tut, man! I'm still having a few problems with my woodcutting procedure, so if you could help me out that would be great. I'm getting the error Close round expected in script.
procedure FindTreeAndChopTree;
var CuttingTime: integer;
Tries: integer;
begin
MarkTime(CuttingTime);
MakeCompass('N');
repeat
if FindObjTPA(x, y, 2060900, 20, -1, 7, 7, 15, ['Yew']) then
begin
Mouse(x,y,0,0,false);
if(IsUpText('Chop'))then
Wait(5000 + (random(150)));
ChooseOption('Chop')
if (not (FindObjTPA(x, y, 2060900, 20, -1, 7, 7, 15, ['Yew'])) then
Wait(100+random(100));
Tries := Tries + 1;
if(Tries = 10)then
begin
Writeln ('lets try the other trees…');
MakeCompass('W');
RadialWalk(361732,165,220,72,8,8);
end;
end;
until(InvFull) or (TimeFromMark(CuttingTime) > 800000+random(60000));
end;

Griff

2008-05-19 16:32:30

Ok sorry I figured out my last problem. Now I have a question about a TPA in my procedure. I dont quite understand the two numbers after we have the colour in the TPA > >
if FindObjTPA(x, y, 2060900, 20, -1, 7, 7, 15, ['Yew']) then
(i dont understand the ones with arrwos overtop)

Sir R. M8gic1an

2008-05-20 12:46:23

the first one after color is tolerance. so imagine you find black. if you search with a tolerance of 20 maybe instead of only finding black you will also find dark blue, dark brown and dark grey.

CTS stands for ColorToleranceSpeed. the different cts are just different ways to search for a color.

~RM

kor

2008-05-20 13:35:42

this works so freakin fast! it rocks ;) thanks rasta, you own :P

Mark

2008-05-25 12:47:17

Great tut fella simple words better more me :D and alot of others +rep

BobboHobbo

2008-08-02 03:42:39

Thanks for this tut, even though its a little old i <3 you :P