SRL Archive - SRL Archives

function IsChatBoxTextArrAnyLine


bugger0001

2009-08-21 14:39:59

function IsChatBoxTextArrAnyLine(CTxtArr: TStringArray; Amount: integer): boolean;
var
A, TxtArrL, Finds: integer;
begin
Finds := 0;
TxtArrL := High(CTxtArr);
for A := 0 to TxtArrL do
begin
if Result then Exit;
if IsChatBoxTextAnyLine(CTxtArr[A], 0) then Inc(Finds);
Result := (Finds >= Amount);
end;
end;

Don't know if it's needed, but I sure needed it for my Smelter's chat check. I guess you can read from the code what it does. But just in case. It will look for each string in the array you set and if it finds the string in chatbox then considers it found. If it finds as many of them as set with Amount then it results True.

ian.

2009-08-21 14:41:10

Made, I think. One sec.

Oohh, Never mind. Forgot the array part. :p

NCDS

2009-08-21 21:16:27


function IsChatBoxTextArrAnyLine(CTxtArr: TStringArray; Amount: integer): boolean;
var
A, Finds: integer;
begin
for A := 0 to High(CTxtArr) do
if IsChatBoxTextAnyLine(CTxtArr[A], 0) then
Inc(Finds);
Result := (Finds >= Amount);
end;

if I'm not mistaken, that would do the same thing, only a bit quicker.

Not a bad idea though :)

bugger0001

2009-08-26 01:00:27

The quickness of it depends on wether we have a big array and are looking for only a few hits or we have an array just a little bigger than the number of good hits we're looking for. Your's would go through the whole array, but mine would stop if it has enough finds ;)