SRL Archive - Research & Development Lounge

QuickChat Include


Dusk412

2008-05-21 22:40:15

I just started developing a QuickChat include section that will hopefully help the next development. So far it has taken me about 5 minutes to create this so I need you all to go out and test it and bring me make suggestions, opinions, comments, etc. so that I can improve it.

Ideas:
- Make the Option: TStringArray so that you may only enter a valid option (not sure how to do this yet) –> idea by Dusk412

Download is at the bottom. Here is the Script if you prefer copy/paste:


//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- ยป QuickChat Routines --//
//-----------------------------------------------------------------//

// * procedure TypeText(Text: string); // * by SKy Scripter * edited by Dusk412
// * function QuickChat(Regular: Boolean; Option: TStringArray); // * by Dusk412

{*******************************************************************************
procedure TypeText(Text: string);
By: SKy Scripter
Edited By: Dusk412
Description: Types but does not send human like text
*******************************************************************************}
procedure TypeText(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 + Random(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 + Random(40));
if(I <= Length(Text))then
begin
C:= GetKeyCode(StrGet(Text, I));
TypeByte(C);
Wait(40 + Random(40));
end;
end;
end;

{*******************************************************************************
procedure QuickChat(Regular: Boolean; Option: TStringArray);
by: Dusk412
Description: Uses QuickChat
Variables:
- Regular: Boolean - True for Public, False for Clan
- Option: TStringArray - Array Of Letters For Option (ie. ['g', 'r', '1'])
*******************************************************************************}
procedure QuickChat(Regular: Boolean; Option: TStringArray);
var
i, n : Integer;
begin
n := Length(Option) - 1;
Wait(300+random(50));
if (Regular = True) then
begin
case Random(2) of
0: begin
Mouse(81, 465, 1, 1, False);
Wait(150+random(50));
ChooseOption('ubl');
end;
1: TypeByte(GetKeyCode(Chr(13)));
end;
end;
if (Regular = False) then
begin
if(GetColor(81, 465) = 14474460) then
begin
Mouse(81, 465, 1, 1, False);
Wait(150+random(50));
ChooseOption('lan');
end;
end;
for i := 0 to n do
begin
TypeText(Option[i]);
Wait(500+random(125));
end;
end;

Naum

2008-05-22 04:00:38

Maybe use Cases

{*******************************************************************************
procedure QuickChat()
by: Dusk412 Edit by NAQ
Description: Uses QuickChat
Variables:
- Regular: Boolean - True for Public, False for Clan
- Option: TStringArray - Array Of Letters For Option (ie. ['g', 't'])
*******************************************************************************}

procedure QuickChat(Regular: Boolean; Option: TStringArray);
var
i, n : Integer;
begin
n := Length(Option) - 1;
Mouse(64, 466, 3, 3, False); //Randomness?
Case Regular Of

True : ChooseOption('ubl');

False : ChooseOption('lan');

end;

for i := 0 to n do
begin
TypeText(Option[i]);
Wait(500+random(125));
end;
end;


Looks Nice BTW.

Dusk412

2008-05-22 16:06:23

I thought of cases for that part but then i realized it would probably end up looking worse because I plan on adding more after that true false thing so you would end up with one MASSIVE case statement. Thanks for the feedback.

Edit: I updated it - added a little random timing, antiban, you know…

Gu3st...

2008-05-22 16:50:46

We already got one in the members forum, but this one is nice also :)

Dusk412

2008-05-22 17:43:11

From: Zytex!
We already got one in the members forum, but this one is nice also :)


Well, see, that's why I gotta hurry up and become a member lol. I am workin on my script that I will apply with right now :D. It's getting there…. lol

Edit: Thanks for telling me members had one btw lol. I shall now stop bothering because you guys got it under control…