SRL Archive - Help and Support

Need A FindColor Function


pwnaz0r

2007-02-18 17:16:52

Hey guys, well I need a color updating procedure for the center in Pest control.
Ill post a Screen Shot of it. I tryed to use one made by tarajnky and modify it but it didn't work. Then I tryed Sumillions autocolor this but it worked once then would work again.


Double click it to view larger thnx

~~~ Pwnaz0r

XcanadamanX

2007-02-18 17:44:46

this is what i would do log in log out log in pick color change world repeat. for like 10 times. then use this:
program CompareColors;
{.include SRL/SRL.scar}

///////////////////////////////////////////////////////////////
// Set NumCount to the total number of colors (Array Length) //
// then put all color values into SetColors and hit Run //
///////////////////////////////////////////////////////////////


const NumCount=11;

var ColorArray: array of integer;

procedure SetColors;
begin
SetArrayLength(ColorArray,NumCount);
ColorArray[0]:=3421241;
ColorArray[1]:=3618620;
ColorArray[2]:=3881791;
ColorArray[3]:=4079170;
ColorArray[4]:=4276549;
ColorArray[5]:=4473928
ColorArray[6]:=4671308
ColorArray[7]:=4737359
ColorArray[8]:=4934481
ColorArray[9]:=5066068
ColorArray[10]:=5263446
end;

procedure CompareColors;
var Count1,Count2,Color1,Color2,TolRiser:integer;
begin
for Count1:= 0 to NumCount-1 do
begin
Color1:=ColorArray[Count1];
TolRiser:=0;
for Count2:= 0 to NumCount-1 do
begin
Color2:=ColorArray[Count2];
repeat
if SimilarColors(Color1,Color2,TolRiser) then break;
TolRiser:=TolRiser+1;
until TolRiser>=200;
end;
Writeln(IntToStr(Color1)+' - '+IntToStr(TolRiser));
end;
end;

begin
SetupSRL;
Setcolors;
CompareColors;
end.

and use that as a generic color for one of tara's autocolors.

pwnaz0r

2007-02-18 17:55:11

Umm ok I dnt think that will work because as I was going through the functions I found out something

if Red - Green >= 2 then if Red - Green <= 15 then
if Red - Blue >= 20 then if Red - Blue <= 30 then
if Green - Blue >= 10 then if Green - Blue <= 26 then
^^ thats different everytime

Ill still try it tho

XcanadamanX

2007-02-18 17:57:23

i think there is an auto dirt road color somewhere in srl i would use that but change the color.

edit: ya there is one. FindDirtRoadColor; just change the generic color. im pretty sure that'll work.

pwnaz0r

2007-02-18 18:10:06

Ok Ill try it
that may work

EDIT : ya it still doesnt work

XcanadamanX

2007-02-18 19:08:50

did you change the generic color?

Boreas

2007-02-18 20:15:35

I'll have an uber leet autocoloring thing after Divi comes out. While you are waiting, Load a world, login and out, login again, color pick it, repeat on a new world. Get a whole bunch of colors, and you will be able to make your own customized autocolor for it.

pwnaz0r

2007-02-18 20:31:38

:p ok I hope Divi comes out soon

Boreas

2007-02-18 20:44:17

BTW save the color samples in an excel spreadsheet (or openoffic.org spreadsheet).

pwnaz0r

2007-02-18 23:03:44

Hopefully tarajunky will make this then.

WhiteShadow

2007-02-18 23:30:10

if you let me borrow your account it'll be easy for me to whip something up for you.

EDIT:

Here are my ideas.

I'm going to auto get the water color. Then use FindColorSpiral and Spiral out from a specific point (top right middleish ?) and then use xoff yoff and from that water coord. Notice that that land is exactly the same color. So you will do xoff yoof maybe 20 - 50 times? Then compare the colors with for to do or something and if 10 colors are the same that's the color. :]

Another idea, use FindColorsSpiralTolerance(); It returns a TPointArray use it to collect a long list of colors. Obviously I'll be cutting down the array a bit because it's proba bly going to be long, again if colors are the same like 30 times then it's the color.


An easier idea. Get the black dot color from the minimap trees. FindColorSpiral from center and then use the tree coord to do xoff yoff, alot of times. Compare array for same colors. (for to do + Samevalue (); );

Maybe you could try them yourself. :]]

pwnaz0r

2007-02-19 14:47:36

Yeah those all sound pretty good yet a bit complicated.. Still I want this to be totally reliable so even if they change the layout of the minigame, all you will have to do is find the generic color. Yet I will try these all.