We had a small argument on the irc, and I decided to test it. The test is the same. Edited Typesend to remove as much possibility of randomization as possible, the EXACT same lines, everything. Here's what I got:
I ran the constant version three times. Average of 2614 milliseconds to type three lines.
I ran the arrays version three times. Average of 2672 milliseconds to type three lines.
Interesting isn't it? Try it yourself, post YOUR results:
Constant script:
SCAR Code:
Program New;
{.include srl/srl.scar}
Const
Type1 = 'Hi there';
Type2 = 'Lolwut';
Type3 = 'Hey there';
Var
Mark : Integer;
procedure TypeSend2(Text: string);
var
S: string;
I: Integer;
C: Byte;
Shift: Boolean;
begin
S:= 'ABCDEFGHIJKLMNOPQRSTUVWXZ' + '~!@#$%^&*()_+{}|:"<>?';
for I:= 1 to Length(Text) do
begin
Shift:= (Pos(Text[i], S) > 0);
if(Shift)then
begin
KeyDown(VK_SHIFT) Wait(40);
while(Pos(Text[i], S) > 0)and(I <= Length(Text))do
begin
C := GetKeyCode(StrGet(Text, I));
TypeByte(c);
I:= I + 1;
if(I > Length(Text))then Break;
end;
end;
if(Shift)then
KeyUp(VK_SHIFT);
Wait(40);
if(I <= Length(Text))then
begin
C:= GetKeyCode(StrGet(Text, I));
TypeByte(C);
Wait(40);
end;
end;
C := GetKeyCode(Chr(13));
TypeByte(C);
end;
Procedure Speak;
Begin
TypeSend2(Type1);
TypeSend2(Type2);
TypeSend2(Type3);
End;
Begin
SetupSrl;
Marktime(mark)
Speak;
WriteLn(IntToStr(TimeFromMark(Mark)));
End.
Array Script:
SCAR Code:
Program New;
{.include srl/srl.scar}
Var
Arrays : Array[0..2] Of String;
Mark, I : Integer;
procedure TypeSend2(Text: string);
var
S: string;
I: Integer;
C: Byte;
Shift: Boolean;
begin
S:= 'ABCDEFGHIJKLMNOPQRSTUVWXZ' + '~!@#$%^&*()_+{}|:"<>?';
for I:= 1 to Length(Text) do
begin
Shift:= (Pos(Text[i], S) > 0);
if(Shift)then
begin
KeyDown(VK_SHIFT) Wait(40);
while(Pos(Text[i], S) > 0)and(I <= Length(Text))do
begin
C := GetKeyCode(StrGet(Text, I));
TypeByte(c);
I:= I + 1;
if(I > Length(Text))then Break;
end;
end;
if(Shift)then
KeyUp(VK_SHIFT);
Wait(40);
if(I <= Length(Text))then
begin
C:= GetKeyCode(StrGet(Text, I));
TypeByte(C);
Wait(40);
end;
end;
C := GetKeyCode(Chr(13));
TypeByte(C);
end;
Procedure Speaks;
Begin
For I:=0 To 2 Do
TypeSend2(Arrays[I]);
End;
Procedure DeclareArray123;
Begin
Arrays[0] := 'Hi there';
Arrays[1] := 'Lolwut';
Arrays[2] := 'Hey there';
End;
Begin
SetupSrl;
Marktime(mark);
DeclareArray123;
Speaks;
WriteLn(IntToStr(TimeFromMark(Mark)));
End.