SRL Archive - Research & Development Lounge

TypeSend2 - Makes Human Errors! [NEW]


FrÕzÑ_§ÕµL

2008-03-25 06:07:10

{*************************************************************************************************
Procedure TypeSend2(Text: String; SMART : Boolean);
By: FrÕzÑ_§ÕµL.
Description: Types Text Human-like, pressing random keys around the original.Will not mess up words such as red: or wave:
as long as there is no space before the :. Will type in SMART if needed.
Use: TypeSend2('i want to change this text', false);
SMART use: TypeSend2('i want to change this text', true);
*************************************************************************************************}

Added Features (7/4/2008)
Will switch around some letters.
Will backspace some letters, taking a little more time for the typer to 'think', and then write the correct one. Won't re-type the same letter ;)
Will sometimes write a messed up word again properly with a * following it.
Will not change text effects, such as glow: or wave:. (Useful! I was using a separate typing function before to not make mistakes lol.)

Please I need people to see if the typing works in SMART all the time!

Enjoy ;)

TypeSend2('this will change your text', false);
^^ thats the usage, false indicates Non-SMART script.

Type
TextType = Record
NWord, OWord : String;
ChangeType : Integer;
end;

{*************************************************************************************************
Procedure TypeSend2(Text: String; SMART : Boolean);
By: FrÕzÑ_§ÕµL.
Description: Types Text Human-like, pressing random keys around the original.Will not mess up words such as red: or wave:
as long as there is no space before the :. Will type in SMART if needed.
Use: TypeSend2('i want to change this text', false);
SMART use: TypeSend2('i want to change this text', true);
*************************************************************************************************}
Procedure TypeSend2(Text: String; SMART : Boolean);

var
i, j, k, l, DP : integer;
WordArr : Array [0..100] of TextType;
Keys : Array [0..3] of String;

Begin
i := 0;
Text := Padr(Padl(Trim(Text), Length(Trim(Text)) + 1), Length(Trim(Text)) + 2);
Repeat
WordArr[i].OWord := Between(' ', ' ', Text);
WordArr[i].NWord := WordArr[i].OWord;
Delete(Text, Pos(WordArr[i].OWord, Text) - 1, Length(WordArr[i].OWord) + 1);
i := i + 1;
Until(Text = ' ');
for i := 0 to 100 do
Begin
WordArr[i].ChangeType := -1;
if Random(100) < 10 then
if Pos(':', WordArr[i].OWord) < 1 then
WordArr[i].ChangeType := Random(3);
end;
i := 0;
Repeat
Repeat
if WordArr[i].ChangeType = -1 then
Begin
i := i + 1;
if i > 100 then
Break;
end;
until(WordArr[i].ChangeType >= 0);
if Length(WordArr[i].OWord) = 0 then
Break;
j := Random(Length(WordArr[i].OWord)) + 1;
if WordArr[i].ChangeType = 1 then
DP := Pos(Copy(Lowercase(WordArr[i].OWord), j, 1), WordArr[i].OWord);
Keys[3] := '1234567890';
Keys[2] := 'qwertyuiop';
Keys[1] := 'asdfghjkl';
Keys[0] := 'zxcvbnm';
Repeat
for k := 3 downto 0 do
Begin
l := Pos(Copy(Lowercase(WordArr[i].OWord), j, 1), Keys[k]);
if l > 0 then
Break;
end;
if l = 0 then
Begin
i := i + 1;
if (i > 100) then
Break;
end;
until(l > 0);
if (i > 100) then
Break;
case k of
0 : k := k + Random(1);
1, 2 : k := k - 1 + Random(2);
3 : k := k - 1 + Random(1);
end;
case l of
1 : l := 1 + Random(1);
Length(Keys[k]) : l := Length(Keys[k]) - 1 + Random(1);
else
l := l - 1 + Random(2);
end;
if (Random(100) > 70) or (WordArr[i].ChangeType = 1) then
Begin
Delete(WordArr[i].NWord, j, 1);
Insert(Copy(Keys[k], l, 1), WordArr[i].NWord, j);
end else
Insert(Copy(Keys[k], l, 1), WordArr[i].NWord, j - 1 + Random(1));
i := i + 1;
Until(i = 101);
for i := 0 to 100 do
Begin
for l := 1 to Length(WordArr[i].NWord) do
Begin
if Pos(Copy(WordArr[i].NWord, l, 1), '~!@#$%^&*()_+{}|:"<>?') > 0 then
Begin
KeyDown(VK_SHIFT);
Wait(100 + Random(100));
end;
if SMART then
SmartSendKeys(Copy(WordArr[i].NWord, l, 1))
else
TypeByte(GetKeyCode(StrGet(WordArr[i].NWord, l)));
Try
if Not(Pos(Copy(WordArr[i].NWord, l + 1, 1), '~!@#$%^&*()_+{}|:"<>?') > 0) then
KeyUp(VK_SHIFT);
Except
end;
Wait(100 + Random(100));
if (WordArr[i].ChangeType = 1) and (l = DP) then
if (Copy(WordArr[i].NWord, l, 1) <> Copy(WordArr[i].OWord, DP, 1)) then
Begin
Wait(200 + Random(200));
TypeByte(VK_BACK);
Wait(200 + Random(200));
if SMART then
SmartSendKeys(Copy(WordArr[i].OWord, DP, 1))
else
TypeByte(GetKeyCode(StrGet(WordArr[i].OWord, DP)));
Wait(200 + Random(200));
end;
end;
if Length(WordArr[i].NWord) = 0 then
Break;
if SMART then
SmartSendKeys(' ')
else
TypeByte(VK_SPACE);
end;
if SMART then
SmartSendKeys(chr(10))
else
TypeByte(GetKeyCode(chr(13)));
for l := 0 to 100 do
if WordArr[l].ChangeType = 2 then
if WordArr[l].OWord <> WordArr[l].NWord then
Begin
for i := 1 to Length(WordArr[l].OWord) do
Begin
if SMART then
SmartSendKeys(Copy(WordArr[i].OWord, i, 1))
else
TypeByte(GetKeyCode(StrGet(WordArr[l].OWord, i)));
Wait(100 + Random(100));
end;
if WordArr[l].OWord = '' then
Exit;
KeyDown(VK_SHIFT);
Wait(100 + Random(100));
if SMART then
SmartSendKeys('*')
else
TypeByte(GetKeyCode('8'));
Wait(200 + Random(200));
KeyUp(VK_SHIFT);
Wait(100 + Random(100));
if SMART then
SmartSendKeys(chr(10))
else
TypeByte(GetKeyCode(chr(13)));
Exit;
end;
end;

