Results 1 to 5 of 5

Thread: ChatChecker function, need help xP

  1. #1
    Join Date
    Dec 2006
    Location
    Canada, BC
    Posts
    728
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Exclamation ChatChecker function, need help xP

    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
    Lance. Da. Pants.

  2. #2
    Join Date
    Feb 2009
    Posts
    1,447
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    SCAR Code:
    if FindText(x, y, Text[i], SmallChars, MCX1, MCY1, MCX2, MCY2) then

    or

    SCAR Code:
    for T := 0 to High(Text) do
    begin
      for I := 1 to 8 do
      begin
        if (Pos(Text[i], Lowercase(GetChatBoxText(I, clBlue))) > 0) then
        begin
          //Content
        end;  
      end;
    end;

  3. #3
    Join Date
    Dec 2006
    Location
    Canada, BC
    Posts
    728
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    thankyou very much, that was very helpful :]
    Lance. Da. Pants.

  4. #4
    Join Date
    Apr 2007
    Location
    Perth, Australia
    Posts
    3,926
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    ...or use FindChatBoxText.

  5. #5
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by ZephyrsFury View Post
    ...or use FindChatBoxText.
    Check my sig for the tutorial

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •