SRL Archive - OSR Advanced Scripting Tutorials

Custom TPA Finding & ColorToleranceSpeed(2) Modifiers!


Goobs

2008-09-17 08:16:08

I haven't written a tutorial in a while, so here we go.

This stuff is mid level, semi advanced stuff (It's hard to learn the first time, but then it's easy as pie after that.) I will teach you how to make a basic, yet effective TPA function that will do wonders for you~ (No more FindObjCustom =P)

Okay so.. We must start somewhere, no?

Part 1 - Setting Up The TPA and such

Okey, copy this little snippet of script here. It's a very basic setup right now, but WILL be expanded on.



program TPALearningTut;
{.include SRL/SRL.scar}

function TPAFinder(x, y: Integer): Boolean;
begin
end;

begin
end.
We'll use the x and y to return the Mouse's (you got it) x and y coordinates for actual clicking. So far, so good!

Now, we will add our variables.


 
program TPALearningTut;
{.include SRL/SRL.scar}

function TPAFinder(x, y: Integer): Boolean;
var
CTS, I: Integer; //CTS will store the ColorToleranceSpeed before we change it, for later.
TPA: TPointArray; //The TPointArray in which all Coordinates which are found later will be stored
ATPA: Array of TPointArray;
begin
end;

begin
end.

Not lost yet? Good. If you don't know what TPointArrays are, look it up, they're a simple concept, and I don't feel like explaining. Just know that they are VERY important to we the cheaters (and therefore, it must be effective, no?)

Now, here's where we get into the bad parts..



program TPALearningTut;
{.include SRL/SRL.scar}

function TPAFinder(x, y: Integer): Boolean;
var
CTS, I: Integer; //CTS will store the ColorToleranceSpeed before we change it, for later.
TPA: TPointArray; //The TPointArray in which all Coordinates which are found later will be stored
ATPA: Array of TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2); //Sets the color tolerance speed to 2 so we can do HSL tolerance stuff
end;

begin
end.

ColorToleranceSpeed? What is that?

Well, good question. I'm not 100% on it, I just know that 0 is the fastest, but the least accurate, and 2 is the best, and the most accurate. 1 is the middle ground, but most everyone uses 2 anywho.

Why can't we keep it at 2 all the time, then? Text finding is not compatible with ColorToleranceSpeed(2), because 2 deals with Hue and Saturation modifiers.

Confused? Keep reading, I'll explain in a sec.

First, paste this into a new script in scar, and SAVE IT. You will need it if you continue to use TPA's.