Attachments:
TypeSend2.scar - Set debug box as your client and click run to test.

StrikerX

2008-03-25 06:12:41

lol nice This is gonna make jagex Shit themselves haha defiantly will use when making my first script if thats alright….

FrÕzÑ_§ÕµL

2008-03-25 06:14:09

Awesome ;) yea I really wanna focus on human-like now that they are being so careful and banning a ton of us.

Good luck with it.

Da 0wner

2008-03-25 06:16:58

Maybe add TypeSend(Text) at end? Dosen't type for me. :p

FrÕzÑ_§ÕµL

2008-03-25 06:19:50

Thats because the typing bit is within the {}, the thing posted is a tester lol.

ZephyrsFury

2008-03-25 06:21:49

Can I ask why you need the SMART boolean. SMART.scar already changes the Chr(13) into a Chr(10).

FrÕzÑ_§ÕµL

2008-03-25 06:22:53

Yes, but you need smartsendkeys or it won't type i find. Maybe I don't need, will test tomorrow, going to bed now.

omgnomorenames

2008-03-25 06:46:49

I made something almost exactly like this yesterday, you didn't happen to get the idea from me…, but looks way better then mine so cheers to you.

wired16

2008-03-25 06:48:47

i had this idea except with the login like… mess up the username or password ……. cuase who doesnt mis spell thier name or pass sometimes?

FrÕzÑ_§ÕµL

2008-03-25 13:35:47

Lol I saw your thread when I was gonna post this omgnomorenames, but I have been working on this thing for ages, used to have about 300 lines as I had 5 different options forever key on the keyboard lol!

Well wired, I don't know that Jagex really monitor logins anyway, but if it was set to a 1% screw up it may be an ok idea.

wired16

2008-03-25 14:50:55

