Results 1 to 3 of 3

Thread: InChatMulti and InChat not working?

  1. #1
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default InChatMulti and InChat not working?

    They don't seem to be reading the chat box properly for me, or Camo Kyle. It's rather annoying, considering I can't make my responder without them, and I've got absolutely no clue why they aren't reading the chat box.

    This is what I have, let me know if I'm using it wrong and that's why, but I doubt it :/.

    SCAR Code:
    {.include srl/srl.scar}
    {.include srl/srl/misc/QuickChat.scar}

    const
      StartPersonality = 'angry';

    var
      Respond1, I, P : array of string;
      Personality : string;
      N : Integer;
     
    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      Players[0].Name := '';
      Players[0].Pass := '';
      Players[0].Nick := ''; // 3-4 letters of username
      Players[0].Active := True; // Is the player active?
    end;


    function InChatMulti(text: TStringArray): boolean;
    var
      i: integer;
      s: string;
    begin
      for i := 0 to high(text) do
      begin
        if (not (GetLastChatText(s))) then
          LastChatter(s);
        Result := (Pos(Text[i], s) > 0);
      end;
    end;

    Procedure SetupAutorespond;
    Begin
    Personality := StartPersonality;
    End;

    procedure Responding;
    begin
      If InChat('Off') Then
      TerminateScript;
      if (InChatMulti(['vl', 'evel', 'Hi', 'Hello', 'Sup', 'Yo'])) then
      begin
        WriteLn('Here we go!');
        I := ['oodcutting', 'oodcut', 'ishing', 'ish', 'ine', 'ining', 'hi', 'hello', 'sup', 'yo', 'lol', 'lmao', 'rofl!'];
        for N := 0 to GetArrayLength(I) do
          case InChat(I[N]) of
            True:
              begin
                case I[N] of
                  0, 1:
                    begin
                      case lowercase(Personality) of
                        'laid back': Respond1 := ['Tis ', 'Yo, my wc lvl is ', ''];
                        'polite': Respond1 := ['Thanks for asking', 'It is ', ''];
                        'bored': Respond1 := ['Lolz, it''s ', 'dood! My wc level is ', ''];
                        'angry': Respond1 := ['What''s it matter? If you must know it''s ', 'Bah. ', ''];
                      end;
                      case Random(4) of
                        0..2: TypeSend(Respond1[Random(GetArrayLength(Respond1))] + IntToStr(GetSkillInfo('woodcutting', True)));
                        3: QCSayLevel('woodcutting');
                      end;
                    end;
                  2, 3:
                    begin
                      case lowercase(Personality) of
                        'laid back': Respond1 := ['Tis ', 'Yo, my fishing lvl is ', 'It''s ', ''];
                        'polite': Respond1 := ['Thanks for asking', 'It is ', ''];
                        'bored': Respond1 := ['Lolz, it''s ', 'dood! My fishing level is ', ''];
                        'angry': Respond1 := ['What''s it matter? If you must know it''s ', 'Bah. ', ''];
                      end;
                      case Random(4) of
                        0..2: TypeSend(Respond1[Random(GetArrayLength(Respond1))] + IntToStr(GetSkillInfo('fishing', True)));
                        4: QCSayLevel('woodcutting');
                      end;
                    end;
                  4, 5:
                    begin
                      case lowercase(Personality) of
                        'laid back': Respond1 := ['Tis ', 'Yo, my mining lvl is ', ''];
                        'polite': Respond1 := ['Thanks for asking', 'It is ', ''];
                        'bored': Respond1 := ['Lolz, it''s ', 'dood! My mining level is ', ''];
                        'angry': Respond1 := ['Whats it matter? If you must know its ', 'Bah. ', ''];
                      end;
                      case Random(4) of
                        0..2: TypeSend(Respond1[Random(GetArrayLength(Respond1))] + IntToStr(GetSkillInfo('mining', True)));
                        3: QCSayLevel('woodcutting');
                      end;
                    end;
                  6..9:
                    begin
                      case lowercase(Personality) of
                        'laid back': Respond1 := ['Yo!', 'Sup?', 'Sup man?'];
                        'polite': Respond1 := ['Hello.', 'Good day to you.'];
                        'bored': Respond1 := ['Ohaider!', 'Hi.'];
                        'angry': Respond1 := ['What?', 'Leave me alone!', 'Go away!'];
                      end;
                      case Random(4) of
                        0..2: TypeSend(Respond1[Random(GetArrayLength(Respond1))]);
                        3: TypeSend('GH' + IntToStr(Random(5)));
                      end;
                    end;
                  10..12:
                    begin
                      case lowercase(Personality) of
                        'laid back': Respond1 := ['dood, funneh!', 'hehe', 'l0lz'];
                        'polite': Respond1 := ['That was funny!', 'Please tell another joke', 'Heh'];
                        'bored': Respond1 := ['roflc0pt3rz', 'lool', 'roflzzz', 'lmao!'];
                        'angry': Respond1 := ['What''s so funny, punk?', 'Stop laughing, that was horrible'];
                      end;
                      TypeSend(Respond1[Random(GetArrayLength(Respond1))]);
                    end;
                  False: WriteLn('Didn''t find anything');
                end;
              end;
          end;
      end;
    end;

    Begin
      SetupSrl;
      SetupAutorespond;
      DeclarePlayers;
      ClearDebug;
      Repeat
        Responding;
        Wait(1000);
      Until(IsFkeyDown(9))
    End.

  2. #2
    Join Date
    Nov 2008
    Posts
    27
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    maybe try nava's instead

    its...

    SCAR Code:
    function InChatArr(Text: array of string): Boolean;
    var
      I, H: integer;
      s: string;
    begin
      H := High(Text);
      if (not (GetLastChatText(s))) then
        LastChatter(s);
      for I := 0 to H do
      begin
        if (Pos(Lowercase(Text[i]), (Lowercase(s))) > 0) then
        begin
          Result := true;
          Exit;
        end;
      end;
    end;

  3. #3
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Will do. Thanks. If not, I'll modify the current one.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. InChat
    By I Am Legend in forum OSR Help
    Replies: 8
    Last Post: 08-12-2008, 07:41 AM
  2. Replies: 17
    Last Post: 02-27-2007, 04:55 AM

Posting Permissions

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