PDA

View Full Version : AutoResponder - Works 5/5!



TravisV10
08-28-2007, 10:51 AM
I thought the community could use this! It works. Just have it with your randoms procedures! (AutoRespond;) HAVE FUN!

Credits: Charmz for core procedures. I standardized most of it and redid everything. You must credit me and charmz!




{...><> Amazing AutoRespond Procedure <><...}

{

Credits:
- Born2Code - Cleaning up and adding procedures
- Charmz - Core Procedures

}



Function GetChatMessage(Text: String): Boolean;
Var
TX, TY: Integer;
Chat: String;
Begin
If(IsTextInAreaEx(40, 415, 130, 415, TX, TY, ':', 0, SmallChars, False, True, 0, 0, 0))then
Begin
Chat:= Lowercase(Trim(GetTextAtEx(TX + 8, 415, 0, SmallChars, False, False, 0, 1, 16711680, 40, False, TR_AllChars)));
If(Pos(Text, Chat) <> 0)then
Begin
Result:= True;
end;
end;
end;

Function GetChatName(Name: String): Boolean;
Var
I: Integer;
Begin
ChatName:= Lowercase(Trim(GetTextAtEx(21, 415, 0, SmallChars, False, False, 0, 0, 0, 50, False, TR_AllChars)));
I:= Pos(':', ChatName);
If(I <> 0)then
Begin
Delete(ChatName, I, I);
end;
If(Pos(Name, ChatName) <> 0)then
Begin
Result:= True;
end;
end;

procedure AutoRespond;
var
Responce, Level: String;
TheReply: Integer;
begin
if(GetChatMessage(Players[CurrentPlayer].Name))then
begin
AutoRespondCount := AutoRespondCount + 1;
TheReply := Random(10) + 1;
case (TheReply) of
0 : Responce := ('wat');
1 : Responce := ('what');
2 : Responce := ('yeah');
3 : Responce := ('wut');
4 : Responce := ('what do you want');
5 : Responce := ('meh?');
6 : Responce := ('yep?');
7 : Responce := ('me?');
8 : Responce := ('what?');
9 : Responce := ('?');
10 : Responce := ('??');
end;
TypeSend(Responce);
end;

if(GetChatMessage('lol'))
or (GetChatMessage('ha'))
or (GetChatMessage('haha'))
or (GetChatMessage('rofl'))
or (GetChatMessage('lmao'))
or (GetChatMessage('lmfao'))
or (GetChatMessage('tehee'))
or (GetChatMessage('funny'))
or (GetChatMessage('rotfl')) then
begin
AutoRespondCount := AutoRespondCount + 1;
TheReply := Random(10) + 1;
case (TheReply) of
0 : Responce := ('lol');
1 : Responce := ('haha');
2 : Responce := ('rofl');
3 : Responce := ('lmao');
4 : Responce := ('lolz');
5 : Responce := ('roflz');
6 : Responce := ('hehe');
7 : Responce := ('ha');
8 : Responce := ('lols');
9 : Responce := ('rofls');
10 : Responce := ('funny stuff');
end;
TypeSend(Responce);
end;

if(GetChatMessage('wc'))
or (GetChatMessage('woodcutting'))
or (GetChatMessage('wcing'))
or (GetChatMessage('cutting'))
and (GetChatMessage('lvl'))
or (GetChatMessage('level'))
or (GetChatMessage('lvls'))
or (GetChatMessage('lvlz'))
or (GetChatMessage('stats'))
or (GetChatMessage('levels'))then
begin
AutoRespondCount := AutoRespondCount + 1;
Level := IntToStr(GetSkillLevel('woodcutting'));
TheReply:= Random(6) + 1;
case (TheReply) of
0,4,5,6 : Responce:= (Level);
1 : Responce:= ('I''m level ' + Level + ' over here!');
2 : Responce:= ('Only ' + Level + '... XD');
3 : Responce:= ('My lvl is ' + Level);
end;
TypeSend(Responce);
end;

if(GetChatMessage('what'))
or (GetChatMessage('wut'))
or (GetChatMessage('wat'))
and (GetChatMessage('doing'))
or (GetChatMessage('doin'))
or (GetChatMessage('up'))
or (GetChatMessage('happening')) then
begin
AutoRespondCount := AutoRespondCount + 1;
TheReply := Random(5) + 1;
case (TheReply) of
0 : Responce := ('hello');
1 : Responce := ('watz up');
2 : Responce := ('wat up');
3 : Responce := ('whats up');
4 : Responce := ('what up');
5 : Responce := ('hola');
end;
TypeSend(Responce);
end;


end;

ShowerThoughts
08-28-2007, 11:03 AM
looks nice gratz

Pwnt by Pwnt
08-28-2007, 08:39 PM
=\ not very useful tbh.. cuz auto responders in scripts make the script lag.. so unless you make one for a mercher, its not very useful... but nicely done :)

TravisV10
08-28-2007, 08:41 PM
=\ not very useful tbh.. cuz auto responders in scripts make the script lag.. so unless you make one for a mercher, its not very useful... but nicely done :)

Doesn't lag my script. Maybe you don't incorporate it right... :sasmokin:

itSchRis917
08-28-2007, 08:41 PM
No, its pretty useful pwnt by pwnt, especially for people like me, who are way too lazy to type:


If (InChat('blah'))Then
TypeSend('76');

over and over and over again..

shaunthasheep
08-28-2007, 11:44 PM
The auto respond procedure is WAY inefficient
Auto-responders WONT make your script lag.
You have GetChatMessage like 20+ times. Thats the lag write there.
You need to store the GetChatMessage in a string, instead of calling it over and over.

message := GetChatMessage;
if message = 'a' or ....

and for GetChatName, just parse it out of "message", no need to grab it again, also very dangerous, it could change inbetween.

dvdcrayola
08-29-2007, 12:42 AM
and you have:

TheReply := Random(5) + 1;

or random 10, 6... you dont need plus 1 because your cast starts from 0 ;)

TravisV10
08-29-2007, 01:22 AM
and you have:

TheReply := Random(5) + 1;

or random 10, 6... you dont need plus 1 because your cast starts from 0 ;)

It is to save me some time when adding everything up. It is to stop confusion which happens often with scripting.

Best Regards...

~Travis

dvdcrayola
08-29-2007, 03:33 AM
It is to save me some time when adding everything up. It is to stop confusion which happens often with scripting.

Best Regards...

~Travis

wait what? that didnt exactly make sence to me.. because random(5) gives you numbers 0-5(six numbers) and then your case goes from 0-5.. so why are you adding 1 to the random?

mat_de_b
09-01-2007, 02:58 PM
Congrats on members

TravisV10
09-01-2007, 03:55 PM
Congrats on members

tysm