program New;
//By Mastaraymond
//0 = Min
//1 = Max
var
I,II : integer;
RGBColor : Array[1..3] of Integer;
RGB : Array[0..1] of Array[1..3] of Integer;
XYZColor, HSLColor : Array[1..3] of Extended;
HSL,XYZ : Array[0..1] of Array[1..3] of Extended;
Colors : TIntegerArray;
Strings : Array[0..9] of String;
Procedure Init;
begin;
Colors := [];
end;
begin
Init;
For I:= 1 to 3 do
begin;
Writeln('');
RGB[0][i] := 255;
HSL[0][i] := 255; //Max is 240?
XYZ[0][i] := 255; //Max is ...?
end;
Strings[1] := 'R: ';
Strings[0] := ' ';
Strings[2] := 'G: ';
Strings[3] := 'B: ';
Strings[4] := 'H: ';
Strings[5] := 'S: ';
Strings[6] := 'L: ';
Strings[7] := 'X: ';
Strings[8] := 'Y: ';
Strings[9] := 'Z: ';
For I:= 0 to High(Colors) do
begin;
Strings[0] := Strings[0] + Padr('Color: '+inttostr(Colors[i]),16) +' | ';
ColortoRGB(Colors[i],RGBColor[1],RGBColor[2],RGBColor[3]);
ColortoHSL(Colors[i],HSLColor[1],HSLColor[2],HSLColor[3]);
ColortoXYZ(Colors[i],XYZColor[1],XYZColor[2],XYZColor[3]);
For II:= 1 to 3 do
begin;
RGB[0][II] := Min(RGBColor[II],RGB[0][II]);
RGB[1][II] := Max(RGBColor[II],RGB[1][II]);
HSL[0][II] := MinE(HSLColor[II],HSL[0][II]);
HSL[1][II] := MaxE(HSLColor[II],HSL[1][II]);
XYZ[0][II] := MinE(XYZColor[II],XYZ[0][II]);
XYZ[1][II] := MaxE(XYZColor[II],XYZ[1][II]);
end;
For II := 1 to 3 do
Strings[II] := Strings[II] +Padr(IntToStr (RGBColor[II]),16) +' | ';
For II := 4 to 6 do
Strings[II] := Strings[II] +Padr(FloatToStr(HSLColor[II-3]),16) +' | ';
For II := 7 to 9 do
Strings[II] := Strings[II] +Padr(FloatToStr(XYZColor[II-6]),16) +' | ';
end;
For I:= 0 to 9 do
Delete(Strings[i],Length(Strings[i])-2,3);
For I:= 0 to 9 do
begin;
if (I = 1) or (I = 4)or (I = 7) then Writeln('');
Writeln(Strings[i]);
end;
Writeln('');
Writeln('Highest RGB values = R: '+ Padr(FloatToStr(RGB[1][1]),3) + ' | ' +'G: '+ Padr(FloatToStr(RGB[1][2]),3) + ' | ' +'B: '+ Padr(FloatToStr(RGB[1][3]),3) );
Writeln('Lowest RGB values = R: '+ Padr(FloatToStr(RGB[0][1]),3) + ' | ' +'G: '+ Padr(FloatToStr(RGB[0][2]),3) + ' | ' +'B: '+ Padr(FloatToStr(RGB[0][3]),3) );
Writeln('Differ RGB values = R: '+ Padr(IntToStr(RGB[1][1] - RGB[0][1]),3) + ' | G: '+ Padr(inttostr(RGB[1][2] - RGB[0][2]) ,3) + ' | B: '+Padr(inttostr(RGB[1][3] - RGB[0][3]),3));
Writeln('Middle RGB values = R: '+ Padr(IntToStr((RGB[1][1] + RGB[0][1]) div 2),3) + ' | G: '+ Padr(inttostr((RGB[1][2] + RGB[0][2]) div 2),3) + ' | B: '+Padr(inttostr((RGB[1][3] + RGB[0][3]) div 2),3));
Writeln('Middle RGB color = ' + IntToStr(RGBToColor((RGB[1][1] + RGB[0][1]) div 2,(RGB[1][2] + RGB[0][2]) div 2,(RGB[1][3] + RGB[0][3]) div 2)));
Writeln('');
Writeln('Highest HSL values = H: '+ Padr(FloatToStr(HSL[1][1]),16) + ' | ' +'S: '+ Padr(FloatToStr(HSL[1][2]),16) + ' | ' +'L: '+ Padr(FloatToStr(HSL[1][3]),16) );
Writeln('Lowest HSL values = H: '+ Padr(FloatToStr(HSL[0][1]),16) + ' | ' +'S: '+ Padr(FloatToStr(HSL[0][2]),16) + ' | ' +'L: '+ Padr(FloatToStr(HSL[0][3]),16) );
Writeln('Differ HSL values = H: '+ Padr(FloatToStr(HSL[1][1] - HSL[0][1]),16) + ' | S: '+ Padr(FloatToStr(HSL[1][2] - HSL[0][2]) ,16) + ' | L: '+Padr(FloatToStr(HSL[1][3] - HSL[0][3]),16));
Writeln('Middle HSL values = H: '+ FloatToStr((HSL[1][1] + HSL[0][1]) div 2) + ' | S: '+ FloatToStr((HSL[1][2] + HSL[0][2]) div 2) + ' | L: '+FloatToStr((HSL[1][3] + HSL[0][3]) div 2));
Writeln('Middle HSL color = ' + IntToStr(HSLToColor((HSL[1][1] + HSL[0][1]) div 2,(HSL[1][2] + HSL[0][2]) div 2,(HSL[1][3] + HSL[0][3]) div 2)));
Writeln('');
Writeln('Highest XYZ values = X: '+ Padr(FloatToStr(XYZ[1][1]),16) + ' | ' +'Y: '+ Padr(FloatToStr(XYZ[1][2]),16) + ' | ' +'Z: '+ Padr(FloatToStr(XYZ[1][3]),16) );
Writeln('Lowest XYZ values = X: '+ Padr(FloatToStr(XYZ[0][1]),16) + ' | ' +'Y: '+ Padr(FloatToStr(XYZ[0][2]),16) + ' | ' +'Z: '+ Padr(FloatToStr(XYZ[0][3]),16) );
Writeln('Differ XYZ values = X: '+ Padr(FloatToStr(XYZ[1][1] - XYZ[0][1]),16) + ' | Y: '+ Padr(FloatToStr(XYZ[1][2] - XYZ[0][2]) ,16) + ' | Z: '+Padr(FloatToStr(XYZ[1][3] - XYZ[0][3]),16));
Writeln('Middle XYZ values = X: '+ FloatToStr((XYZ[1][1] + XYZ[0][1]) div 2) + ' | Y: '+ FloatToStr((XYZ[1][2] + XYZ[0][2]) div 2) + ' | Z: '+FloatToStr((XYZ[1][3] + XYZ[0][3]) div 2));
Writeln('Middle XYZ color = ' + IntToStr(XYZToColor((XYZ[1][1] + XYZ[0][1]) div 2,(XYZ[1][2] + XYZ[0][2]) div 2,(XYZ[1][3] + XYZ[0][3]) div 2)));
WritelN('');
end.

