Rich
2010-12-30 09:30:32
Some people were saying that SRL types too fast, so I decided to edit TypeSendEx. It works like MMouse where the user changes the speed in the script with a variable (two in this case). If the speed is too fast or slow, the script sets the default used at the moment.
Add two variables in text.simba
- KeySpeed
- RandKeySpeed
These are the variables which will be set like MouseSpeed.
Usage example:
Add two variables in text.simba
- KeySpeed
- RandKeySpeed
These are the variables which will be set like MouseSpeed.
var
OldLine, TheLine, TheName: string;
KeySpeed, RandKeySpeed : Integer;
{ const clMessage, clChat, clTrade, clFriend
Description: Text colour constants. }
const
clMessage = clBlack;
clChat = clBlue;
clTrade = clPurple;
clFriend = 128;
//CODE CUT
{*******************************************************************************
procedure TypeSendEx(Text: string; PressEnter: Boolean);
By: SKy Scripter
Description: Sends human like text.
*******************************************************************************}
procedure TypeSendEx(Text: string; PressEnter: Boolean);
var
S: string;
I, L: Integer;
Shift: Boolean;
begin
if not InRange(KeySpeed, 20, 80) then
KeySpeed = 40;
if not InRange(RandKeySpeed, 20, 80) then
RandKeySpeed = 40;
S:= 'ABCDEFGHIJKLMNOPQRSTUVWXZ' + '~!@#$%^&*()_+{}|:"<>?';
L := Length(Text);
for I := 1 to L do
begin
Shift := (Pos(Text[i], S) > 0);
if (Shift) then
begin
KeyDown(VK_SHIFT);
Wait(KeySpeed + Random(RandKeySpeed));
while (Pos(Text[i], S) > 0) and (I <= Length(Text)) do
begin
TypeByte(GetKeyCode(Text[I]));
Wait(KeySpeed + Random(RandKeySpeed));
Inc(I);
if (I > Length(Text)) then Break;
end;
end;
if (Shift) then
KeyUp(VK_SHIFT);
Wait(KeySpeed + Random(RandKeySpeed));
if (I <= Length(Text)) then
begin
TypeByte(GetKeyCode(Text[I]));
Wait(KeySpeed + Random(RandKeySpeed));
end;
end;
if (PressEnter) then
TypeByte(GetKeyCode(Chr(13)));
end;Usage example:
program New;
{.include SRL/SRL.simba}
begin
SetupSRL;
MouseSpeed:= 10;
KeySpeed:= 50;
RandKeySpeed:= 45;
EverythingElse;
end.Comments?