SRL Archive - OSR Help

Running though colours? Please help


Troll

2010-10-16 10:01:39

First off thanks for all the help you guys have been giving me.
So if you would be so kind enouth to help me again heres may problem its about scirpting so im not sure if this is the right area to post?

Any way ive got a list of colours and i want to be able to run though them until one is found, so is there a quicker way then doing this?

If find FindColorSpiralTolerance( a colour) then
Begin
Result := that color
Exit;
End;

So am i doing the right thing or should i do it a diffrent way?

By the way im trying to find a cow

Thanks again for all the help

Rich

2010-10-16 10:06:52

procedure doColourThing;
var
Col : TIntegerArray;
I : Integer;

begin
Col:= [Col1, Col2, etc];
for I:= 0 to High(Col) do
begin
if FindColor(Col[I]) then
begin
WhatToDoWhenColourIsFound;
end else
begin
WhatToDoWhenNoColourIsFound;
end;
end;
end;
Of course you can change FindColor into any colour finding function you want. FindColors functions are for TPAs.

Troll

2010-10-16 10:08:39

Perfect thanks so much rich

Rich

2010-10-16 10:09:10

No problem. If you need any help, let me know. Forgot to say that you'll need SRL included to use that, as I use TIntegerArray.

Naum

2010-10-16 10:34:50

{*******************************************************************************
function FindObjTPAMulti(var X, Y: integer; Color: TIntegerArray; Tol, CTS, ObjWidth, ObjHeight, minCount :Integer; UpText: TStringArray): Boolean;
By: Torrent of Flame based on FindObjTPA
Description: This is a modification of FindObjTPA, which uses a TIntegerArray for the Colors.
Date: 29th August 2009
*******************************************************************************}

Troll

2010-10-16 11:06:20

From: Naum
{*******************************************************************************
function FindObjTPAMulti(var X, Y: integer; Color: TIntegerArray; Tol, CTS, ObjWidth, ObjHeight, minCount :Integer; UpText: TStringArray): Boolean;
By: Torrent of Flame based on FindObjTPA
Description: This is a modification of FindObjTPA, which uses a TIntegerArray for the Colors.
Date: 29th August 2009
*******************************************************************************}


Umm thanks but what is the width height mincount? how do i find them out?

Thanks

NCDS

2010-10-16 11:15:38

"Width" is the approximate width of the object your searching for, same as height.

Mincount represents the minimum amount of occurrences of the color that your searching for.

Troll

2010-10-16 11:20:06

So would it work for cows as they are always moving and each have diffrent colours?

NCDS

2010-10-16 11:23:33

Sure would. Just gather the most unique colors the you can find that the cows have, and use a bit of tolerance and you should be all set.