SRL Archive - SRL Archives

typeMistake


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.
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 ,istakesQ

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);

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.

Johura

2007-10-03 03:56:23

Sweet! Good job. This should be added into srl as like Mtypesend or something.

Macrosoft

2007-10-17 22:22:43

sick!, i was thinking something like this too, very nice job!

This should be in srl, its so much better than typesend. ;)

Pancakes

2007-10-17 22:26:02

Its good but the 'mistakes' should be based on the position of keys on the keyboard.. for example, you can't really press 1 on the keyboard instead of pressing 9. Just my 0.2

Bobarkinator

2007-10-17 23:57:43

From: Pancakes
Its good but the 'mistakes' should be based on the position of keys on the keyboard.. for example, you can't really press 1 on the keyboard instead of pressing 9. Just my 0.2


From: danrox2004
typeMistake writes mistakes based on the position on the keyboard, so it types mistakes which are close to the actual letter.


Take time to read the whole post next time

Santa_Clause

2007-10-18 03:03:26

From: Pancakes
Its good but the 'mistakes' should be based on the position of keys on the keyboard.. for example, you can't really press 1 on the keyboard instead of pressing 9. Just my 0.2


Dan isn't stupid (h)

n3ss3s

2007-10-18 03:20:08

FFS PEOPLE! Mind looking in to SRL\SRL\Core\Text.scar, SendText2 has been there since cavemans started to use SRL. Though GJ dan..

Santa_Clause

2007-10-26 22:09:22

They make really weird mistakes, n3ss3s. Even test it.

n3ss3s

2007-10-28 06:20:08

Yeah, tested and its like Mastaraymonds avatar typing xD