SRL Archive - OSR Help

learning tpa


beats-

2011-03-30 09:58:46

so im going to learn color and use it in tpas.

Problem is..
Every tutorial ive done so far ended up failing..
After realizing they are from 2008 etc.
And things were outdated =\

Anyone know a current tut?

something 2010+ mybe lol

footballjds

2011-03-30 10:38:45

what are you trying to do?
(:
I'd be happy to help. Also any thread by n3ss3s about TPA's would be good.

http://villavu.com/forum/showthread.php?t=21786

beats-

2011-03-30 11:03:22

Trying to click a giant rat.

I just need a working example.
Even a tree clicking one.



Just none of them seem to work. =\

footballjds

2011-03-30 11:05:26

I will make you one. Can you give me 10 mins? im at work lol.

beats-

2011-03-30 11:08:14

2am.
I'm sure i'll survive for 10 more minutes.
Thankyou!
I appreciate it.

footballjds

2011-03-30 11:18:55

program New;
{.include SRL\SRL.scar}

function AutoColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
R, G, B: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.03, 0.39);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 5608325, MSX1, MSY1, MSX2, MSY2, 13);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
ColorToRGB(arC[i], R, G, B);

if (R >= 93) and (R <= 167) and (G >= 101) and (G <= 183) and (B >= 64) and (B <= 115) then
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 10.30) and (X <= 35.51) and (Y >= 12.24) and (Y <= 42.80) and (Z >= 6.80) and (Z <= 22.32) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;

function FindTreeColors: TPointArray;
var
x, y: integer;
begin
FindColorsSpiralTolerance(x, y, result, AutoColor, MSX1, MSY1, MSX2, MSY2, 3);
Writeln(Length(result));
for x := 0 to high(result) do
begin
MoveMouse(result[x].x, result[x].y);
wait(1000);
end;
end;

begin
SetupSRL;
FindTreeColors;
end.
Stand by a tree.
Worst way to use TPA's but you didn't ask for the best ;)

beats-

2011-03-30 11:30:51

*High 5's iTry*

Okay cool.
The structure is what i was struggling with.

=D
thx

hhaha
never ending clicks.
took me a while to figure out how to stop it

footballjds

2011-03-30 11:38:49

Function FindIrons: TPointArray;
var
TPAA: array of TPointArray;
TPA: TPointArray;
CTS, I: Integer;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.22, 0.23);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 2964577, 20, 20, MSX2 - 20, MSY2 - 20, 3);
TPAA := TPAToATPAEx(TPA, 20, 19);//Creats a 2D tpa 20 by 19 big
for I := 0 To High(TPAA) do
if GetArrayLength(TPAA[i]) > 7 then
begin
SetArrayLength(Result, GetArrayLength(Result) + 1);
Result[High(Result)] := MiddleTPA(TPAA[i]);
end;
SortTPAFrom(Result, IntToPoint(259, 160));
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(cts);
end;

taken out of my old varrock east miner.
that is legit there, ;)
i don't remember even writing that code o.O

That converts a TPA to an ATPA, Checks to see if there are 7 or more points