• Log in or sign up for an account here: https://www.sythe.org/login

[TUT - VB6] Simple human typer

Blupig

BEEF TOILET
Joined
Nov 23, 2006
Sythe Gold
1,609
Messages
7,145
Age
33
Location
Canada
[TUT - VB6] Simple human typer
CONTROLS:
-Textbox (2)
-Command Button (2)
-Timer (1) (Enabled = False, Interval = 1000)

1. Place all your controls in a fashion that best suits you. Textbox #1 will be the message sent, the timer is how long it will take for the text to start sending (sort of pointless with a human typer), Textbox #2 will be the user's input for the timer's interval and the 2 command buttons are for start and stop.

2. Add a module. This will contain all the crap for the human typing. Once you've added it, pop in these declarations at the top:

Code:
Public Declare Function IsCharUpper Lib "user32" Alias "IsCharUpperA" (ByVal cChar As Byte) As Long
Public Declare Function timeGetTime Lib "winmm.dll" () As Long

The first declaration is to determine if letters are upper case in the mistake coding, to match the lower case mistake groups (if you don't understand that you'll figure it out eventually, just look at the code and you should get it). The second declaration tells the application to get the system's time in the file winmm.dll which is located somewhere in your windows installation directory. That's for the wait function, see next.

3. Next comes the wait function. This is the almighty function that is extremely useful in many applications. You might want to save this somewhere as it WILL come in use for future projects of yours. Add this below your declarations:

Code:
Public Function Wait(TimeOut)
   Dim TimeNow As Long
   On Error Resume Next
   TimeNow = timeGetTime()
   Do
      DoEvents
   Loop While TimeNow + TimeOut > timeGetTime()
End Function

^^By Jazz (who I first got it from)

The wait function is really basic; it tells the application to wait for # seconds using the syntax Wait(#). In our typer, it will be used to tell the application to wait between each letter typed, with a random interval offset which we'll go over later.

4. Here comes the human typing function! Put it below your wait function.

Code:
Public Function SmartType(Text As String, Pause As Long, Mistake As Long, Enter As Boolean)
   Dim NewLetter As String
   Randomize
   For i = 1 To Len(Text)
      If Int(Mistake * Rnd) = 0 Then
         If SmartMistake(Mid(Text, i, 1), NewLetter) = True Then
            SendKeys NewLetter
            Wait (Int(Rnd * Pause))
            SendKeys "{BS}"
            Wait (Int(Rnd * Pause))
         End If
      End If
      SendKeys (Mid$(Text, i, 1))
      Wait (Int(Rnd * Pause))
   Next i
   If Enter = True Then SendKeys "{ENTER}"
End Function

^^By Terrankiller

This is kind of complicated and I really only understand half of it myself, but I know what it does. It grabs each letter of the message you want to send, then tells be application to wait # of seconds (determined in timer code in form1, we'll look at that later) + a random offset to avoid a ban. Then, this SmartType function teams up with the SmartMistake function (see next) which basically makes mistakes in the message to avoid ban even more. Finally, the string "NewLetter" is sent, one by one (newletter is each individual character of the message) with the help of SmartMistake for an anti-ban.

5. Mistakes! Add this code below the SmartType function we looked over earlier:

Code:
Public Function SmartMistake(Letter As String, MistakenLetter As String) As Boolean
   Dim Char As String, Char2() As String, Upper As Boolean, Found As Boolean
   Randomize
   Char = "abcdefghijklmnopqrstuvwxyz1234567890"
   Char2() = Split("sq|vn|xv|sf|wr|dg|fh|gj|uo|hk|jl|k;|n,|bm|ip|o[|wa|et|ad|ry|yi|cb|qe|zc|tu|xsa|`2|13|24|35|46|57|68|79|80|9-", "|")
   Upper = IsCharUpper(Asc(Letter))
   If IsNumeric(Letter) = False Then LCase (Letter)
   For c = 1 To Len(Char)
      If Mid(Char, c, 1) = Letter Then
         MistakenLetter = Mid(Char2(c - 1), Int(Len(Char2(c - 1)) * Rnd + 1), 1)
         c = Len(Char)
         Found = True
         SmartMistake = True
      End If
   Next c
   If Upper = True Then UCase (Mistake)
   If Found = False Then MistakenLetter = Letter: If Upper = True Then UCase (MistakenLetter): SmartMistake = False
