PDA

View Full Version : ACA - AutoColorAid by Nielsie95



nielsie95
07-02-2007, 07:37 PM
ACA a.k.a. AutoColorAid

by Nielsie95


This is a snippet which helps you to autocolor something. You enter as much colors as you can get and the script will create an autocolor procedure using RGB, HSL or XYZ.
The script itself will decide which is the best to use :)
It also sets the best ColorToleranceSpeed and Tolerance.
I also integrated the snippet from Boreas which helps you to get the best color from a bitmap :).



http://img521.imageshack.us/img521/5680/akaev3.png


Please comment, suggest and test. :)


Credits to RkRoxPunk for helping me with the name :D
Credits to Wizzup for the ColorToleranceSpeed compare. :)
Credits to Sumilion for the updated AutoColor Function :)
Credits to Tarajunky for getting the best color + tol from the array! :)
Credits to Boreas for the Color from Bitmap :)

older version downloads: 155.

Nielsie95

rkroxpunk
07-02-2007, 07:40 PM
niel's wheels colour shmuller :D

anywayz...yay first post...worked great for me on the grey MM rocks with 10 colours. well done

Pentti
07-02-2007, 07:43 PM
Cant check it out now, but I may test it later.
But it looks just great!

tarajunky
07-02-2007, 08:13 PM
It looks like it automatically picked the first number in the series as the generic search color. It would be better if you found the median number and used that, since it should reduce the tolerance needed.

crossback7
07-02-2007, 08:14 PM
Works well. . .I'm using it for my Chicken Obliterator script. . .Until I can figure out how to do it myself or something :p

Smartzkid
07-02-2007, 08:32 PM
Looks real cool; gonna try it out

Hugolord
07-02-2007, 08:44 PM
this looks cool needed this thanks!

nielsie95
07-02-2007, 09:16 PM
Thanks for the great comments :)

Tara:

Maybe you could help me with that one? I've tried getting the best color, but the Results in Tolerance are staying the same. I think it doesn't matter which color is first, or I'm doing something wrong here.

I tried it like this:


ColorToleranceSpeed(Cts);
SetArrayLength(ColCount, Length(Colors));
for i := 0 to Length(Colors) -1 do
for c := 0 to Length(Colors) -1 do
if c <> i then
ColCount[i] := ColCount[i] + SimC(Colors[i], Colors[c]);

c := 0;
for i := 0 to Length(Colors) -1 do
if Min(ColCount[c], ColCount[i]) <> ColCount[c] then c := i;

WriteLn('Best Color: '+IntToStr(Colors[c]));


In the example above I got 1190948 as best color.
But I'm getting the same results with Tolerance..

tarajunky
07-03-2007, 02:38 AM
ColorToleranceSpeed(Cts);
SetArrayLength(ColCount, Length(Colors));
for i := 0 to Length(Colors) -1 do
for c := 0 to Length(Colors) -1 do
if SimC(Colors[i], Colors[c]) > ColCount[i] then
ColCount[i] := SimC(Colors[i], Colors[c]);

c := 0;
for i := 0 to Length(Colors) -1 do
if Min(ColCount[c], ColCount[i]) <> ColCount[c] then c := i;

WriteLn('Best Color: '+IntToStr(Colors[c]));


That should work. The way you had it before you added up the total tolerance difference between all the numbers, which is the same for every number in the series. (Like an extreme number might be 5, 10, 90 while a middle number might be 30,35,40, they add up to the same amount but one is much worse than the other) You only want to know the maximum tolerance for each color to each other color. Then you pick the color with the lowest value.

BobboHobbo
07-03-2007, 11:34 AM
Nice, i needed this thnx.

Mjordan
07-03-2007, 12:33 PM
Wow very nice nielsie. It amazes me how you just came to these forums and started owning everyone :p

BTW you remind me of Boreas, he always codes unique things like this.

Santa_Clause
07-03-2007, 01:24 PM
He reminds me of Fawki. Can you believe Nielsie actually asked someone how to do something?!!

Janilabo
07-03-2007, 02:37 PM
BTW you remind me of Boreas, he always codes unique things like this.Haha, same here.. He also reminds me of Ron/SKy Scripter/The_Rs_Monkey.. :p

That's a nice 'utility' you have there, Nielsie - definitely useful one! Thanks.

