I have been looking through Chat.scar for quite a while (it is 2am so i might just be missing something due to tiredness) but i cannot seem to find any function that will surch the chat box for one specific word. It seems they all load a line of text into a variable, and then check to see if your text is the same.
Just to explain what im trying to do, i want to make a function that will check to see if any flagged words have been said.
pretty much i create a TStringArray variable like so:
FlaggedText := [Players[CurrentPlayer].Name, 'bot', 'b0t', 'macro', 'report'];
and then have my function do something like this:
SCAR Code:function CheckChat : Boolean;
var
i, j, H : Integer;
text : TStringArray;
begin
Writeln('checking chat');
for i := 8 downto 1 do
Text := ChatBoxTextArray(clChat);
begin
H := High(FlaggedText);
for j := 0 to H do
begin
if Lowercase(Text[i]) = Lowercase(FlaggedText[j]) then
begin
PlaySound('Sound.wav');
Writeln('Flagged text has been found');
Wait(10000);
Exit;
end;
end;
end;
end;
The problem im having is say with these flaged words ['Name', 'bot', 'b0t', 'macro', 'report'], if some one wrote something in the chat like: "Hey there Name, talk right now or I will report you" The function wouldnt find it.
so yeah, now that ive spent all that time explaining my problem, how would I check the chat box for just one word among all the others? in other words how do i write a function that will return true because the word "report" was found in the sentence "i will report you" :P



Reply With Quote