yea… somthing maybe like (im not a sc;ripter so i know its wrong but youll get it
if typesend=a (random 1-2)
1.(s)
2.(q)
if typesend=b then random 1-2
1.(n)
2.(b)
but only have it do like 1 letter ..hell even have it try and login then when fails correct login…
yea i dont think they do… but if they ever do…… i came up with it first :D

FrÕzÑ_§ÕµL

2008-03-25 14:56:25

Totally wrong code :p lol yea you said.

Thats what mine does though, it gets where the key is on the 'keyboard', and chooses whether to stay on that keyboard line or to go up/down one (depending on position of course, since the 1234 line can't go up one), it then will choose a letter to the left center or right of where the original key was on the new line.

So
's' can return any of:
q, w, e, a, s, d, z, x, c.

Attached a compilable test version of it now.

mixster

2008-03-25 15:07:02

I was tempted to write a replacement for TypeSend myself, but I'm glad I didn't as your one rocks ;)
Though all it seems to be lacking is the ability to change the probability it mistypes (e.g. 10%, 5%, 1 div 20.0 etc.)

omgnomorenames

2008-03-25 15:14:58

Lol, glad at least you saw mine :D

You should add something to have it switch the letters around.

Example
See and Typo "ese"
Great and Typo "Graet"
Should be used on two vowels side by side.

Another one is remove a letter by "accident"

Example
Worried and Typo "Woried"
Hurry and Typo "Hury"
Words with the same letter side by side.

wired16

2008-03-25 18:04:56

^^^ good idea but we dont want to make it too long lol

mixster

2008-03-25 18:12:21

It wouldn't be too long, all you would have to do is make it randomly select 2 characters to switch around, set a var to = the one, set the other to equal the first one and voila! Actually, coding it may be easier!

function SwitchRandomChar(s: string): string;
var
TempC: char;
RC1, RC2: Integer;
begin
RC1 := Random(Length(s) - 2) + 1;
TempC := s[RC1];
RC2 := Random(2) - 1 + RC1;
s[RC1] := s[RC2];
s[RC2] := TempC;
Result := s;
end;
And that should work :)

Narcle

2008-03-25 18:37:06

You could go really far with this. Even as far as testing yourself how often you make mistakes typing yourself. I think the main thing that would change the accuracy just like human typing is the speed of it. The faster the typing the higher the chance to make mistakes. The slower the typing the less chance of making a mistake. If I made a full fledge Typing function like this I would have the String then the Speed to type from 1-10 or something of the sort. It would be the most simple.

TypeSend(Str:string; TypeSpeed:integer)

Something like that. I would use already predetermined % chance to mistype etc. depending on the speed.

wired16

2008-03-25 18:54:31

great idea narcle….. actually thats common sense

FrÕzÑ_§ÕµL

2008-03-25 21:36:11

Wow there are so many things I could add ^^ thank you guys, will spend a lot of time on this then :p I used to have option for percent mistake etc but there was no real need, it will be adjusted as it was just a test after all.

The other thing is that it makes mistakes in a certain order, not just randomly, so if it makes 5 in the first 10 letters then the last 10 letters wouldn't be changed.

drizzt

2008-03-25 22:11:41

What I think would be pretty cool make it so that if it makes a mistake, about half the time make it backspace and fix the mistake it made, because thats what i, and probably some other people do when they time. it's really good as is is though

FrÕzÑ_§ÕµL

2008-03-25 23:00:46

Right so list of possibles:
Backspace mistakes.
ReType mistake word with a * following it.
Mistakes based on speed.
Changing order of mistakes made.
Switching letters around (simple, just change where it inserts by -1)

I see no reason why any or all of those can't be implemented with a well designed structure, will be on my project list along with Fr0zn Hybrid.

StrikerX

2008-03-26 01:33:12

yo soul how much time did this take to make?

mixster

2008-03-26 03:13:07

3 days, 2 hours and 1 minute.

Anyway, it sounds ambitious adding all of that stuff in and still managing to keep it below 100 lines, but I guess that limit will go out the window if it was as awesome as it will be :)

EvilChicken!

2008-03-26 09:10:50

From: FrÕzÑ_§ÕµL
Right so list of possibles:
Backspace mistakes.
ReType mistake word with a * following it.
Mistakes based on speed.
Changing order of mistakes made.
Switching letters around (simple, just change where it inserts by -1)

I see no reason why any or all of those can't be implemented with a well designed structure, will be on my project list along with Fr0zn Hybrid.


Seriously, if you do all that, I can guarantee you it'll be implemented in SRL. I like the "backspacing mistakes" idea, could be useful. I think LogInPlayer would be changed to "LoginPlayer(SendText2: Boolean)" if your function gets impemented. ^_^ Best of luck!

PvH

2008-03-26 09:43:41

From: FrÕzÑ_§ÕµL
Right so list of possibles:
Backspace mistakes.
ReType mistake word with a * following it.
Mistakes based on speed.
Changing order of mistakes made.
Switching letters around (simple, just change where it inserts by -1)

I see no reason why any or all of those can't be implemented with a well designed structure, will be on my project list along with Fr0zn Hybrid.


whoah.. that would be hard scripting..
i wish i could do that :p
you got that mistake thing also in your forest frostbite right?
(not this one, but another kind of which also made mistakes)
very nice;)
rep++

mixster