By the way Nielsie, can you hear people yelling... "Make form! Make form! Make form!"? I can.. :D

Ruroken
07-03-2007, 03:10 PM
oh thats cool.

Nice work :)

bullzeye95
07-03-2007, 11:59 PM
Nice work! Just tested it. Perfect! Although I think the CountColor > 50 should be reduced to around 10 or so... and some people want to search in the main screen, not the minimap. So maybe you could make an option for that?

Form pl0cks?
:p

Wanted
07-04-2007, 12:10 AM
Although I think the CountColor > 50 should be reduced to around 10 or so... and some people want to search in the main screen, not the minimap. So maybe you could make an option for that?


It's easier to just edit the code after you paste it...

bullzeye95
07-04-2007, 12:25 AM
Yeah, I know. But I didn't realize that it was searching the minimap for about ten minutes. I was getting pretty mad :p

SKy Scripter
07-04-2007, 05:22 AM
nice BTW ;)

Lol Should Have really Made the RGB in order not the color XD


program New;

procedure DeleteColorItem(var ColorData : TIntegerArray; Index : Integer);
var
i : integer;
begin
if (InRange(Index, 0, GetArrayLength(ColorData)-1)) then
begin
for i := index to GetArrayLength(ColorData)-2 do
ColorData[i] := ColorData[i + 1];
SetArrayLength(ColorData, GetArrayLength(ColorData)-1);
end;
end;

procedure DeleteColorValue(var ColorData : TIntegerArray; Value : Integer);
var
i, Length : integer;
begin
Length := GetArrayLength(ColorData);
for i := 0 to Length-1 do
begin
if (ColorData[i] = Value) then
begin
DeleteColorItem(ColorData, i);
Exit;
end;
end;
end;



function OrganizeColors(DataColor : TIntegerArray) : TIntegerArray;
var
i : integer;
begin
for i := 0 to GetArrayLength(DataColor)-1 do
begin
SetArrayLength(Result, GetArrayLength(Result)+1);
Result[GetArrayLength(Result)-1] := AMax(DataColor);
DeleteColorValue(DataColor, Result[GetArrayLength(Result)-1]);
end;
end;
// Finds The Middle 1, 2, 3*, 4, 5
function AMid(Data: TIntegerArray) : Integer;
var
n : TIntegerArray;
begin
n := OrganizeColors(Data);
Result := n[GetArrayLength(n)-1];
end;

function AMin(Data : TIntegerArray) : Integer;
var
Min, i : integer;
begin
if (GetArrayLength(Data) = 0) then Exit;
Min := Data[0];
for i := 0 to GetArrayLength(Data)-1 do
if (Data[i] < Min) then
Min := Data[i];
Result := Min;
end;



var
T : TIntegerArray;
Min, Mid, Max : Integer;
R, G, B : array [1..3] of Integer;
begin

SetArrayLength(T, 5);

T[0] := 10; // Colors
T[1] := 20;
T[2] := 30;
T[3] := 40;
T[4] := 50;

Min := AMin(T);
Mid := AMid(T);
Max := AMax(T);

ColortoRGB(Min, R[1], G[1], B[1]);
ColortoRGB(Mid, R[2], G[2], B[2]);
ColortoRGB(Max, R[3], G[3], B[3]);

writeln('Min Color : R:' + Inttostr(R[1]) + ' B:' + Inttostr(B[1]) + ' G:' + Inttostr(G[1]));
writeln('Mid Color : R:' + Inttostr(R[2]) + ' B:' + Inttostr(B[2]) + ' G:' + Inttostr(G[2]));
writeln('Max Color : R:' + Inttostr(R[3]) + ' B:' + Inttostr(B[3]) + ' G:' + Inttostr(G[3]));


// Writeln('Middle Color = ' + IntToStr(GetMiddle(T)));


end.

Infantry001
07-05-2007, 01:49 PM
Awesome tool, Nielsie! Ill be sure to use it :D Ill let you know how it works out.

nielsie95
07-05-2007, 02:25 PM
Thanks, updated it a bit to use the best color out the array (thanks Tara :))!
Next: Forms! :p

