Results 1 to 9 of 9

Thread: Auto responder

  1. #1
    Join Date
    Mar 2008
    Location
    Look behind you.
    Posts
    795
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default Auto responder

    I'm trying to create an auto responder for my script, but when i tried using the InChat() function, it never found what the other were saying. How may i make one?

    Ps: Yes, i've tried before. Like five or six times.

  2. #2
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    InChat only check the last line

    perhaps try this?

    SCAR Code:
    {*******************************************************************************
    function IsChatBoxTextAnyLine(Text: string; TextCol: Integer): Boolean;
    By: ZephyrsFury
    Description: Returns true if Text with colour TextCol is found anywhere in the
      chat box.
    *******************************************************************************}

    const
    clMessage = clBlack;
    clChat = clBlue;
    clTrade = clPurple;
    clFriend = 128;

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  3. #3
    Join Date
    Mar 2008
    Location
    Look behind you.
    Posts
    795
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Thanks RM, Never noticed that lol. I even went searching through the includes.

    Edit: AMG! You made a Guild fisher! Must be awesome.

  4. #4
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    My responder beats all you can use it if you like to!
    there are 2 extra functions, posexx and GetChatboxLine that need to be in your script too!

    SCAR Code:
    // Global variables
    var
      RespondedChatLines: TStringArray;
      TalkTimer: integer;


    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
    { function posexx(substrarr: TStringArray; str: string): integer;
    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

    function posexx(substrarr: TStringArray; str: string): integer;
    var
     i: integer;
    begin
     for i:= 0 to High(SUBstrarr) do
     begin
      result:= pos(lowercase(substrarr[i]), lowercase(str));
      if (result > 0) then
       exit;
     end;
    end;


    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
    { function GetChatboxLine(line: integer): string;
    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

    function GetChatboxLine(line: integer): string;
    begin
     result:= GetChatboxText(line, clBlack) + GetChatboxText(line, clChat) + GetChatboxText(line, clTrade) + GetChatboxText(line, clFriend);
    end;


    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
    { function Autotalk(seconds: integer): boolean;
      seconds is the minimun time between responds. Use this if you like it!
      its great! :) remember to include 2 functions above
    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

    function Autotalk(seconds: integer): boolean;
    var
      i, ii: integer;
      MyLevels: array [0..23] of integer;
      ChatLines: array [0..7] of string;
      TSA: TStringArray;
      s: string;
      responded: boolean;
    begin
      if (TimeFromMark(TalkTimer) < seconds*1000) then exit;
      // Read messages in the chatbox
      for i:= 1 to 8 do
       ChatLines[i-1]:= GetChatboxLine(i);
      // Find triggers
      for i:= 7 downto 0 do
      begin
        if (pos(players[currentplayer].nick, Chatlines[i])>12) or (pos(players[currentplayer].nick, Chatlines[i])=0) then
        if not InStrArr(ChatLines[i], RespondedChatLines, false) then
        begin
         {================================== LEVELS ===========================================================}
         if (posexx(['att','att','str','def','rang','magi','healt', 'hp', 'pray'],lowercase(ChatLines[i]))>11) then
         begin
          responded:= true;
          writeln('Answering: Levels');
          GetAllLevels;
          for ii := 0 to 23 do
           Mylevels[ii] := players[currentplayer].Level[ii+1];
          // Attack
          if pos('att', lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['att ', 'attack ', 'attlvl ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[0]);
          end;
          // Strength
          if pos('str', lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['str ', 'strength ', 'strlvl ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[1]);
          end;
          // Defence
          if pos('def', lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['def ', 'defence ', 'deflvl ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[2]);
          end;
          // Ranged
          if pos('rang', lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['rang ', 'ranged ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[3]);
          end;
          // Prayer
          if pos('pray', lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['pray ', 'prayer ', 'praylvl ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[4]);
          end;
          // Magic
          if pos('mag', lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['mag ', 'magic ', 'maglvl ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[5]);
          end;
          // Runecrafting
          if posexx(['runecraft','rc'], ChatLines[i])>11 then
          begin
           TSA:= ['rc ', 'runecrafting ', 'rclvl ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[6]);
          end;
          // HP
          if posexx(['hp', 'healt'], lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['hp ', 'healt ', 'health ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[7]);
          end;
          // Agility
          if posexx(['agi'], lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['agi ', 'agility ', 'agilvl ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[8]);
          end;
          // Herblore
          if posexx(['herb'], lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['herb ', 'herblore ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[9]);
          end;
          // Thieving
          if posexx(['thiev', 'thief'], lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['thieving ', 'thief ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[10]);
          end;
          // Crafting
          if posexx(['craft'], lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['crafting ', 'craft ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[11]);
          end;
          // Fletching
          if posexx(['fletc'], lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['fletch ', 'fletching ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[12]);
          end;
          // Slayer
          if posexx(['slay'], lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['slayer ', 'slaying ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[13]);
          end;
          // Mining
          if posexx(['minin'], lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['mining ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[14]);
          end;
          // Smithing
          if posexx(['smith'], lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['smith ', 'smithing ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[15]);
          end;
          // Fishing
          if posexx(['fish'], lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['fish ', 'fishing ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[16]);
          end;
          // Cooking
          if posexx(['cook'], lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['cooking ', 'cook  ', 'cooklvl']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[17]);
          end;
          // Firemaking
          if posexx(['fm', 'firemak'], lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['fm ', 'firemaking ', 'fmlvl ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[18]);
          end;
          // Woodcutting
          if posexx(['wc', 'woodcut'], lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['wc ', 'woodcut ', 'woodcutting ', 'wclvl ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[19]);
          end;
          // Farming
          if posexx(['farm', 'farmin'], lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['farm ', 'farming ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[19]);
          end;
          // S A Y    T H E     L I N E
          s:= Trim(s);
          writeln(s);
          TypeSend(s);
         end else
         {================================== MAX HIT ====================================================}
         if (posexx(['max hit', 'maxhit'], ChatLines[i])>11) then
         begin
          responded:= true;
          writeln('Answering: Max hit');
          TSA:= ['over 9000!!','more than yours nub','i can 1 hit kalphite queen','too much','you cant even imagine it','insane','not your business','wanna try on arena'];
          Typesend(TSA[random(Length(TSA))]);
         end else
        {================================ BOT ACCUSE ===============================================}
         if (posexx(['bot', 'auto', 'macro'], ChatLines[i])>11) then
         begin
          responded:= true;
          writeln('Answering: Max hit');
          TSA:= ['haha 8P','lololol','couldnt care less actually','ehmm lol','yea right'];
          Typesend(TSA[random(Length(TSA))]);
         end else
        {================================== ABUSE ====================================================}
         if (posexx(['noob', 'nuub', 'nob', 'newb'], ChatLines[i])>11) then
         begin
          responded:= true;
          writeln('Answering: Abuse');
          TSA:= ['phewt','pfft','yea right','could still pwn u'];
          Typesend(TSA[random(Length(TSA))]);
         end else
        {================================= GREETINGS ===================================================}
         if (posexx(['whatup', 'wazzup', 'wazup', 'watap', 'watup', 'what''s up', 'whatsup', 'whats up', 'wasup', 'wassup', 'hi ', 'hello'], ChatLines[i])>11) then
         begin
          responded:= true;
          writeln('Answering: Greetings');
          TSA:= ['hi there','yo yo','wasup','whatap','whats up','hello'];
          Typesend(TSA[random(Length(TSA))]);
         end else
        {================================ COMPLIMENTS ================================================}
         if (posexx(['nice', 'cool', 'kewl', 'great', 'awesome'], ChatLines[i])>11) and (posexx(['weapon', 'shield', 'armor', 'plate', 'pl8', 'cape', 'helm', 'staff', 'sword', 'gear', 'body', 'leg', 'name'], ChatLines[i])>11) then
         begin
          responded:= true;
          writeln('Answering: Compliments');
          TSA:= ['heh thanks','ty','thanks dude','yup','lol','not rly'];
          Typesend(TSA[random(Length(TSA))]);
         end else
        {================================ FRIEND REQUEST ================================================}
         if (posexx(['iends?'], ChatLines[i])>11) then
         begin
          responded:= true;
          writeln('Answering: Friend request');
          TSA:= ['ehmm no ty','thx but no thx','not interested','mm naaah','lol no ty','not rly'];
          Typesend(TSA[random(Length(TSA))]);
         end else
        {================================ JUST NAME ================================================}
         if pos(players[currentplayer].nick, ChatLines[i]) > 11 then
         begin
          responded:= true;
          writeln('Answering: Name mentioned');
          TSA:= ['ya', 'yo', 'hmm'];
          Typesend(TSA[random(Length(TSA))]);
         end;
         // end of triggers
         result:= responded;
         if result then
         begin
          MarkTime(TalkTimer);
          SetLength(RespondedChatLines, Length(RespondedChatLines)+1);
          RespondedChatLines[High(RespondedChatLines)] := ChatLines[i];
          exit;
         end;
        end;
     end;
    end;
    Last edited by marpis; 05-11-2009 at 04:14 AM.

  5. #5
    Join Date
    Mar 2008
    Location
    Look behind you.
    Posts
    795
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Marpis i'm getting a few errors..Such as:

    SCAR Code:
    Line 152: [Error] (18054:31): Unknown identifier 'RespondedChatLines' in script

    What the hell do i do..?
    Last edited by DeSnob; 05-11-2009 at 01:22 AM.

  6. #6
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    oh sorry, i forgot to tell you!
    declare
    var
    RespondedChatLines: TStringArray;
    TalkTimer: Integer;

    as global variables, and it'll work

  7. #7
    Join Date
    Mar 2007
    Location
    <3
    Posts
    2,683
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    marpis, your Auto responder does not win ;P It can be heavily shorten ^^
    and mine wins yours..

  8. #8
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by N1ke! View Post
    marpis, your Auto responder does not win ;P It can be heavily shorten ^^
    and mine wins yours..
    all lies till i have seen your procedure
    yes, it could be shorter, but now it is very easy to modify and adding new triggers and responds is very simple for even a beginner.

  9. #9
    Join Date
    Mar 2008
    Location
    Look behind you.
    Posts
    795
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    when i tried understanding n1ke!'s auto responder, it felt as if i was reading a Japanese encyclopedia.

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
  •