SRL Archive - SRL Archives

A couple autocolor functions


Timothegreat

2008-05-19 21:36:24

These are 99.9% guaranteed to work, havent failed yet…

if you like them feel free to rep me or 5 star the thread…

Works on minimap oak trees


function GetTreeColor: integer;
var
GC, a, l, TestColor: integer;
var
P:array of Tpoint;
begin
GC := 1989413;
Flag;
FindColorsSpiralTolerance(MMCX,MMCY, P, GC, MMX1,MMY1,MMX2,MMY2, 75);
l:=GetArrayLength(P);
for a:= 0 to l-1 do
begin
TestColor := GetColor(P[a].x,P[a].y);
if (GetColor(P[a].x-1,P[a].y)=TestColor-202247) then
begin
Result := TestColor;
WriteLn('Tree Color = ' + IntToStr(TestColor));
Exit;
end;
end;
WriteLn('Could not find Tree Color!');
Result := 0;
end;

works on maple trees

function GetMapleColor: integer;
var
GC, a, l, TestColor: integer;
var
P:array of Tpoint;
begin
GC := 606068;
Flag;
FindColorsSpiralTolerance(MMCX,MMCY, P, GC, MMX1,MMY1,MMX2,MMY2, 75);
l:=GetArrayLength(P);
for a:= 0 to l-1 do
begin
TestColor := GetColor(P[a].x,P[a].y);
if (GetColor(P[a].x-1,P[a].y)=TestColor-198418) then
begin
Result := TestColor;
WriteLn('Maple Color = ' + IntToStr(TestColor));
Exit;
end;
end;
WriteLn('Could not find Maple Color!');
Result := 0;
end;

works on any brown rocks

function GetBrownRockColor: integer;
var
GC, a, l, TestColor: integer;
var
P:array of Tpoint;
begin
GC := 3625335;
Flag;
FindColorsSpiralTolerance(MMCX,MMCY, P, GC, MMX1,MMY1,MMX2,MMY2, 75);
l:=GetArrayLength(P);
for a:= 0 to l-1 do
begin
TestColor := GetColor(P[a].x,P[a].y);
if (GetColor(P[a].x-1,P[a].y)=TestColor-1186871) then
begin
Result := TestColor;
WriteLn('Brown Rock Color = ' + IntToStr(TestColor));
Exit;
end;
end;
WriteLn('Could not find Brown Rock Color!');
Result := 0;
end;

works on cactuses

function GetCactusColor: integer;
var
GC, a, l, TestColor: integer;
var
P:array of Tpoint;
begin
GC := 2977359;
Flag;
FindColorsSpiralTolerance(MMCX,MMCY, P, GC, MMX1,MMY1,MMX2,MMY2, 75);
l:=GetArrayLength(P);
for a:= 0 to l-1 do
begin
TestColor := GetColor(P[a].x,P[a].y);
if (GetColor(P[a].x+1,P[a].y)=TestColor-1709323) then
begin
Result := TestColor;
WriteLn('Cactus Color = ' + IntToStr(TestColor));
Exit;
end;
end;
WriteLn('Could not find Cactus Color!');
Result := 0;
end;

works on gray rocks

function GetRockColor: integer;
var
GC, a, l, TestColor: integer;
var
P:array of Tpoint;
begin
GC := 4538428;
Flag;
FindColorsSpiralTolerance(MMCX,MMCY, P, GC, MMX1,MMY1,MMX2,MMY2, 75);
l:=GetArrayLength(P);
for a:= 0 to l-1 do
begin
TestColor := GetColor(P[a].x,P[a].y);
if (GetColor(P[a].x,P[a].y+1)=TestColor-921359) then
begin
Result := TestColor;
WriteLn('Rock Color = ' + IntToStr(TestColor));
Exit;
end;
end;
for a:= 0 to l-1 do
begin
TestColor := GetColor(P[a].x,P[a].y);
if (GetColor(P[a].x,P[a].y-1)=TestColor-921359) then
begin
Result := TestColor;
WriteLn('Rock Color = ' + IntToStr(TestColor));
Exit;
end;
end;
WriteLn('Could not find Rock Color!');
Result := 0;
end;

NiCbaZ

2008-05-20 06:28:15

ahh nice timo, i have a few autocolor functions as well, that people might find handy, never used this was to autocolor before i gotta try it out

Timothegreat

2008-05-20 23:25:12

completely different way to autocolor stuff… not based on rgb or hsl

HyperSecret

2008-05-21 15:39:36

From: Timothegreat
completely different way to autocolor stuff… not based on rgb or hsl


but is already in the autocolor.scar, well this way of autocoloring things with two shades of a color, BridgeColor does that, same with rock colors

Timothegreat

2008-05-21 17:43:23

added a maple tree autocolor…

Nava2

2008-05-28 21:47:12

What are the integers you are subtracting? Like what do they represent?

Nava2

Timothegreat

2008-05-30 14:46:34

the integers im subtracting represent the general difference between the colors that are next to each other.

Nava2

2008-05-31 16:08:25

Hmm, explain? :) I want to apply this method into mine and Cnr's Autocolor Function Writer.. :D

Crediting you of course ;)

Nava2

Timothegreat

2008-05-31 21:10:41

well il try to explain…

on the minimap certain objects have colors within the object that have a certain numerical difference between their values. That difference is always the same, all the time on any world… You can use this difference to autocolor

it would be extremely hard to put into an autocolor function writer… as you would have to find these objects on the mm yourself first.

Cazax

2008-05-31 21:28:25

*The continue of Timo's post*

For example, the oak tree in the minimap has a some black pixels. Those pixels doesnt change their colors. So get any color near the black pixel and then you compare if near the color you got there is a black pixel.

Nava2

2008-05-31 22:41:51

From: Timothegreat
well il try to explain…

on the minimap certain objects have colors within the object that have a certain numerical difference between their values. That difference is always the same, all the time on any world… You can use this difference to autocolor

it would be extremely hard to put into an autocolor function writer… as you would have to find these objects on the mm yourself first.


Wow… How'd you figure that out… xD I still don't fully understand it. Do all of the colors change by a certain amount each time?

Also, agreed; it makes it almost impossible.

Nava2

king vash

2008-05-31 23:15:06

Wizzup has a how thread about this, it's called newautocolor.scar in the main folder, and there are about 20 other symbols and items that do this

Timothegreat

2008-06-03 22:42:22

yea… thats where i got the idea to try and find these on my own.

P1nky

2008-06-05 18:10:41

so if i suggest you to make a AC would you, even tho cnr thought me but sometimes too lazy :P

Timothegreat

2008-06-06 15:39:16

well i can make autocolor's for any object on the minimap with color relationships