I'll tell you what you need it for in a minute, so just hang on to your britches, kiddo.

So, we want to find something, right? Well, for that, we need colors. Go ahead, choose some colors from something or another. Be it from a tree, or a Lesser Demon. It doesn't really matter. Just get 3-5 different colors to make this work as well as it can.

Now, in that script I just had to paste in, find where it says Colors := [];

Paste in your 3-5 colors, separated by a comma (,);

Now click run. Like magic, things popped up in our Debug Box! Oh yay~

Find where it says Differ HSL Value. Everything surrounding this is important.

Okay. First, we need to change something in the TPA finding script we're developing. We're going to add a nice little thing we call… *drumroll* SetColorSpeed2Modifers.

YAY!

This sets the Hue and Saturation modifiers used for finding colors with tolerance. You'll see…



program TPALearningTut;
{.include SRL/SRL.scar}

function TPAFinder(x, y: Integer): Boolean;
var
CTS, I: Integer; //CTS will store the ColorToleranceSpeed before we change it, for later.
TPA: TPointArray; //The TPointArray in which all Coordinates which are found later will be stored
ATPA: Array of TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2); //Sets the color tolerance speed to 2 so we can do HSL tolerance stuff
SetColorSpeed2Modifiers(HueMod, SatMod);
end;

begin
end.

It only has those two modifiers, so it's not that bad.

Now comes the math time.

Remember that info in the debug text box? Well, we'll need to do some stuff.

Here's what you need to do.

Divide H by L to get = HueMod
Divide S by L to get = SatMod
L is your Tolerance (rounded up)
Middle HSL color is the color (You'll need this and Tolerance in a sec.)

Remember, all these values are in Differ HSL values, after putting in the colors of whatever you did. At this point, you should almost understand what I'm talking about.

Put in your values for HueMod and SatMod. I will make up some for mine.



program TPALearningTut;
{.include SRL/SRL.scar}

function TPAFinder(x, y: Integer): Boolean;
var
CTS, I: Integer; //CTS will store the ColorToleranceSpeed before we change it, for later.
TPA: TPointArray; //The TPointArray in which all Coordinates which are found later will be stored
ATPA: Array of TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2); //Sets the color tolerance speed to 2 so we can do HSL tolerance stuff
SetColorSpeed2Modifiers(.76, .55);
end;