2008-03-26 14:00:48

Most of those are actually quite easy to do, but to pull together in one script and make them coincide is where the real problems start. Afterall, what happens if all of the mistakes happen in one word? That would look very suspicious or if you backspaced a wrong word then put a *"word here". It's just thinking it all through and organising it, then making sure it all works with heavy testing and it will be great. Also, as EvilChicken said, it probably will be thrown into SRL, though I doubt for the login as I doubt Jagex would monitor login screens, especially as I know I personally have never misspelled my name when logging in and only a couple of times misspelled my password.

FrÕzÑ_§ÕµL

2008-03-26 14:30:03

Aye thank you all :) and yes I did use my old (300lines+) version of this in frostbite 1.5.

May be quite a hard time ahead lol, but I need just as much organization in Fr0zn Hybrid, I will manage ;) I doubt it will stay to < 100 lines though.

Thank you all for your support, wish me luck!

Edit : Just begun… holy shit this hurts :p going well though, I have separated the Text into a special Type I have made, so each word is one part of an array. Not even entirely sure what I'm gonna finish with lol…

Seperator :
  Text := Padr(Padl(Trim(Text), Length(Trim(Text)) + 1), Length(Trim(Text)) + 2);
Repeat
WordArr[i].Word := Between(' ', ' ', Text);
Delete(Text, Pos(WordArr[i].Word, Text) - 1, Length(WordArr[i].Word) + 1);
i := i + 1;
Until(Text = ' ');

FrÕzÑ_§ÕµL

2008-04-01 00:39:47

I think I'm pretty much done on it, please PM for a test.

I'm not sure about the speed thing. Should I do it randomly or user set? Because if I use Typesend2(text, 5) it might not be implemented coz ppl wouldn't wanna write the speed each time? I know how to do it, just not wether I should.

Also what Typing speed? RandomRange(200,400) between each key is what I'm using, works pretty well but I don't have much experience.

EvilChicken!

2008-04-01 08:59:35

200 - 400 MS is qute much for key typing. Check what the original TypeSend has! I think its shomewhat like 30 + random(45). And, RandomRange(int, int2) is twice as slow as int + random(int); So I would reccomend int + random(int). Likewise, Inc(int) is twice as slow as int + 1;.

Edit: Mind PMing me the code, since I now made a post in your thread and all? (Trying to save time..)

JuKKa

2008-04-01 09:21:14

Program Test;

Function MakeError( S: String; Chance: Integer): String;
Var
KeyBoard: Array [1..3] Of TStringArray;
I, KBx1, KBy1: Integer;
Begin
KeyBoard[1] := ['q','w','e','r','t','y', 'u', 'i', 'o', 'p'];
KeyBoard[2] := ['a','s','d','f','g','h', 'j', 'k', 'l'];
KeyBoard[3] := ['z','x','c','v','b','n', 'm'];
If(Chance > 100)Then
Chance := 100-Random(100);
For I:= 1 To Length(S) Do
If(Chance >= Random(100))Then
Begin
For KBx1 := 1 To 3 Do
For KBy1 := 0 To High(KeyBoard[ KBx1 ] ) Do
Begin
If(Lowercase(S [ i ]) = KeyBoard[KBx1][KBy1])Then
Begin
Try
Result := Result + KeyBoard[KBx1 + Random(2)][KBy1 + Random(2)];
Except
Try
Result := Result + KeyBoard[KBx1 - Random(2)][KBy1 - Random(2)];
Except
Result := Result + S [ I ];
End;
End;
End;
End;
End Else
Begin
Result := Result + S [ I ];
Continue;
End;
End;

Begin
Writeln(MakeError('abcdefghijklmnopqrstuvwxyz', 10));
End.

ehhhh´, i suckkk but thats somewhat how i would create it.

FrÕzÑ_§ÕµL

2008-04-01 14:07:15

No Jukka lol, I'm sure it works just as well as mine did, but mine now has all those extra things.

:duh: damit so I can't use RandomRange either :p used to use inc till I read raymonds post that they were slower…

JAD

2008-04-01 20:44:30

Hmm… Nice function, but I believe SRL made one that does the exact same thing except it doesn't press the enter key:


{*******************************************************************************
function SendText2(Text: String): Boolean;
By: RSN | Modded By: Spky
Description: Types text humanlike making mistakes, returns true if mistake has
been made.
*******************************************************************************}

