Results 1 to 4 of 4

Thread: Implementing an auto talk (antireport) feature

  1. #1
    Join Date
    May 2007
    Location
    Everywhere
    Posts
    1,428
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default Implementing an auto talk (antireport) feature

    My last step in my script is to make an anti-report. I'm making a teleporter, but the problem is there is always some dickwad who says "lvl?" to you.

    When you don't respond, you get busted. So clearly I need to develop (or borrow if possible) an auto-talker.

    I remember seeing one, just I don't know how to read text from the RS screen. What SRL code would help you do this? I know how to make responses, and I know how to work a procedure into my script.

    Also, what's the best code for sending text in SMART that is not bannable?
    Lastly, you know ReadLn(SendKeys());, well sendkeys is a bad idea (there is a better one, I just forget it at the moment), but ReadLn never worked for me in scar when using "if [key] is down, then...". Anyone experienced this?

    Thanks


    EDIT:
    For an example

    "You don't talk for a few hours..."
    Guy: "whats your magic level?" <-- I could use many keys to figure out this here
    Me: "99!" (or random response)
    Guy: "Really"
    Me: "What?"
    *goes quiet*

    I just need to identify the text and have a script react to it.

  2. #2
    Join Date
    Jul 2008
    Location
    Canada
    Posts
    1,612
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    WAT, I thought it was type send....hmm lol i forgot

  3. #3
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    SCAR Code:
    {*******************************************************************************
    function GetChatBoxText(Line, TextCol: Integer): string;
    By: ZephyrsFury
    Description: Gets text on the line Line with colour TextCol. (Line 1 is the top,
      Line 8 is the bottom line).
    Colours:
      clMessage/clBlack - Black text messages ("Oh Dear you are dead", etc).
      clChat/clBlue     - Chat messages from you and other players.
      clTrade/clPurple  - Colour of trade request text.
      clFriend          - Colour of friend and clan chat.
      Works with other colours too.
    *******************************************************************************}
    Would be to find the text.

    SCAR Code:
    {*******************************************************************************
    procedure TypeSend(Text: string);
    By: N1ke!
    Description: Sends human like text.
    *******************************************************************************}
    that would be to reply.

    and you can use a case statement to identify
    Ex:
    SCAR Code:
    procedure Responder;
    var Text: String;
    begin
      Text := GetChatBoxText(8, clBlue);
       
      case Text of
        'TextYourLookingFor' : TypeSend('YourResponse');
      end;
    end;

    Just a small little example but that shows generally how you would do it.

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

    Default

    SCAR Code:
    InChat('text')

    Here's an example of an autoresponder I made a long time ago. It has a bunch of extra stuff, but it's got finding and sending text.

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

    const
      StartPersonality = 'angry';

    var
      Respond1, I: array of string;
      Personality: string;
      N: Integer;

    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 Responding;
    begin
      SetupSrl;
      DeclarePlayers;
      Personality := StartPersonality;
      if not FindBlackChatMessage(Players[currentplayer].name) and InChatMulti(['lvl', 'level', 'lv', 'lev', 'leve', 'hi', 'hello', 'sup', 'yo']) then
      begin
        I := ['oodcutting', 'oodcut', 'ishing', 'ish', 'ine', 'ining', 'hi', 'hello', 'sup', 'yo'];
        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) - 1 of
                        0..2: TypeSend(Respond1[Random(GetArrayLength(Respond1))]);
                        3: TypeSend('GH' + IntToStr(Random(5)));
                      end;
                    end;
                  False: WriteLn('Didn''t find anything');
                end;
              end;
          end;
      end;
    end;

    begin
      Responding;
    end.

    ~Sandstorm

Thread Information

Users Browsing this Thread

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

Tags for this Thread

Posting Permissions

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