SRL Archive - Research & Development Lounge

procedure iType


Da 0wner

2009-02-18 20:49:54

iType
A quick procedure I made that types text.

Parameters:
Text: The text you wish to type.
WaitTime: The time to wait in between characters
Return: True if you want to press return after the text is entered.

Script:
{*******************************************************************************
procedure iType(Text : string; WaitTime : integer; Return : boolean);
By: Da 0wner
Description: Types text...
*******************************************************************************}

procedure iType(Text : string; WaitTime : integer; Return : boolean);
var
i: integer;
s : string;
begin
s := '~!@#$%^&*()_+ABCDEFGHIJKLMNOPQRSTUVWXYZ{}|:"<>?';
for i := 1 to Length(Text) do
begin
if pos(Text[i], s) > 0 then
begin
KeyDown(VK_SHIFT);
Wait(WaitTime + Random(40));
end;
KeyDown(GetKeyCode(Text[i]));
Wait(WaitTime + Random(30));
KeyUp(GetKeyCode(Text[i]));
Wait(WaitTime + Random(30));
if pos(Text[i], s) > 0 then
KeyUp(VK_SHIFT);
end;
if not Return then
exit;
Wait(10 + Random(30));
KeyDown(VK_RETURN);
Wait(10 + Random(30));
KeyUp(VK_RETURN);
end;

Example:

iType('Hello, my name is Kyle. I have $4,000 dollars. I know that isn''t much but it''s all I have xD!', 25, true);

Credits:
Baked0420: Testing :).

Notes:
You can change the WaitTimes in the procedure if you want…
Credit me if you want, not really needed but appreciated :p.

Bugs:
None :D.

Baked0420

2009-02-18 20:57:45

I'll test in RS, I tested this using SCAR as client because I'm lazy. Also, your example fails needs to be isn''t and it''s. :p

EDIT: I don't know what was wrong, but I deleted everything out of my scar and just used the proedure and called it in main loop. It works good now, types at a good speed also, I used 20 for waittime. Only thing that could maybe be added to make it better would be a boolean for typing errors or not.

Also, I'd make it a if(random(5)>4) then TypeErrors; sorta thing. So it doesn't always type errors.

Da 0wner

2009-02-18 20:59:19

Yea I wasn't really paying attention to SCAR/Pascal syntax :D. I fixed it though. But yeah I tested with Runescape, it works :).

Edit: Also, I added a boolean that does that, but it uses the SRL function AddMistakes by Zephyr. I will make my own later :p.

Baked0420

2009-02-18 21:12:01

maybe it was your syntax then, because when I cleared my scar's procedure and functions and everything I had noted and retried this, I retried it with the Procedure on this page and not the one on pastebin. But goodjob this is really good, and yea it works for me now, so it should work in RS.

Da 0wner

2009-02-18 21:18:39

Yeah, the pastebin one I had an error in. I fixed in this. Was missing a parentheses.

Baked0420

2009-02-18 21:19:58

it wasn't missing a parenthesis for me, I woulda got an error for it, but instead it'd just compile and execute and not do anything. well it doesn't matter it works now and very well.

Nava2

2009-02-18 21:22:46

TypeSend('HAI');

??

Da 0wner

2009-02-18 21:29:56

Yea, of course I know about TypeSend.

This is shorter, and stuff.
And to be honest, I made it because I was bored. I still will use this in my scripts though as it is more customizable.

Edit:

From: Baked0420
it wasn't missing a parenthesis for me, I woulda got an error for it, but instead it'd just compile and execute and not do anything. well it doesn't matter it works now and very well.


Most likely, that was because you didn't have it called in the main loop :p.

Floor66

2009-02-19 11:20:29

I don't get the "Return" thing.. :P:
It's like typing a letter and then removing it??

senrath

2009-02-19 11:34:54

From: Floor66
I don't get the "Return" thing.. :P:
It's like typing a letter and then removing it??


Nah, if return is true it ends the string with a VK_RETURN keypress. Ie, it hits "enter".

Da 0wner

2009-02-19 11:55:55

Return means enter ;).

Floor66

2009-02-19 12:29:00

Ahh lol I was confuscated with backspace :O Tired atm!

Laur€ns

2009-05-11 17:46:45

From: Floor66
Ahh lol I was confuscated with backspace :O Tired atm!


confused*

Anyway, nice function, but I hate all iThings. Give it another name :p

Da 0wner

2009-05-12 07:49:18

Names is what I suck at. Any ideas? Lol.
He was obfuscated with backspace ;) xD.

mrpickle

2009-05-13 06:07:39

I think i'll use this for a script that I will be making only because of it's ability to not choose to press enter or not =D. and yes, the credits. ;p

Da 0wner

2009-05-13 06:17:29

Alright, thanks :D.