SRL Archive - Help and Support

AutoColoring Help


The Claw

2007-05-25 02:03:24

Im looking for a way to autocolor certain colours on the minimap with tolerance. What I mean is, I need to search for a colour using tolerance, then find the exact colour and write it to a variable. This way I can use it in my radial walking :)

What would be the best way to go about this?

Help appreciated

Bobarkinator

2007-05-25 04:26:10

You can use TaraJunky's ways, they are in autocolor.scar, just change the generic color to your color.

YoHoJo

2007-05-25 04:49:58

Try make a very small bitmap and use that.
If FindBitmap(Bitmap) Then
MinimapCOlor:=GetColor(x,y)

Or you could also try making a DTM, which i could help you with if you wanted =).

The Claw

2007-05-25 05:50:09

ok, thanks. The problem with using a bitmap or dtm though is because im trying to get the colour of something where its all the same, by that I mean (well look at the pic, hard to explain):


Im trying to get the colour of the things circled, as well as the colour of the yellow part of the bank symbol. I'll give bitmaps a shot though, thx

XcanadamanX

2007-05-25 07:57:38

i have an findakbuildingcolor proc. it doesnt work so good but sometimes it works(it just needs to be updated)

function FindAkBuildingColor: Integer;
var
GenericColor, a, b, TestColor, Red, Green, Blue : integer;
begin
GenericColor := 6193293;
Flag;
a := MMX1;
b := MMY1;
repeat
b := b + 1;
repeat;
a := a + 1;
if FindColorTolerance(x, y, GenericColor, a, b, MMX2, MMY2, 50) then
begin
if a = MMX1 + 1 then b := y;
a := x;
TestColor := GetColor(x, y);
red := (TestColor mod 256);
green := ((TestColor / 256) mod 256);
blue := ((TestColor / 256) / 256);
//writeln(inttostr(testcolor))
//Writeln(inttostr(red - green)+' '+ inttostr(red - blue)+' '+inttostr(green - blue))
if Red - Green >= 0 then if Red - Green <= 14 then
if Red - Blue >= 42 then if Red - Blue <= 50 then
if Green - Blue >= 30 then if Green - Blue <= 50 then
begin
if GetColor(a + 2, b + 2) = TestColor then
if GetColor(a + 1, b + 1) = TestColor then
if GetColor(a, b + 2) = TestColor then
if GetColor(a + 2, b) = TestColor then
if GetColor(a, b + 1) = TestColor then
if GetColor(a + 1, b) = TestColor then
if GetColor(a + 1, b + 2) = TestColor then
if GetColor(a + 2, b + 1) = TestColor then
begin
Result := TestColor;
AkBuildingColor := TestColor;
WriteLn('AkBuildingColor = ' +
IntToStr(TestColor));
Exit;
end;
end;
end else a := MMX2;
until a >= MMX2;
a := MMX1;
until b >= MMY2;
WriteLn('Could not find AKBuildingColor!');
Result := 0;
end;
u need akbuildingcolor as a global var.

shaunthasheep

2007-05-25 10:29:07

Color := AutoColorThis(TheBitmap, Tol, MMX1, MMY1, MMX2, MMY2);

get a 3x3 bitmap of the bank floor and desert on mm… then set the tol dont make it too high and they shouldn't interfere with eachother

then just do something like
if FindSymbol(x, y, 'bank') then GetColor(x, y);

pretty simple :)

nielsie95

2007-05-25 10:53:15

For symbols use GetSymbolColor.
If you would like to know more about AutoColor look at my tut (sig). :)

The Claw

2007-05-25 21:01:50

cheers for all the help, got it working perfect :)