Sumilion
07-05-2007, 03:13 PM
I took the liberty of changing your function a little ... you see, lets say there are 50 pixels with the to be autocolored color .. then it will check all those 50pixels while they are the same color ... so i added a little unique color function to it, see if you want to add it or not. (ps. i havent tested it, but i know the unique color thing works ...)

WriteLn(' ');
WriteLn('function AutoColorIt: Integer;');
WriteLn('var');
WriteLn(' '+RangeNames[0]+', '+RangeNames[1]+', '+RangeNames[2]+': '+RangeNames[4]+';');
WriteLn(' Points: TPointArray;');
WriteLn(' Colors, UniqueColors: TIntegerArray;');
WriteLn(' i, a: Integer;');
WriteLn(' NewColor: Boolean;');
WriteLn('begin');
WriteLn(' if not LoggedIn then Exit;');
WriteLn(' ColorToleranceSpeed('+IntTostr(CTS)+');');
WriteLn(' FindColorsSpiralTolerance(MMCX, MMCY, Points, '+IntToStr(BColor)+', MMX1, MMY1, MMX2, MMY2, '+IntToStr(Tol[CTS][1] + 2)+');');
WriteLn(' if Length(Points) < 1 then Exit;');
WriteLn(' Colors := GetColors(Points);');
WriteLn(' ');
WriteLn(' for i := 0 to Length(Colors) -1 do');
WriteLn(' begin');
WriteLn(' NewColor := True;');
WriteLn(' for a := 0 to GetArrayLength(UniqueColors) - 1 do');
WriteLn(' begin');
WriteLn(' if(UniqueColors[a] = Colors[i])then');
WriteLn(' NewColor := False;');
WriteLn(' end;');
WriteLn(' if(NewColor)then');
WriteLn(' begin');
WriteLn(' SetArrayLength(UniqueColors, GetArrayLength(UniqueColors) + 1);');
WriteLn(' UniqueColors[GetArrayLength(UniqueColors) - 1] := Colors[i];');
WriteLn(' end;');
WriteLn(' end;');
WriteLn(' for i := 0 to Length(UniqueColors) -1 do');
WriteLn(' if UniqueColors[i] <> 0 then ');
WriteLn(' begin');
WriteLn(' '+RangeNames[3]+'(UniqueColors[i], '+RangeNames[0]+', '+RangeNames[1]+', '+RangeNames[2]+');');
WriteLn(' if ('+RangeNames[0]+ ' < ' + FloatToStr(Round(Ranges[0][1]) + 2) + ') and ('+RangeNames[0]+ ' > ' + FloatToStr(Round(Ranges[0][0]) - 2) + ') then ');
WriteLn(' if ('+RangeNames[1]+ ' < ' + FloatToStr(Round(Ranges[1][1]) + 2) + ') and ('+RangeNames[1]+ ' > ' + FloatToStr(Round(Ranges[1][0]) - 2) + ') then ');
WriteLn(' if ('+RangeNames[2]+ ' < ' + FloatToStr(Round(Ranges[2][1]) + 2) + ') and ('+RangeNames[2]+ ' > ' + FloatToStr(Round(Ranges[2][0]) - 2) + ') then ');
WriteLn(' if CountColor(UniqueColors[i], MMX1, MMY1, MMX2, MMY2) > 50 then ');
WriteLn(' begin');
WriteLn(' WriteLn(''AutColor: ''+IntTostr(UniqueColors[i]))');
WriteLn(' Result := UniqueColors[i];');
WriteLn(' Break;');
WriteLn(' end;');
WriteLn(' end; ');
WriteLn(' ');
WriteLn(' ColorToleranceSpeed(1);');
WriteLn('end;');

tarajunky
07-05-2007, 04:23 PM
It would also be helpful to know what the maximum tolerance is for the best color.

So after the Best Color line you should add this...



Writeln('Max Tol = '+IntToStr(ColCount[c]));


Then if you want to use that color as a point in a DTM or something, you just use that color and that tolerance + 5 or 10 and it should find the color pretty much every time. The more points you have in the array, the more accurate your color range should be, and the less you need to add to the tolerance. So, if you only have 5 data points you might want to add 15. If you have 60 data points maybe only add 3 or 5.

nielsie95
07-05-2007, 05:06 PM
Thanks! :)

Updated it a little again. Now uses the updated AutoColorTemplate from Sumilion! :)

@Tara: It already showed the max tolerance, I made it a bit more clear now ;)

