Alright, so after reading the "My Ban Theory" thread, I decided to take the idea of a normal distribution to keyboard typing. What I have made is experimental and may not work as expected to. All I aim to do with this is help to educate those with typing correctly.
How it works:
Calculating based on words per minute, it sleeps a variable amount based on the value (assuming the average word has 6 characters)
With the help of normal distributions, the mean is the mode and the median (which is also usually the midpoint), so we can calculate a normal distribution of sleeping using the mean.
It types character per character
It wraps the Script sleep function to pause the appropriate time frame
(Version 1.1 and onwards) now makes typing errors based on the words per minute setting!
Version 1.1 (newest; typos included):
Version 1.0 (old; no typos included):
Usage example:
SmartKeyboard sk = new SmartKeyboard(this, 60); //60 words per minute
if (sk.typeString("The quick brown fox jumped over the lazy dog", true, true)) { //Third parameter to true -> enables typos
log("Typed the string and pressed enter!");
}
if (sk.typeCharacter("g")) {
log("Typed the character 'g'");
}
if (sk.typeInteger(4)) {
log("Typed the number 4!");
}
sk.typoConstant = 10000; //Default 100000; lower = more likely to cause a typo; equation ((typoConstant / (words per minute * 10))+ rand.nextInt(6))
If there are any problems with this, let me know. Jagex may be smart, but we're smarter.
Proof of typos:
(set at 125wpm; original text "The quick brown fox jumped over the lazy dog the quick brown")
Feel free to use the SmartKeyboard class however you want, but credit is always nice