End Function

^^By Terrankiller and/or Cruel :S

Wow. OK. I understand this function even less that SmartType, this is pretty advanced stuff. Anyways, what this does is each alphabetical and numerical characters are told to the application, then set into groups. Each character is matched into a group, so for example group 1 is sq. If s is typed, q will be instead (depending on the mistake chance).

6. This next chunk of code is the random interval function, which may be small but is the reinforcement of our anti-ban system. It adds a random offset to each other the typer's sent letters, so it is actually impossible to detect autotyping because each letter is typed out of the set sequence. Add this below the SmartMistake function:

Code:
Public Function RandomInt(ByVal Low As Long, ByVal High As Long) As Long
   Randomize: RandomInt = Int((High - Low + 1) * Rnd) + Low
End Function

Your module is now complete!

7. Rename your interval's textbox to txtInterval. Now, double click your start command button (rename it to cmdStart) and add this code:

Code:
Private Sub cmdStart_Click()
Timer1.Interval = txtInterval.Text
Timer1.Enabled = True
End Sub

This tells the timer that it's interval is equal to the number entered in txtInterval by the user. Then, the timer is enabled (the timer contains the SmartType call).

8. The stop button is basically the same, except is makes the timer disable. Rename the stop command button to cmdStop.

Code:
Private Sub cmdStop_Click()
Timer1.Enabled = False
End Sub

9. Now, we're going to call on our SmartType function, to send the text in the message textbox (rename it to txtMessage). Add this into your timer's code:

Code:
Private Sub Timer1_Timer()
SmartType txtMessage.Text, Typing Speed, Mistake Chance, True
End Sub

Put in whatever you want for the Typing Speed and the Mistake Chance values. I find that a typing speed of 350 and a mistake chance of 100-200 works rather well. That "True" part at the end determines if enter is to be pressed after the message is done being sent. For runescape or any other games that require you to press enter to send text, you have to keep this setting to "True".

-------------------------

You think you're done? Well, you'll never be done. There are plenty of things you can add to this, such as:
-User input for Typing Speed and Mistake Chance
-List messaging (to enable an undefined amount of messages)
-Hotkeys
-Text effects
-Fancy skins
-Double function: sendkeys and SmartType
-Etc. etc.

-------------------------

Tutorial brought to you by Blupig, content of module created by Terrankiller, Jazz, Cruel. Thanks for their share, it makes all of our jobs easier ;)
 
[TUT - VB6] Simple human typer
For the mistake chance, try using a setting of 350.
 
[TUT - VB6] Simple human typer
Haha I'm gonna see if I can dig up mine somewhere on my old hard drive. I remember writing my own mistake function even though Cruel's was out there anyway.
 
[TUT - VB6] Simple human typer
If your making an auto talker for an online game, SendKeys would be better. I mean I see level 138's auto talking all the time every milli-second and a month later they aren't even banned. So I really don't see the point of human like typing. Maybe if your making a video and your a slow typer but you want a realistic typing effect, this would be good, but otherwise...ehh.
 
[TUT - VB6] Simple human typer
If your making an auto talker for an online game, SendKeys would be better. I mean I see level 138's auto talking all the time every milli-second and a month later they aren't even banned. So I really don't see the point of human like typing. Maybe if your making a video and your a slow typer but you want a realistic typing effect, this would be good, but otherwise...ehh.
He is using SendKeys, what's your point?

If anything I'd use the SendMessage Win32 function (I believe that can be used, I may be thinking of something else).
 
Runescape Gamblingrunescape gambling
Back
Top