Sumilion
07-05-2007, 05:10 PM
No problem :)

Too bad ACA didnt do the trick for me ... my color is too complicated :)

nielsie95
07-05-2007, 05:19 PM
It's more supposed to give you hints on colors, tolerance, tolerancespeed etc..
The AutoColorFunction is a nice addition, but is too global too really autocolor :)

btw: Mind telling me what those colors are? :p

Sumilion
07-05-2007, 05:24 PM
The color of the copper rocks on the minimap :p

Hugolord
07-05-2007, 05:46 PM
The color of the copper rocks on the minimap :p

alright so i tried brute force auto coloring a few days ago and i noticed it does not work on most colors as in some worlds alright its fine color is almost the same but some worlds the colors is COMPLETELY different although it might still be possible what if you made it auto color differently depending on the world your at?

nielsie95
07-05-2007, 06:15 PM
Too bad ACA didnt do the trick for me ... my color is too complicated :)

Just wanted to try it out myself :p
Works for me :). If you haven't got an autocolor procedure yourself already, you might want to change the last bit to use HSL (max luminance).. Fully based on the AutoColor procedure from ACA. :)


function AutoColorIt: Integer;
var
R, G, B: Integer;
Points: TPointArray;
Colors, UniqueColors: TIntegerArray;
i, a: Integer;
NewColor: Boolean;
begin
if not LoggedIn then Exit;
ColorToleranceSpeed(0);
FindColorsSpiralTolerance(MMCX, MMCY, Points, 3232641, MMX1, MMY1, MMX2, MMY2, 36);
if Length(Points) < 1 then Exit;
Colors := GetColors(Points);

for i := 0 to Length(Colors) -1 do
begin
NewColor := True;
for a := 0 to GetArrayLength(UniqueColors) - 1 do
begin
if(UniqueColors[a] = Colors[i])then
begin
NewColor := False;
Break;
end;
end;
if(NewColor)then
begin
SetArrayLength(UniqueColors, GetArrayLength(UniqueColors) + 1);
UniqueColors[GetArrayLength(UniqueColors) - 1] := Colors[i];
end;
end;
SetArrayLength(Colors, 0);
for i := 0 to Length(UniqueColors) -1 do
if UniqueColors[i] <> 0 then
begin
ColorToRGB(UniqueColors[i], R, G, B);
if (R < 158) and (R > 107) then
if (G < 103) and (G > 61) then
if (B < 82) and (B > 27) then
if CountColor(UniqueColors[i], MMX1, MMY1, MMX2, MMY2) > 50 then
begin
SetArrayLength(Colors, Length(Colors) +1);
Colors[Length(Colors) -1] := UniqueColors[i];
end;
end;

a := 0;
if Length(Colors) < 1 then Exit;
for i := 0 to GetArrayLength(Colors) -1 do
if Max(a, Colors[i]) <> a then a := Colors[i];
//WriteLn('['+IntToStr(i)+'] Color: '+IntToStr(Colors[i]));

Result := a;
WriteLn('AutoColor: '+IntToStr(a));
ColorToleranceSpeed(1);
end;


Colors I used:


procedure SetupColors;
begin
Colors :=
[4940956, 2970508, 4087437, 2904953, 4284815, 2965625, 4088199, 1919856, 3035757,
2441070, 3957144, 4741772, 3232641, 2902133, 5267860, 3295088, 3758479, 2706034,
4218516, 1918317, 4612493, 4677005, 4351370, 4544918, 3690640, 2573945, 2181240]; //Set your colors in here and hit play!
end;

~alex~
07-05-2007, 06:27 PM
Omg, stop coming out with so much ownage stuff! You make the rest of us look bad :P

Sumilion
07-05-2007, 07:05 PM
Just wanted to try it out myself :p
Works for me :). If you haven't got an autocolor procedure yourself already, you might want to change the last bit to use HSL (max luminance).. Fully based on the AutoColor procedure from ACA. :)


function AutoColorIt: Integer;
var
R, G, B: Integer;
Points: TPointArray;
Colors, UniqueColors: TIntegerArray;
i, a: Integer;
NewColor: Boolean;
begin
if not LoggedIn then Exit;
ColorToleranceSpeed(0);
FindColorsSpiralTolerance(MMCX, MMCY, Points, 3232641, MMX1, MMY1, MMX2, MMY2, 36);
if Length(Points) < 1 then Exit;
Colors := GetColors(Points);