function SendText2(Text: string): Boolean;
var
i, j, w: Integer;
S: string;
begin
for i := 1 to Length(Text) do
begin
S := Text[i];
if (Random(5) + 1 = 1) and (w < 3) then
begin
w := w + 1;
Result := True;
j := Ord(S[1]);
if (j <> 13) then
S := Chr(j + (Random(5) + 1));
if (S = Chr(13)) then
S := 'l';
end;
SendKeys(S);
Wait(50 + Random(100));
end;
end;

Correct me if yours does something different.

Nice though :)

FrÕzÑ_§ÕµL

2008-04-01 22:56:35

Jad the SRL one is hardly anything like this, it types any letter near one, so s could be like qrstuv, but thats no where near human like, plus mine backspaces and correct mistakes.

P1nky

2008-04-01 23:16:14

forsure gonna use this! in my script

FrÕzÑ_§ÕµL

2008-04-01 23:37:31

^^ thanks p1nky, enjoy mate.

StrikerX

2008-04-02 06:35:26

haha Checked new version out :) Rep++

it was ment to right

Strikerx25 Rocks He is a n00b Scripter ATM but will someday Rule Ze World

But instead

strikerx25 rocks he is a n00b scripter atm but will sosmeday rulw ze world
rule*

So to use this just replace typesend('') With typesend2('') <—-Noob Question

FrÕzÑ_§ÕµL

2008-04-02 14:10:39

Yes TypeSend in your script becomes TypeSend2('text', false);, or if you are using SMART then TypeSend2('text', true);.

Ultra

2008-04-02 16:30:51

Hey, i seen this in your script - Forest Frostbite, yes this is awsome.

MWHAHAHAHA How are you gonna deal with this now jaghax! :).

FrÕzÑ_§ÕµL

2008-04-02 18:41:36

Lol yea script uses my old one, doesn't have the 3+ new features ^^ totally pwning jagex hehe.

StrikerX

2008-04-03 01:35:55

hey just wondering sometimes it backspaces even when it is correct is this ment to happen?

FrÕzÑ_§ÕµL

2008-04-03 02:05:27

:p ya I know lol, gonna have to fix that then eh ^^

MylesMadness

2008-04-05 20:25:31

Okay this kick ass

Edit:500th post!

FrÕzÑ_§ÕµL

2008-04-06 19:53:16

:p thanks man, you reckon this could be put in SRL?

PvH

2008-04-07 03:07:22

i think this might become a srl thingie
its awsome man:D
very nice done;)

FrÕzÑ_§ÕµL

2008-04-07 04:14:26

Thanks ;) I fixed the problem with it backspacing and replacing with the same letter now, so its sweet as. Gonna see what Wizzup? thinks.

Narcle

2008-04-07 04:29:32

From: FrÕzÑ_§ÕµL
:p thanks man, you reckon this could be put in SRL?


Devs are very picky.

FrÕzÑ_§ÕµL

2008-04-07 05:28:05

Yea I ain't really expecting anything lol… especially not with it taking up so many lines :( oh well.

JuKKa

2008-04-07 10:33:18

Procedure Typesendmistake(txt: String; Chance: Integer);
Var
Key: String;
KeyBoard: Array [0..3] Of TStringArray;
KBx1, KBy1, I: Integer;
Begin
I := 1;
KeyBoard[0] := ['1','2','3','4','5','6','7','8','9','0'];
KeyBoard[1] := ['q','w','e','r','t','y', 'u', 'i', 'o', 'p'];
KeyBoard[2] := ['a','s','d','f','g','h', 'j', 'k', 'l'];
KeyBoard[3] := ['z','x','c','v','b','n', 'm'];
While( I <= Length( txt ) ) Do
Begin
If(Random(100) <= Chance)Then
Begin
For KBx1 := 0 To 3 Do
For KBy1 := 0 To High(KeyBoard[ KBx1 ] ) Do
If(Lowercase(txt [ i ]) = KeyBoard[KBx1][KBy1])Then
Try
Key := KeyBoard[KBx1 + Random(2)][KBy1 + Random(2)];
Except
Try
Key := KeyBoard[KBx1 - Random(2)][KBy1 - Random(2)];
Except
Key := Txt[i];
End;
End;
End Else Key := Txt[i];

TypeByte(GetKeyCode(StrGet(Key, 1)));
Wait(40 + Random(40));
If(Key = txt[i])Then
Inc(I)
Else
Begin
Wait(200+Random(200));
TypeByte(VK_BACK);
Wait(200+Random(200));
End;
End;
TypeByte(GetKeyCode(Chr(13)));
End;

heres another one i created.

NiCbaZ

2008-04-22 06:04:17

ty useing this in script if thats ok!

FrÕzÑ_§ÕµL

2008-04-22 15:14:58

:) No prob nic, it's what its here for.