begin
end.
So far, so good! Now..

We find the color.



program TPALearningTut;
{.include SRL/SRL.scar}

function TPAFinder(x, y: Integer): Boolean;
var
CTS, I: Integer; //CTS will store the ColorToleranceSpeed before we change it, for later.
TPA: TPointArray; //The TPointArray in which all Coordinates which are found later will be stored
ATPA: Array of TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2); //Sets the color tolerance speed to 2 so we can do HSL tolerance stuff
SetColorSpeed2Modifiers(.76, .55);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, YourColorHere, MSX1, MSY1, MSX2, MSY2, Tolerance); //For tolerance, put in your own tolerance. MSCX and MSCY are the starting points in the center of the mainscreen. MSX1, MSY1, etc. are the outside of the Main Screen.
end;

begin
end.
Make sure it's FindColorsSpiralTolerance, and not FindColorSpiralTolerance. If you don't understand this, then .

This will find every coordinate within range of your colors in the Main Screen and then store it in TPoints in an array, hence TPointArray. But, right now, it's pretty dis organized, just a jumble of TPoints all over the place. That's why we group them into separate TPA's in a Array of TPA's. We do this thus:



program TPALearningTut;
{.include SRL/SRL.scar}

function TPAFinder(x, y: Integer): Boolean;
var
CTS, I: Integer; //CTS will store the ColorToleranceSpeed before we change it, for later.
TPA: TPointArray; //The TPointArray in which all Coordinates which are found later will be stored
ATPA: Array of TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2); //Sets the color tolerance speed to 2 so we can do HSL tolerance stuff
SetColorSpeed2Modifiers(.76, .55);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, YourColorHere, MSX1, MSY1, MSX2, MSY2, Tolerance); //For tolerance, put in your own tolerance. MSCX and MSCY are the starting points in the center of the mainscreen. MSX1, MSY1, etc. are the outside of the Main Screen.
ColorToleranceSpeed(CTS); //Make sure you do this after you're done color finding, so text finding will work again.
ATPA := TPAToATPAEx(TPA, 15, 15);
end;

begin
end.
Now, we have an ATPA with all the TPA's in it. Here comes the, hopefully, final part. Ish.

The Final Part ISH!

Okay, so. Now we need to make it see if it's what we're looking for (If it's a lesser or if it' s a torch; it has to know the difference somehow!) Hopefully you picked unique colors from whatever you're finding, but whatever floats your boat!

Okay we'll use a For To Do statement to deal with this.

I tried to explain it as well as I could in the script, please bear with me, it's 11 at night and I'm bushed



program TPALearningTut;
{.include SRL/SRL.scar}

function TPAFinder(x, y: Integer): Boolean;
var
CTS, I: Integer; //CTS will store the ColorToleranceSpeed before we change it, for later.
TPA: TPointArray; //The TPointArray in which all Coordinates which are found later will be stored
ATPA: Array of TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2); //Sets the color tolerance speed to 2 so we can do HSL tolerance stuff
SetColorSpeed2Modifiers(.76, .55);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, YourColorHere, MSX1, MSY1, MSX2, MSY2, Tolerance); //For tolerance, put in your own tolerance. MSCX and MSCY are the starting points in the center of the mainscreen. MSX1, MSY1, etc. are the outside of the Main Screen.
ColorToleranceSpeed(CTS); //Make sure you do this after you're done color finding, so text finding will work again.
ATPA := TPAToATPAEx(TPA, 15, 15);