for i := 0 to Length(Colors) -1 do
begin
NewColor := True;
for a := 0 to GetArrayLength(UniqueColors) - 1 do
begin
if(UniqueColors[a] = Colors[i])then
begin
NewColor := False;
Break;
end;
end;
if(NewColor)then
begin
SetArrayLength(UniqueColors, GetArrayLength(UniqueColors) + 1);
UniqueColors[GetArrayLength(UniqueColors) - 1] := Colors[i];
end;
end;
SetArrayLength(Colors, 0);
for i := 0 to Length(UniqueColors) -1 do
if UniqueColors[i] <> 0 then
begin
ColorToRGB(UniqueColors[i], R, G, B);
if (R < 158) and (R > 107) then
if (G < 103) and (G > 61) then
if (B < 82) and (B > 27) then
if CountColor(UniqueColors[i], MMX1, MMY1, MMX2, MMY2) > 50 then
begin
SetArrayLength(Colors, Length(Colors) +1);
Colors[Length(Colors) -1] := UniqueColors[i];
end;
end;

a := 0;
if Length(Colors) < 1 then Exit;
for i := 0 to GetArrayLength(Colors) -1 do
if Max(a, Colors[i]) <> a then a := Colors[i];
//WriteLn('['+IntToStr(i)+'] Color: '+IntToStr(Colors[i]));

Result := a;
WriteLn('AutoColor: '+IntToStr(a));
ColorToleranceSpeed(1);
end;


Colors I used:


procedure SetupColors;
begin
Colors :=
[4940956, 2970508, 4087437, 2904953, 4284815, 2965625, 4088199, 1919856, 3035757,
2441070, 3957144, 4741772, 3232641, 2902133, 5267860, 3295088, 3758479, 2706034,
4218516, 1918317, 4612493, 4677005, 4351370, 4544918, 3690640, 2573945, 2181240]; //Set your colors in here and hit play!
end;


Thats one sick array of colors :)

I had 10, from the same part of rock, from 10 different applets. Ill test it out and see how great it is :p, if it works well, you'll get a special place in my heart ;)

Lalaji
07-05-2007, 07:09 PM
This is awsome dude. I get this error...

Failed when compiling
Line 36: [Error] (36:13): Unknown type 'TStringArray' in script

What SRL am i supposed to be on?

tarajunky
07-05-2007, 09:03 PM
The color of the copper rocks on the minimap :p

FindStoneColor will find the brown rocks on the minimap. I don't know if you're looking for that or something different, though...

FindRockColor finds the normal gray rocks on the minimap.

Sumilion
07-05-2007, 09:09 PM
There is a FindStoneColor =O since when ? =S

tarajunky
07-06-2007, 03:08 AM
3.8, don't you read the release notes?? :p

Sumilion
07-06-2007, 09:15 AM
3.8, don't you read the release notes?? :p

Was probably during my exams :p

You know what, ill just give you both a special place in my heart :)


[SCAR] ColorToleranceSpeed(0);
FindColorsSpiralTolerance(MMCX, MMCY, Points, 5591896, MMX1, MMY1, MMX2, MMY2, 34);
if Length(Points) < 1 then Exit;


Hmm... now if it wont find it ... CTS will remain 0, bug ?

n3ss3s
07-06-2007, 10:34 AM
Sumilion, are you shuor u wanna say "50 pixels" thats huge!

Sumilion
07-06-2007, 10:36 AM
No its not ... 50 pixels is (almost) a 7x7 square ... that all around the MM isnt much ...

Lalaji
07-06-2007, 11:55 AM
This is awsome dude. I get this error...


What SRL am i supposed to be on?

Oh damm.. it dosent use SRL. I feel so stupid.

So why do i get this error?


Failed when compiling
Line 36: [Error] (36:13): Unknown type 'TStringArray' in script

nielsie95
07-06-2007, 11:58 AM
Do you use Scar Divi?

Janilabo
07-06-2007, 12:08 PM
I am pretty sure he isn't, as I get that error with v2.03.

nielsie95
07-06-2007, 12:22 PM
Ok, you need Divi to run it ;)

