danrox2004
2007-10-03 01:13:36
typeMistake writes mistakes based on the position on the keyboard, so it types mistakes which are close to the actual letter. The chance is the chance of writing a mistake, lower is a higher chance of writing a mistake.
eg: type mistake with chances from 10 down to 0.
Credits:
Part of typeMistake was from typeSend by Mutant Squirrle.
Santa_Clause came up with the idea, and helped.
Usage:
typeMistake(s: string; chance: integer);
eg: type mistake with chances from 10 down to 0.
H2y! I am writing mistakes!
Hey~ I am writing mistakes!
Hwy! I am writing m7stakes!
Hey! I am writing mistakes!
He5! I am wrkting mistakex!
Ney! I am writing m7xtakes!
Gey! & a writing mistak2s!
Hwy! & am wroting jistakes!
Hey! & am 137t7bb ,istakea!
Y2yQ U am 1rigibt m7w4aied!
HeyQzI ajzwrkyint ,istakesQCredits:
Part of typeMistake was from typeSend by Mutant Squirrle.
Santa_Clause came up with the idea, and helped.
Usage:
typeMistake(s: string; chance: integer);
program New;
{.include SRL/SRL.scar}
var
i: integer;
procedure getPlaceOfLetter(letter: char; var x, y: integer; var shift: boolean);
var
keyboard: array of string;
begin
keyboard := ['`1234567890-=', 'qwertyuiop[]\', 'asdfghjkl;''', 'zxcvbnm,./', ' '];
for x := 0 to length(keyboard) - 1 do
for y := 1 to length(keyboard[x]) do
if(getKeyCode(keyboard[x][y]) = getKeyCode(letter)) then
begin
//writeln(letter + ', ' + keyboard[x][y]);
if(keyboard[x][y] <> letter) then
shift := true
else
shift := false;
exit;
end;
end;
function mistake(letter: char; chance: integer; var shift: boolean): char;
var
x, y: integer;
keyboard: array of string;
begin
keyboard := ['`1234567890-=', 'qwertyuiop[]\', 'asdfghjkl;''', 'zxcvbnm,./', ' '];
if(random(chance) <> 0) then
begin
getPlaceOfLetter(letter, x, y, shift);
result := letter;
exit;
end;
getPlaceOfLetter(letter, x, y, shift);
if(random(2) = 0) then
begin
if(x = 0) then
y := y - 1;
if(random(2) = 1) then
x := x + random(2)
else
x := x - random(2)
end else
if(random(2) = 1) then
y := y + random(2)
else
y := y - random(2)
if(x < 0) then
x := 0;
if(x > length(keyboard) - 1) then
x := length(keyboard) - 1;
if(y > length(keyboard[x])) then
y := length(keyboard[x]);
if(y < 1) then
y := 1;
result := keyboard[x][y];
end;
///////////////////////////////////////////////////////////
//Part of this was taken from TypeSend by Mutant Squirrle//
///////////////////////////////////////////////////////////
procedure typeMistake(s: string; chance: integer);
var
i: integer;
shift: boolean;
begin
for i := 1 to length(s) do
begin
s[i] := mistake(s[i], chance, shift);
if (Shift) then
begin
KeyDown(VK_Shift);
Wait(5 + Random(20));
end;
TypeByte(GetKeyCode(s[i]));
if (Shift) then
begin
KeyUp(VK_Shift);
Wait(5 + Random(20));
end;
Wait(50 + Random(120));
end;
Wait(200 + Random(500));
TypeByte(13);
end;
begin
setupSRL;
for i := 10 downto 0 do
typeMistake('Hey! I am writing mistakes!',i);
end.