For I := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], x, y); //Returns the middle coords of the current TPA in the ATPA
MMouse(x, y, 2, 2); //Moves mouse over the object
If(IsUpTextMultiCustom(['your uptext(s) here'])) then
begin
Result := True;
GetMousePox(x, y); //Sets the x and y values for future use (Like clicking)
Break; //Exits the For To Do statement so it doesn't keep moving around looking for the object
end;
end;
end;

begin
end.
Now, it will look around for the object, starting from the middle out (Simply because of FindColorsSpiralTolerance) When it finds it, it will stop looking and hover the mouse right there (or not, depending on what you do next)

Usage

So, you found the object. What now?

Simple!

You can just put in another procedure that will Click on the object then wait, or do antirandoms/antiban. It's all downhill from here. ^.^

Afterword

I learned this from a few different tutorials, one of which I got the color script thing. It's mastaraymond's, not mine. Just for copyright stuff, y'know.

Thanks for reading my tutorial. I probably didn't explain well enough in some places, so please post here with questions if you have them. I just thought I'd share this with you, since it's so useful.

Cheers,

ProphesyOfWolf

Goobs

2008-10-31 23:02:44

Umm. Bump? This has been here for like a month.

noidea

2008-10-31 23:05:58

Wow!!! Thanks for bumping! I didn't even know you posted this. I need help with these, so expect posts back!!!

Holy s#it! That was the best guide I have read on TPA's repped!!!!!!!!!!!!!!!!!!!!!!!! This cleared up ALOT for me.

EvilChicken!

2008-11-21 16:06:44

*bump*

It's a good tutorial, you deserve some more creds for making it.

Rep+ from me.

FreakyMonkey

2008-12-24 02:28:10

Thanks. Never really knew howt his worked

mormonman

2008-12-25 23:22:15

omg!!! i was looking for something just like this!!! thanks freakymonkey for bumping it!… just one question… how can i use this for mapwalking, if its even possible?

noidea

2008-12-25 23:27:50

From: mormonman
omg!!! i was looking for something just like this!!! thanks freakymonkey for bumping it!… just one question… how can i use this for mapwalking, if its even possible?


You could use a TPA for finding a color, then use getcolor(), and radialwalk on it?

Thats how the devs get like FindRoadColor, and FindFallyRoadColor.

mormonman

2008-12-25 23:31:38

i can't really use radial walk because i won't ever know how far away i am from where i am trying to walk to, because i walk to a symbol that is dynamic(it moves)…. just to let you know what i am trying… i am working on my jun mem script and i want to walk to a specific kind of rock after walking to the mining symbol, i tried a ddtm but i failed…

Goobs

2008-12-26 23:22:31

If you don't have the radial walk aid, you'll have some problems with RRW. If you need it, it's here.

Thanks for the reps, guys <3

I put it here for organization, but no one organized it. I was hoping for a Intermediate placement or something, but it's been here for like 3 months. Ahh! =X

But, thanks for the attention guys. I really appreciate it.

Goobs

2009-02-23 22:08:18

Holy Mother Of God Bump! What do I have to do to get this organized?

Nose Smasher

2009-02-26 23:05:53

Very nice… Question though…

ATPA := TPAToATPAEx(TPA, 15, 15);

Why 15 and 15?

and when to use SplitTPA and when to use TPAtoATPA?

nielsie95

2009-02-27 04:29:03

From: nose_smasher
Very nice… Question though…

ATPA := TPAToATPAEx(TPA, 15, 15);

Why 15 and 15?

and when to use SplitTPA and when to use TPAtoATPA?


http://www.villavu.com/forum/showthread.php?t=36016
http://www.villavu.com/forum/showthread.php?t=42428

Nose Smasher

2009-02-27 16:03:37

I know about those tuts, but I mean do I need wizzy's TPADebuggers to figure out which grouping method works better for what ever it is that I'm doin? I guess I'm jus having a lil trouble really understanding how all this works… like, I know how to use it all when I'm scripting, but I jus like really understanding how all this works :p