Sumilion
07-06-2007, 12:34 PM
Nielsie ... did you got my post ?

http://www.srl-forums.com/forum/showpost.php?p=153312&postcount=35

nielsie95
07-06-2007, 12:42 PM
I got it :), thanks. Adjusted ;)

Btw: Did you test the AutoColorFunction(s)?

Lalaji
07-06-2007, 04:34 PM
YAY it worked on 3.10 !

THANKS MAN!

Sumilion
07-06-2007, 06:07 PM
I got it :), thanks. Adjusted ;)

Btw: Did you test the AutoColorFunction(s)?

As i said, you've gained a special place in my heart :), Tarajunky's procedure is my backup, if yours fails it uses his.

A G E N T
07-07-2007, 02:19 AM
Thanks for this great utility, it works wonders for finding reliable colour/tol combos. :)

www.srl-forums.com
07-07-2007, 07:13 AM
Wohh looks nice.

nielsie95
07-09-2007, 01:53 PM
Updated

Now uses forms. Ability to mark colors, find colors from bitmaps and improved AutoColoring! :)
Divi 3.10 needed!

Janilabo
07-09-2007, 02:34 PM
All I can say is... OMFG, that's very impressive GUI. :eek:

It is a great tool, with awesome functionality!

Nielsie, you rock! :D

mastaraymond
07-09-2007, 03:52 PM
Updated

Now uses forms. Ability to mark colors, find colors from bitmaps and improved AutoColoring! :)
Divi 3.10 needed!

Well I guess you make such awesome scripts because you are dutch, right? If not I will suicide ;)

Garrett
07-19-2007, 08:24 PM
This is a great idea... Thanks, it works perfect.

nielsie95
07-22-2007, 07:55 PM
Thanks, great it worked :)

itSchRis917
07-23-2007, 03:38 AM
Thanks a lot Nielsie95! It helped a lot with finding the water temple :)

A G E N T
07-24-2007, 01:16 AM
Ooh n00b question time:

In the original version (w/o GUI), how do you convert [colour1 colour2 colour3...] to an array?

legendaryhero90
07-24-2007, 02:24 AM
i might actually use this since i stink at picking out actual colors that will work.

Wanted
07-24-2007, 03:56 AM
Very nice, have you looked into to LAB or HSV or anything else,

very good job with the form btw :D

Bobarkinator
07-28-2007, 05:56 AM
Very nice Nielsie. I have just gotten into RGB autocoloring and this is the greatest tool ever.

The Claw
08-01-2007, 11:40 AM
This is the greatest thing ever invented

Zeta
08-06-2007, 03:55 AM
If someone could post instructions or something on how to use this that would be great :) I have no clue what i'm doing.

RAM
08-06-2007, 11:25 PM
I just started messing around with this, and all I can say is.... WOW ....very impressive

Thanks for all the hard work to everyone that contributed to it.

~RAM

Bobarkinator
08-06-2007, 11:37 PM
Nielsie do you want me to post that fix that I did? Or do you want to release it?

nielsie95
08-17-2007, 10:00 AM
Please post :) Sorry for the late response.

Hugolord
08-17-2007, 01:04 PM
Please post :) Sorry for the late response.

File access error
SRL Compiled in 79msec.
Successfully executed

too many colors?

nielsie95
08-17-2007, 01:43 PM
Does it work for you with one color?

Bobarkinator
08-18-2007, 02:02 AM
Ok I had only found one bug with this script and that is that if you were less than one on a color it would round up which you don't always want it to do so I just made it so it extends HSL and XYZ 2 decimal places.

nielsie95
08-19-2007, 09:01 AM
With your updated version it doesn't show HSL and XYZ ranges in the first tab?

Bobarkinator
08-19-2007, 09:38 PM
What do you mean?

Hugolord
08-19-2007, 09:54 PM
Does it work for you with one color?

yes it does

nielsie95
08-20-2007, 09:11 AM
What do you mean?

I'll send you a screenie when you're on msn ;)

Hugo: Guess it was too many colors then =\

Bobarkinator
08-22-2007, 02:53 AM
Ok, I'll try to be on at the same time as you.

n3ss3s
08-22-2007, 01:43 PM
By the way, just noticed, you are pretty uber with forms?

nielsie95
08-22-2007, 02:16 PM
Thank you :)

