Results 1 to 2 of 2

Thread: Type in?

  1. #1
    Join Date
    Dec 2011
    Posts
    164
    Mentioned
    4 Post(s)
    Quoted
    23 Post(s)

    Default Type in?

    I couldn't find any information on this, but how do you get a script to type something in (I don't mean writeln).

    Also how do you get it to randomly chose what letters to type in? Thanks!

    #Noobscripter

  2. #2
    Join Date
    Nov 2011
    Location
    MA
    Posts
    545
    Mentioned
    3 Post(s)
    Quoted
    10 Post(s)

    Default

    Simba Code:
    (*
    TypeSend
    ~~~~~~~~

    .. code-block:: pascal

        procedure TypeSend(Text : string);

    Types Text in a human-like way and presses enter. Wrapper function for TypeSendEx
    for compatibility purposes.

    .. note::

        by N1ke!

    Example:

    .. code-block::pascal

    *)

    procedure TypeSend(Text: string);
    begin
      TypeSendEx(Text, True);
    end;

    (*
    AddMistakes
    ~~~~~~~~~~~

    .. code-block:: pascal

        function AddMistakes(Orig: string; Chance: Integer): string;

    Adds human mistakes to Orig such as mistypes, missing letters,
    wrong cases. Probability that a character is typed wrong is 1 / Chance. ie.
    Higher 'Chance' = less mistakes (I know thats stupid but oh well...).
    Probability is the chance that an individual character is typed incorrectly.
    That is if you have more characters in a string you will get more mistakes overall.
    20 - 30 is usually good but it varies depending on your string so experiment!

    .. note::
        by Zephyrsfury

    Example

    .. code-block:: pascal

    *)

    function AddMistakes(Orig: string; Chance: Integer): string;
    var
      Line1, Line2, Line: array [0..3] of string;
      i, j, TPos, Prob, Mist, L: Integer;
      Norm, Caps, Excp, TLine, NewKey: string;
    begin
      Result := '';
      Norm := '`1234567890-=qwertyuiop[]\asdfghjkl;''zxcvbnm,./';
      Caps := '~!@#$%^&*()_+QWERTYUIOP{}|ASDFGHJKL:"ZXCVBNM<>?';
      Excp := '`1234567890-=[]\;'',./~!@#$%^&*()_+{}|:"<>?';
      Line1[0] := '`1234567890-= ';     Line2[0] := '~!@#$%^&*()_+ ';
      Line1[1] := ' qwertyuiop[]\';     Line2[1] := ' QWERTYUIOP{}|';
      Line1[2] := ' asdfghjkl;''  ';    Line2[2] := ' ASDFGHJKL:"  ';
      Line1[3] := ' zxcvbnm,./   ';     Line2[3] := ' ZXCVBNM<>?   ';
      L := Length(Orig);
      for i := 1 to L do
      begin
        Prob := Chance;
        Prob := Prob + Mist;     //More mistakes = less chance of another mistake
        if (Pos(Orig[i], Excp) <> 0) then Prob := Prob - 2;  //If char is hard to type (numbers/symbols) - more chance
        if (i = 1) then Prob := Prob + 5; //The first letter - less chance
        if (Orig[i] <> ' ') and (Random(Max(Prob, 0)) = 0) then
        begin
          if (Pos(Orig[i], Norm) <> 0) then
            Line := Line1
          else
          if (Pos(Orig[i], Caps) <> 0) then
            Line := Line2;
          for j := 0 to 3 do
          begin
            TPos := Pos(Orig[i], Line[j]);
            if (TPos <> 0) then
              case Random(19) of
                0..5:                              //Same line
                begin
                  TLine := Line[j];
                  try
                    NewKey := TLine[TPos - 1 + Random(3)];
                  except end;
                  if (NewKey = '') or (NewKey = ' ') then
                    NewKey := TLine[TPos];
                end;
                6..8:                                        //Line above
                begin
                  TLine := Line[Max(j - 1, 0)];
                  try
                    NewKey := Line[j - 1][TPos + Random(2)];
                  except end;
                  if (NewKey = '') or (NewKey = ' ') then
                    NewKey := TLine[TPos];
                end;
                9..11:                                      //Line below
                begin
                  TLine := Line[Min(j + 1, High(Line))];
                  try
                    NewKey := TLine[TPos - 1 + Random(2)];     //Wrong case
                  except end;
                  if (NewKey = '') or (NewKey = ' ') then
                    NewKey := TLine[TPos];
                end;
                12..16:
                begin
                  if (i - 1 >= 1) then
                  begin
                    if (Pos(Orig[i - 1], Caps) <> 0) then
                      NewKey := Line2[j][TPos]
                    else
                    if (Pos(Orig[i - 1], Norm) <> 0) then
                      NewKey := Line1[j][TPos]
                  end else
                  if (i + 1 <= Length(Orig)) then
                  begin
                    if (Pos(Orig[i + 1], Caps) <> 0) then
                      NewKey := Line2[j][TPos]
                    else
                    if (Pos(Orig[i + 1], Norm) <> 0) then
                      NewKey := Line1[j][TPos];
                  end;
                end;
                17, 18: if (i <> 1) then NewKey := '';         //Missing letters
              end;
          end;
        end else
          NewKey := Orig[i];
        if (NewKey <> Orig[i]) then Inc(Mist);
        Result := Result + NewKey;
      end;
    end;

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
  •