I guess I'll jus play around with wizzy's debuggers and see what happens… :p

Cazax

2009-02-27 16:04:41

From: nose_smasher
I know about those tuts, but I mean do I need wizzy's TPADebuggers to figure out which grouping method works better for what ever it is that I'm doin? I guess I'm jus having a lil trouble really understanding how all this works… like, I know how to use it all when I'm scripting, but I jus like really understanding how all this works :p

I guess I'll jus play around with wizzy's debuggers and see what happens… :p

You could look at my tutorial :)…(sig)

n3ss3s

2009-02-27 16:22:50

Honey return your HSL modifiers back to 0.2, otherwise the scripts that use that thing copy pasted will fuck up.

Torrent of Flame

2009-02-28 06:16:13

It only has those two modifiers, so it's not that bad.

Now comes the math time.

Remember that info in the debug text box? Well, we'll need to do some stuff.

Here's what you need to do.

Divide H by L to get = HueMod
Divide S by L to get = SatMod
L is your Tolerance (rounded up)
Middle HSL color is the color (You'll need this and Tolerance in a sec.)


Expand this a bit more. Tell people they need to use the Differ HSL bit, because it wasnt very clear and it took me a while to figure out I needed to use the H S and L in the Differ HSL.

Goobs

2009-06-09 07:20:00

Do these tutorials ever get sorted? O.o

Original post date:09-17-2008, 06:16 AM

Coh3n

2009-06-21 01:15:39

I LOVE this TUT. I mean, I knew how do this this stuff before, but this really helped me understand it better. Thanks. :)

Rep+ :)

Goobs

2009-06-22 17:51:34

Oh, sweet! Advanced placement! Thanks for sorting and for reorganizing Tutorial Island!

@Coh3n: Thanks for the feedback! I worked hard on this =X

marpis

2009-06-22 18:04:00


function TPAFinder(x, y: Integer): Boolean;
should be

function TPAFinder(var x, y: Integer): Boolean;

Floor66

2009-06-22 18:55:12

Was just about to post that lol ^^

Goobs

2009-06-23 08:09:33

I know. I did that on purpose so someone who doesn't know how to script would not be able to make it work right <3. Learning purposes only.

Esteban

2009-06-24 01:18:24

More good reading here. Thanks for the post.

BraK

2010-09-15 13:42:31

Man this was hiding at the bottom. Can't even remember how I found it. I needs a good bump. Rep++ Great Read

Goobs

2010-09-15 15:54:29

Haha thanks - I was just looking at this today myself. I need to learn up more on Simba and write more tutorials.

TomTuff

2010-09-19 15:29:44

this tut is awesome, + rep

lilcmp1

2012-02-05 00:08:11

Not sure if anyone looks at this but how many significant figures do you keep on the Satmod's and huemod's? My numbers have like 20 digits :S I just can't seem to get this to work *sigh* I'll keep at it.

poopy2177

2012-02-05 14:26:02

I'm trying so hard to understand these I think I overcomplicate things though ); but I'll keep trying I guess I can't visualize what TPA's are used for like on runescape… Are TPA's like those blue boxes you see around npc's when u use narcles fast fighter?

Drax

2012-02-05 20:31:33

From: poopy2177
I'm trying so hard to understand these I think I overcomplicate things though ); but I'll keep trying I guess I can't visualize what TPA's are used for like on runescape… Are TPA's like those blue boxes you see around npc's when u use narcles fast fighter?


No that's on screen Debugging.

TPAs from my understanding find a colour set with tolerances created from the TPA Tool.

For example this is my findyew function using tpa.

See where is says SetColorSpeed2Modifiers(0.14, 0.043);. The numbers are calculated using the tool. They can only be used for the yews as thats where i picked the colour from.

FindColorsSpiralTolerance(MSCX, MSCY, TPA, 3819340, MSX1, MSY1, MSX2, MSY2,6); Is the colour finding part. As the name says it will search for that colour spiraling out from the middle with a tolerance of 6. This number is found using the tool also.

