SRL Archive - OSR Help

ACA help


RSrevenge

2013-12-07 06:48:10

I'm trying to use the AutoColor function made by ACA, but it seems that many of the functions and variables used in it are outdated. I already changed a few things, and I still can't get it to work.

So my question is, is there a newer version of ACA or an easy way to update the function from it? If not, what should I use instead?

Don't really care about the FindObject function it makes, and have no idea what FindColorRecord or FindObjRecord are :p, I just want the AutoColor one.

Thanks


Edit: forgot to mention this is for a RS3 script, so it's using srl-6

tealc

2013-12-08 01:58:26

From: RSrevenge
I'm trying to use the AutoColor function made by ACA, but it seems that many of the functions and variables used in it are outdated. I already changed a few things, and I still can't get it to work.

So my question is, is there a newer version of ACA or an easy way to update the function from it? If not, what should I use instead?

Don't really care about the FindObject function it makes, and have no idea what FindColorRecord or FindObjRecord are :p, I just want the AutoColor one.

Thanks


Edit: forgot to mention this is for a RS3 script, so it's using srl-6


newest aca remake by cynic http://villavu.com/forum/showthread.php?t=98368

the old versions should still work, if you still need help try posting the function/script and I can help you modify it

RSrevenge

2013-12-09 14:54:32

Thank you, that's exactly what I was looking for. Still had to modify a few things to get it to compile, but I got it to.

My problem now is that it doesn't find the color. I noticed that if I click "mark color" it doesn't find anything in ACA, but if I click "mark best color" it highlights a bunch of stuff, so how do I make the script find the best color?

I'm just using the basic .findObject() function for now. Mostly trying to get the feel for everything, I'm still a mega noob at this.

Here's the code, all I want it to do is find the tree and click it. I also commented what I changed in the function that ACA created, so if I did anything wrong please let me know :)

{$i srl-6/srl.simba}

var
x, y: integer;

function tree : Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
H, S, L: Extended;
X, Y, Z: Extended;
begin
tmpCTS := GetToleranceSpeed(); //changed from GetColorToleranceSpeed
SetColorToleranceSpeed(3); //changed from ColorToleranceSpeed(3)
SetToleranceSpeed3Modifier(1); //changed from SetColorSpeed3Modifier(1)

//changed the x/y coords to mainscreen.x1/2 and mainscreen.y1/2
FindColorsSpiralTolerance(720, 450, arP, 2636876, mainscreen.x1, mainscreen.y1, mainscreen.x2, mainscreen.y2, 10);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
SetColorToleranceSpeed(tmpCTS); //changed from ColorToleranceSpeed(tmpCTS)
Exit;
end;

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

for i := 0 to arL do
begin
ColorToHSL(arC[i], H, S, L);

if (H >= 8.80) and (H <= 9.64) and (S >= 30.75) and (S <= 31.77) and (L >= 16.06) and (L <= 29.82) then
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 2.57) and (X <= 8.62) and (Y >= 2.58) and (Y <= 8.43) and (Z >= 1.44) and (Z <= 4.44) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
end;

SetColorToleranceSpeed(tmpCTS); //changed from ColorToleranceSpeed(tmpCTS)

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

begin
if (mainscreen.findObject(x, y, tree, 10, ['Tree'])) then
writeln('Clicked object!');
end.

Here's the debug info after running the script
Compiled successfully in 3000 ms.
Failed to find the color, no result.
-- TRSMainscreen.findObject()
---- No colors found
-- TRSMainscreen.findObject(): False
-- Freeing the minimap mask
Successfully executed.

bonsai

2013-12-09 15:47:02

I can't make any sense of what those autogenerated functions are supposed to be doing. Someone else will have to tell us what the intention is. It seems like it's trying to turn the results of a CTS1/2/3 search into a simpler color.

There's no need to use them though. You can take the best color info from ACA and use that as the parameters to findObject.

For example, a CTS 2 best color can be used something like this:

mainscreen.findObject(x, y, BESTCOLOR, TOLERANCE, colorSetting(2, HUE, SAT), mainscreen.getCenterPoint(), WIDTH, HIEGHT, COUNT, [UPTEXT], MOUSE_RIGHT)

koryperson

2013-12-09 16:51:22

From: bonsai
I can't make any sense of what those autogenerated functions are supposed to be doing. Someone else will have to tell us what the intention is. It seems like it's trying to turn the results of a CTS1/2/3 search into a simpler color.

There's no need to use them though. You can take the best color info from ACA and use that as the parameters to findObject.


For example, a CTS 2 best color can be used something like this:

mainscreen.findObject(x, y, BESTCOLOR, TOLERANCE, colorSetting(2, HUE, SAT), mainscreen.getCenterPoint(), WIDTH, HIEGHT, COUNT, [UPTEXT], MOUSE_RIGHT)


I've used it a couple of times as just one big if FindColor then function. You can just edit the line where it says Writeln('clicked object!') to whatever you want to do with what it gives you, so you could(at least with the ACA version before this) find the variable where it stores the coordinates of the found color and change the Writeln to a click.

RSrevenge

2013-12-10 17:02:09

From: bonsai
I can't make any sense of what those autogenerated functions are supposed to be doing. Someone else will have to tell us what the intention is. It seems like it's trying to turn the results of a CTS1/2/3 search into a simpler color.

There's no need to use them though. You can take the best color info from ACA and use that as the parameters to findObject.

For example, a CTS 2 best color can be used something like this:

mainscreen.findObject(x, y, BESTCOLOR, TOLERANCE, colorSetting(2, HUE, SAT), mainscreen.getCenterPoint(), WIDTH, HIEGHT, COUNT, [UPTEXT], MOUSE_RIGHT)


Lol no worries. I'll just have to play around with it until I figure it out. I've been reading tuts like crazy and starting to get a basic understanding of it. I'll definitely try just using findObject with the best color for now.

From: koryperson
I've used it a couple of times as just one big if FindColor then function. You can just edit the line where it says Writeln('clicked object!') to whatever you want to do with what it gives you, so you could(at least with the ACA version before this) find the variable where it stores the coordinates of the found color and change the Writeln to a click.

That's a good idea too. I'll play around with those functions a bit more after I figure out what they're doing :p

I think I really just need to read up on how the color finding stuff works, I found a tut on CTS so that will hopefully help too.