Bobarkinator
08-25-2007, 03:48 PM
Ah, I fixed the problem Nielsie had with my fix (forgetting to have a second result), so here is the updated version. No 0's now.

n3ss3s
08-26-2007, 11:55 AM
OOps I mixed 50 pixels and 50x50 pixels :p

EDIT: Bob, why do I think your scripters cup is pretty new?

Bobarkinator
08-26-2007, 08:25 PM
Because it is :p

Fizzi
09-04-2007, 06:10 PM
ACA keeps crashing for me when I press the Start! button when trying to find Color from BMP. I have 10 BMPs in the list, all of which are about 15x30 with very few 0 pixels (They are anvil BMPs, of the whole anvil).

When I press start! I get a new popup every half a second or so that say Access violation 0052BA4E in scar.exe or something along those lines. In order to stop the popups I have to go to my task manager and close scar. Am I using too many bitmaps? Am I supposed to use smaller bitmaps?

Boreas
09-05-2007, 06:47 AM
Try smaller bitmaps, all cropped to the same area of the anvil. If that doesn't work try less bitmaps until it does. That is assuming the errors are coming from SCAR doing too much, IDK where they are coming from for sure, but it is a hard working function.

nielsie95
09-05-2007, 08:10 AM
Or you could try Boreas' base-script.. I took the most of his script, but adjusted some thingies that I maybe shouldn't have done..

Sir R. M8gic1an
09-13-2007, 06:12 PM
looks amazing :) i'll post how well it worked for me when i come around to having to use autocolor :p

The Claw
10-02-2007, 02:34 AM
Line 952: [Error] (952:48): Unknown identifier 'MMX1' in script E:\!SCAR\ACA3.scar

When using SCAR 3.12. Works with 3.11 though

Santa_Clause
10-02-2007, 03:42 AM
Line 952: [Error] (952:48): Unknown identifier 'MMX1' in script E:\!SCAR\ACA3.scar

When using SCAR 3.12. Works with 3.11 though

Freddy removed the global constants from SCAR 3.12...don't know why.

There's no more MMX1, MMX2 and such...

The Claw
10-02-2007, 05:26 AM
I know, lol. He removed them so that if runescape updates their screen, he wont have to hard-code the co-ords back into scar again. Instead, the devs can update srl and everyone will have it fixed much quicker, through the svn.

nielsie95
01-13-2008, 10:12 PM
Major bump, but there are still people who may find a use in this (saw some posts lately about autocoloring). footballjds sent me a compiling version which I updated the first post with :)

footballjds
01-13-2008, 10:37 PM
you weren't s'posed to mention my name :rolleyes:

MylesMadness
01-14-2008, 12:55 AM
Cool. I've been wanting to use this but I couldn't get the darn thing to compile

footballjds
01-14-2008, 02:17 AM
heh myles =p. actouly mylse is the one who brought it up...
he said, "I wish i could use the auto colorer"..
i asked what was wrong and fixored.. really it was quite simple..
a few unknowns because of srl updates. and duplicate ID's..

Negaal
01-14-2008, 07:34 AM
Awesome tool, Nielsie! Ill be sure to use it :D Ill let you know how it works out.

:)

I have always wanted to use them - RGB, HSL or XYZ - since i don't know nothing about them...then your tool is pretty useful there :)

Thx

papenco
01-14-2008, 06:54 PM
I didnĀ“t understand hatta use it lol.

ZephyrsFury
01-15-2008, 11:31 AM
Maybe instead of using a colour in the array for the best colour you could get the averages of all the values of the colour components and get the mean value. Then convert it back to a colour using those mean component value. Something like this:


function GenericColour: Integer;
var
TR, TG, TB, AR, AG, AB, R, G, B: Integer;
begin
for i := 0 to High(Colours) do
begin
ColorToRGB(Colours[i], R, G, B);
TR := TR + R; TG := TG + G; TB := TB + B; //Sum of all comps
end;
AR := TR / Length(Colours);
AG := TG / Length(Colours); //Average values
AB := TB / Length(Colours);
Result := RGBToColor(AR, AG, AB); //Tada!
end;


except instead of using RGB you could HSL or XYZ based on your best comparison.

EDIT: Another suggestion would be the option to save the array so it can be used again later. ;)