MMouse(x, y, 0, 0);
If WaitUpTextMulti(['ew', 'yew'], 250) then

This part is pretty straight forward.

GetMousePos(x, y); // Records the x, y position of where it found the colour and uptext.

Break; // Ends the colour searching part.

I use this functions like this.

I
If FindYew(x ,y) then
begin
Mouse(x, y, 0, 0, True);

function FindYew(var x, y: Integer) :Boolean;
var
CTS, I: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
begin
If Not LoggedIn then exit;
Antirandoms;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.14, 0.043);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 3819340, MSX1, MSY1, MSX2, MSY2,6);
aTPA := TPAToATPAEx(TPA, 20, 20);

For I := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 0, 0);
If WaitUpTextMulti(['ew', 'yew'], 250) then
begin
Result := True;
GetMousePos(x, y);
Break;
end;
end;
end;

poopy2177

2012-02-07 13:59:15

Ohhhhhhhhhh gotcha it really is that simple! thanks man +rep

Drax

2012-02-07 19:34:16

From: poopy2177
Ohhhhhhhhhh gotcha it really is that simple! thanks man +rep


No worries Bro XD

injustice

2012-03-31 09:18:03

Brilliant guide, it was the easiest for me to read out of the rest of the TPA threads in this section. I will try to use this in my scripts :)

Rep++

Goobs

2012-04-09 04:36:18

I'm glad I could help, and if you ever have any questions just post here / PM me :)

BuckWild

2012-04-27 17:34:14

Thanks a ton, this has just made a nice place in my new script and I couldn't have done it with out this

Surfer

2012-05-06 23:00:10

Wow man, really helped me understand this stuff! Thanks!!!

Wetish

2012-05-09 18:31:31

From: ProphesyOfWolf


program TPALearningTut;
{.include SRL/SRL.scar}

function TPAFinder(x, y: Integer): Boolean;
var
CTS, I: Integer; //CTS will store the ColorToleranceSpeed before we change it, for later.
TPA: TPointArray; //The TPointArray in which all Coordinates which are found later will be stored
ATPA: Array of TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2); //Sets the color tolerance speed to 2 so we can do HSL tolerance stuff
SetColorSpeed2Modifiers(.76, .55);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, YourColorHere, MSX1, MSY1, MSX2, MSY2, Tolerance); //For tolerance, put in your own tolerance. MSCX and MSCY are the starting points in the center of the mainscreen. MSX1, MSY1, etc. are the outside of the Main Screen.
ColorToleranceSpeed(CTS); //Make sure you do this after you're done color finding, so text finding will work again.
ATPA := TPAToATPAEx(TPA, 15, 15);

For I := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA, x, y); //Returns the middle coords of the current TPA in the ATPA
MMouse(x, y, 2, 2); //Moves mouse over the object
If(IsUpTextMultiCustom(['your uptext(s) here'])) then
begin
Result := True;
GetMousePox(x, y); //Sets the x and y values for future use (Like clicking)
Break; //Exits the For To Do statement so it doesn't keep moving around looking for the object
end;
end;
end;

begin
end.


Shouldnt it be GetMousePox(x, y);

Just a small typo. Amazing tutorial btw :D

Striken

2012-05-11 16:37:55

Fantastic tutorial up to this day. :p

Abu

2012-05-11 16:40:01

From: Siel
Shouldnt it be GetMousePox(x, y);

Just a small typo. Amazing tutorial btw :D


Yeh it's there on purpose for people to spot and fix - looks like it worked!


From: ProphesyOfWolf
I know. I did that on purpose so someone who doesn't know how to script would not be able to make it work right <3. Learning purposes only.

P1nky

2012-05-19 02:40:24

I am trying to add a array to my TPA func, but there are literally about 10-15 colors; It isn't working too good for me… Can someone help me out a bit please?

PM me :).
Cheers!