Results 1 to 5 of 5

Thread: [All-Purpose] Human-like Typer

  1. #1
    Join Date
    Feb 2006
    Posts
    35
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default [All-Purpose] Human-like Typer

    Code:
    program CanadarulesAutoTalker;
    
    //////////////////////////////////////
    //                                  //
    //  Canadarules Autotalker v1.0     //
    //                                  //
    //  Instructions:                   //
    //  - Setup script.                 //
    //  - Designate RuneScape window.   //
    //  - Run.                          //
    //                                  //
    /////////////////////////////////////////////////////////////////////////
    //                                                                     //
    //  Features:                                                          //
    //  - Finger slippy hurty: Presses the wrong button sometimes.         //
    //    Not random, based upon the QWERTY keyboard. Only accidentally    //
    //    presses on either side of the right key.                         //
    //  - Self-fixing: A setting is present that allows you to control     //
    //    how often the talker corrects its own mistakes.                  //
    //  - Shift-screw up: If the character needs to have SHIFT held down   //
    //    to be used, sometimes the SHIFT button won't be pressed.         //
    //  - Switchy thingy: Sometimes, two characters will be typed in       //
    //    reversed order.                                                  //
    //  - Pausing: Pause your autotyper in the middle. Need to go to the   //
    //    bathroom? Simply press F10, and log out. Log in and press F11 to //
    //    resume.                                                          //
    //  - Progress reports: Given when the script finishes its run, or     //
    //    when you press F9. Also given automatically when you pause. VERY //
    //    detailed.                                                        //
    //  - Character forgetting: Sometimes it'll completely miss a          //
    //    character.                                                       //
    //                                                                     //
    /////////////////////////////////////////////////////////////////////////
    
    var
      strKeyboard:array [1..4] of array [1..2] of string;
      strText:array [1..10] of string;
      bolShiftNeeded,bolFixScrewUp,bolPause:boolean;
      intAmount,intCurChar,intLength,intRow,intTypingChar:integer;
      intSpeed, intAccuracy, intCorrection, intTimes:integer;
      intRepeats, intDelay:integer;
      chrLetters:array [1..100] of char;
      chrScrewChars:array [1..2] of char;
      chrProperChr:char;
      
    var
      intMessageUse:array[1..10] of Integer;
      intFingerSlip:array[1..2] of Integer;
      intSwitched:integer;
      intShiftScrewed:integer;
      intCorrected:Integer;
      intStopped:Integer;
      intPaused:Integer;
      intProgressViewed:Integer;
      intCharactersMissed:Integer;
    
    procedure Setup;
    begin
      intSpeed := 5;              // typing speed (1-5) - 1 = 12 WPM, 3= 36 WPM, 5 = 60 WPM (approximate)
      intAccuracy := 4;           // typing accuracy (1-5)  - 1 = 80%, 3 = 88% 5 = 96% (approximate)
      intCorrection := 4;         // chance of correcting mistakes (1-5) - 1 = 0%, 3 = 50%, 5 = 100%
      intAmount := 3;             // amount of variations to use (1-10)
      intRepeats := 10;           // times to repeat message
      intDelay := 1;              // seconds of delay between messages
      strText[1] := 'Message 1';  // message 1
      strText[2] := 'Message 2';  // message 2
      strText[3] := 'Message 3';  // message 3
      strText[4] := 'Message 4';  // etc...
      strText[5] := 'Message 5';
      strText[6] := 'Message 6';
      strText[7] := 'Message 7';
      strText[8] := 'Message 8';
      strText[9] := 'Message 9';
      strText[10] := 'Message 10';  // message 10
    end;
    
    procedure SendKeysCan(chrKey:char);
    begin
      SendKeys(chrKey);
    end;
    
    procedure Load;
    begin
      intTimes := 0;
      strKeyboard[1][1] := 'qwertyuiop[]\';
      strKeyboard[2][1] := 'asdfghjkl;';
      strKeyboard[3][1] := 'zxcvb nm,./';
      strKeyboard[4][1] := '`1234567890-=';
      strKeyboard[1][2] := 'QWERTYUIOP{}|';
      strKeyboard[2][2] := 'ASDFGHJKL:"';
      strKeyboard[3][2] := 'ZXCVBNM<>?';
      strKeyboard[4][2] := '~!@#$%^&*()_+';
    end;
    
    procedure PrintResults(bolFinished:boolean);
    var intTempInt:integer;
    begin
      WriteLn('-------------------------------------------------------------------------------');
      WriteLn(' ');
      if(bolFinished)then WriteLn('Autotyper Completed');
      if(not bolFinished)then WriteLn('Autotyper In Progress');
      intTempInt := 1;
      WriteLn(' ');
      WriteLn('-------------------------------------------------------------------------------');
      WriteLn(' ');
      repeat
        WriteLn('Sent message ' + IntToStr(intTempInt) + ' '  + IntToStr(intMessageUse[intTempInt]) + ' time(s).');
        intTempInt := intTempInt + 1;
      until(intTempInt > intAmount);
      intProgressViewed := intProgressViewed + 1;
      WriteLn('Sent ' + IntToStr(intTimes) + ' message(s) in total.');
      WriteLn('Accidentally switched 2 letters around ' + IntToStr(intSwitched) + ' time(s).');
      WriteLn('Finger slipped to the left ' + IntToStr(intFingerSlip[1]) + ' time(s).');
      WriteLn('Finger slipped to the right ' + IntToStr(intFingerSlip[2]) + ' time(s).');
      WriteLn('Mistakes were corrected ' + IntToStr(intCorrected) + ' time(s).');
      WriteLn('Almost screwed up and stopped for a few seconds ' + IntToStr(intStopped) + ' time(s).');
      WriteLn('This has been displayed ' + IntToStr(intProgressViewed) + ' time(s), including this time.');
      WriteLn('The script has been paused ' + IntToStr(intPaused) + ' time(s).');
      WriteLn('-------------------------------------------------------------------------------');
    end;
    
    procedure Pause;
    begin
      if(IsFKeyDown(10))then
      begin
        bolPause := True;
      end;
      if(IsFKeyDown(9))then PrintResults(false);
    end;
    
    procedure Correction;
    begin
      if((random(4) + 1) < intCorrection)then
      begin
        bolFixScrewUp := True;
      end else bolFixScrewUp := False;
      Pause;
    end;
    
    procedure DivideText(strReceivedText:string);
    begin
      intCurChar := 1;
      intLength := Length(strReceivedText);
      Pause;
      repeat
        Pause;
        chrLetters[intCurChar] := StrGet(strReceivedText,intCurChar);
        wait(10);
        intCurChar:=intCurChar+1;
      until(intCurChar>intLength);
    end;
    
    procedure ScrewUpWait;
    begin
      Pause;
      if(random(2)=1)then
      begin
        intStopped := intStopped + 1;
        wait(500+random(500));
      end;
      Pause;
    end;
    
    procedure ScrewUp(strScrewChar:string);
    var intCharLocation:integer;
    begin
      Pause;
      if(pos(strScrewChar,strKeyboard[1][1])<>0) then
      begin
        bolShiftNeeded := False;
        intRow := 1;
      end;
      if(pos(strScrewChar,strKeyboard[2][1])<>0) then
      begin
        bolShiftNeeded := False;
        intRow := 2;
      end;
      if(pos(strScrewChar,strKeyboard[3][1])<>0) then
      begin
        bolShiftNeeded := False;
        intRow := 3;
      end;
      if(pos(strScrewChar,strKeyboard[4][1])<>0) then
      begin
        bolShiftNeeded := False;
        intRow := 4;
      end;
      if(pos(strScrewChar,strKeyboard[1][2])<>0) then
      begin
        bolShiftNeeded := True;
        intRow := 1;
      end;
      if(pos(strScrewChar,strKeyboard[2][2])<>0) then
      begin
        bolShiftNeeded := True;
        intRow := 2;
      end;
      if(pos(strScrewChar,strKeyboard[3][2])<>0) then
      begin
        bolShiftNeeded := True;
        intRow := 3;
      end;
      if(pos(strScrewChar,strKeyboard[4][2])<>0) then
      begin
        bolShiftNeeded := True;
        intRow := 4;
      end;
      if(bolShiftNeeded)then
      begin
        intCharLocation:=pos(strScrewChar,strKeyboard[intRow][2]);
        if(intCharLocation <> 1) then
        begin
          chrScrewChars[1] := StrGet(strKeyboard[intRow][2],intCharLocation-1);
        end else chrScrewChars[1] := StrGet(strKeyboard[intRow][2],intCharLocation+1);
        if(intRow=1)then
        begin
          if(intCharLocation <> 13) then
          begin
            chrScrewChars[2] := StrGet(strKeyboard[intRow][2],intCharLocation+1);
          end else chrScrewChars[2] := StrGet(strKeyboard[intRow][2],intCharLocation-1);
        end else if (intRow=2) then
        begin
          if(intCharLocation <> 11) then
          begin
            chrScrewChars[2] := StrGet(strKeyboard[intRow][2],intCharLocation+1);
          end else chrScrewChars[2] := StrGet(strKeyboard[intRow][2],intCharLocation-1);
        end else if (intRow=3) then
        begin
          if(intCharLocation <> 10) then
          begin
            chrScrewChars[2] := StrGet(strKeyboard[intRow][2],intCharLocation+1);
          end else chrScrewChars[2] := StrGet(strKeyboard[intRow][2],intCharLocation-1);
        end else
        begin
          if(intCharLocation <> 13) then
          begin
            chrScrewChars[2] := StrGet(strKeyboard[intRow][2],intCharLocation+1);
          end else chrScrewChars[2] := StrGet(strKeyboard[intRow][2],intCharLocation-1);
        end;
      end else
      begin
        intCharLocation:=pos(strScrewChar,strKeyboard[intRow][1]);
        if(intCharLocation <> 1) then
        begin
          chrScrewChars[1] := StrGet(strKeyboard[intRow][1],intCharLocation-1);
        end else chrScrewChars[1] := StrGet(strKeyboard[intRow][1],intCharLocation+1);
        if(intRow=1)then
        begin
          if(intCharLocation <> 13) then
          begin
            chrScrewChars[2] := StrGet(strKeyboard[intRow][1],intCharLocation+1);
          end else chrScrewChars[2] := StrGet(strKeyboard[intRow][1],intCharLocation-1);
        end else if (intRow=2) then
        begin
          if(intCharLocation <> 11) then
          begin
            chrScrewChars[2] := StrGet(strKeyboard[intRow][1],intCharLocation+1);
          end else chrScrewChars[2] := StrGet(strKeyboard[intRow][1],intCharLocation-1);
        end else if (intRow=3) then
        begin
          if(intCharLocation <> 11) then
          begin
            chrScrewChars[2] := StrGet(strKeyboard[intRow][1],intCharLocation+1);
          end else chrScrewChars[2] := StrGet(strKeyboard[intRow][1],intCharLocation-1);
        end else
        begin
          if(intCharLocation <> 13) then
          begin
            chrScrewChars[2] := StrGet(strKeyboard[intRow][1],intCharLocation+1);
          end else chrScrewChars[2] := StrGet(strKeyboard[intRow][1],intCharLocation-1);
        end;
      end;
      Pause;
    end;
    
    procedure ForgetCharacter;
    begin
      chrLetters[intTypingChar] := Chr(0);
      intCharactersMissed := intCharactersMissed + 1;
    end;
    
    procedure FingerSlip;
    var intSlipDirection:integer;
    begin
      Pause;
      intSlipDirection := random(2) + 1;
      if(intSlipDirection=1)then
      begin
        chrLetters[intTypingChar] := chrScrewChars[1];
        intFingerSlip[1] := intFingerSlip[1] + 1;
      end else
      begin
        chrLetters[intTypingChar] := chrScrewChars[1];
        intFingerSlip[2] := intFingerSlip[2] + 1;
      end;
      Correction;
    end;
    
    procedure ScrewShift;
    var intTempInt:integer;
    begin
      Pause;
      if(bolShiftNeeded)then
      begin
        intTempInt := pos(chrLetters[intTypingChar],strKeyboard[intRow][2]);
        if(intTempInt <> 0) then
        begin
          chrLetters[intTypingChar] := StrGet(strKeyboard[intRow][1],intTempInt);
          intShiftScrewed := intShiftScrewed + 1;
        end;
      end;
    end;
    
    procedure Switch;
    var chrTempChr:char;
    begin
      chrTempChr:=chrLetters[intTypingChar];
      chrLetters[intTypingChar] := chrLetters[intTypingChar+1];
      chrLetters[intTypingChar+1] := chrTempChr;
      intSwitched := intSwitched + 1;
      Pause;
    end;
    
    procedure TypeText;
    var intRdmNbr,intUsedMessage:integer;
    begin
      intTypingChar := 1;
      intUsedMessage := random(intAmount) + 1;
      intMessageUse[intUsedMessage] := intMessageUse[intUsedMessage] + 1;
      DivideText(strText[intUsedMessage]);
      repeat
        Pause;
        ScrewUp(chrLetters[intTypingChar]);
        if((random(20)+1)>(intAccuracy+14))then
        begin
          intRdmNbr := random(10) + 1;
          chrProperChr := chrLetters[intTypingChar];
          case intRdmNbr of
            1:Switch;
            2:ScrewUpWait;
            3:ScrewUpWait;
            4:ScrewUpWait;
            5:ScrewUpWait;
            6:FingerSlip;
            7:ScrewShift;
            8:FingerSlip;
            9:ForgetCharacter;
            10:ForgetCharacter;
          end;
        end;
        SendKeysCan(chrLetters[intTypingChar]);
        if(bolFixScrewUp = True)then
        begin
          wait((((6-intSpeed) * 50)/2)+((6-intSpeed) * 50));
          SendKeysCan(Chr(8));
          chrLetters[intTypingChar] := chrProperChr;
          intCorrected := intCorrected + 1;
          bolFixScrewUp := False;
        end else intTypingChar := intTypingChar + 1;
        wait((((6-intSpeed) * 50)/2)+((6-intSpeed) * 50));
      until(intTypingChar>intLength);
      SendKeysCan(Chr(13));
      Pause;
    end;
    
    procedure TestPause;
    begin
      if(bolPause)then
      begin
        intPaused:=intPaused+1;
        repeat
          wait(50);
          if(IsFKeyDown(9))then PrintResults(false);
        until(IsFKeyDown(11));
      end;
    end;
    
    begin
      Load;
      Setup;
      repeat
        Pause;
        intTimes := intTimes + 1;
        TypeText;
        TestPause;
        Pause;
        wait(((intDelay*1) + random(intDelay) - intDelay / 2) * 1000);
        Pause;
        TestPause
      until(intTimes = intRepeats);
      PrintResults(true);
    end.
    I was bored before, and RancidKraut requested that I make a script like this. I don't know how well it works (Rancid says it works pretty well). This is about a month old I think, so if it doesn't work well, don't blame me =P.

  2. #2
    Join Date
    Feb 2006
    Posts
    64
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Very nice! If this would work 100% as you said it should be added to SRL. However, it doesn't correct errors even when i set it to 5(always corrects).

  3. #3
    Join Date
    Feb 2006
    Location
    Wisconsin (like farm-town, USA) :P
    Posts
    254
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I made one of these that was all in one function when SRL was first made in like January It was taken out though. I forget what happened. I'm sure if people with access to the repository *cough*I want access back*cough* like this enough, they'll put it in However, personally, I think it's kinda big.

  4. #4
    Join Date
    Apr 2006
    Location
    California
    Posts
    555
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Looks good.
    Quote Originally Posted by Leader

    “Life is short, don't waste time worrying about what people think of you, hold on to the ones that care, in the end they will be the only ones there.”

  5. #5
    Join Date
    Feb 2006
    Posts
    35
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by mike2055
    Very nice! If this would work 100% as you said it should be added to SRL. However, it doesn't correct errors even when i set it to 5(always corrects).
    It's mostly meant to be like that, because even a human will sometimes miss mistakes being made.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Custom Wait (Dual purpose)
    By HarryJames in forum OSR Help
    Replies: 7
    Last Post: 01-11-2009, 06:58 AM
  2. I just found out a Forums Bug! or is it purpose?
    By ub3r |<1||3r*1337* in forum News and General
    Replies: 3
    Last Post: 07-02-2006, 04:09 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
  •