Pentti
2007-05-02 12:42:33
Hahaa!
Function ChatBoxRespond(TheText,FromText,SayText:String):Boolean;
This is updated version of my Chatbox responder.
First one didn't work well, but this should work, its really fast too. :D Tme to search for all texts is < 60 milli seconds, doesn't matter how many words you want to search for, it always takes about same time.
Really apperciate your help man! :D
Some features:
FromText:String; You put there the text you want to respond from. Such as 'Hi'. And if word Hi is found from chatbox it will respond.
SayText:String; Text you want to answer with when text you are searching for is found. Here's the function:
To test it, you can use this:
It has a timer so you can see how long it takes to find for all of those texts.
Remember to put your Player name in, or it will answer to your own messages.
You can add your own text into it, its really easy!!!
This auto responder would be a very usefull for antiban!
CHANGE ALL 415'S TO 412!
Function ChatBoxRespond(TheText,FromText,SayText:String):Boolean;
This is updated version of my Chatbox responder.
First one didn't work well, but this should work, its really fast too. :D Tme to search for all texts is < 60 milli seconds, doesn't matter how many words you want to search for, it always takes about same time.
1. Time: 47ms!
1. Average Time: 50ms!
2. Time: 47ms!
2. Average Time: 75ms!
3. Time: 47ms!
3. Average Time: 75ms!
4. Time: 63ms!
4. Average Time: 72ms!
5. Time: 47ms!
5. Average Time: 67ms!
6. Time: 47ms!
6. Average Time: 61ms!
| - - - - RESPOND - - - - -
|(censored): Hi
|Pentti: Hello!
| - - - - - - - - - - - - -
7. Time: 6766ms!
7. Average Time: 1018ms! <- Went bigger because it had to type the text
8. Time: 47ms!
8. Average Time: 1017ms!
| - - - - RESPOND - - - - -
|(censored): Wazzup
|Pentti: Nothing much!
| - - - - - - - - - - - - -
9. Time: 7015ms!
9. Average Time: 1683ms!
10. Time: 2125ms!
10. Average Time: 1794ms!
11. Time: 2125ms!
11. Average Time: 1835ms!
12. Time: 2125ms!
12. Average Time: 1863ms!
| - - - - RESPOND - - - - -
|(censored): Noob
|Pentti: Yes, im a noob!
| - - - - - - - - - - - - -Big thanks to ricardo016 for helping me to test this!!!Really apperciate your help man! :D
Some features:
- Fast text searching (Doesn't matter how many words you want to search)
- Doesn't respond to your own account's messages.
- You can set as many words to answer from as you want.
- Gets account name who you talked to you.
- It's easy to set your own words to answer from!
- TheText:String; The texts thats in the chatbox. Example:
var
ChatText:String;
begin
ChatText:=GetLastChatText;
ChatBoxRespond(ChatText,'Hi','Hello!')
ChatBoxRespond(ChatText,'Bye','See you!')
end.First you make a variable where to store the chatbox text, then you use you the variable in ChatBoxRespond function's TheText place.
(DO NOT add GetLastChatText in the TheText place, remember to store it in the variable!)
Function ChatBoxRespond(TheText,FromText,SayText:String):Boolean;
var GetName:String;
begin
if(TheText='')then
Exit;
if(pos(lowerCase(FromText),LowerCase(Trim(TheText)))<>0)then
begin
GetName:=Trim(GetTextAtEx(20,415,45,SmallChars,False,False,0,2,0,40,True,tr_NormalChars));
if(pos(LowerCase(Players[Currentplayer].Name),LowerCase(GetName))<>0)then
Exit;
Result:=True;
wait(500+random(2000))
TypeSend(SayText)
writeln('| - - - - RESPOND - - - - -')
Writeln('|'+GetName+': '+FromText)
Writeln('|'+Players[CurrentPlayer].Name+': '+SayText)
writeln('| - - - - - - - - - - - - -')
Wait(500+random(1000))
end;
end; To test it, you can use this:
{.include srl/srl.scar}
var
TheChatText:STring;
Mark1:Integer;
Mark2:Integer;
Count:LongInt;
Average:Integer;
procedure Player;
begin
setarraylength(Players,1)
CurrentPlayer:=0
Players[0].Name:='Name';
end;
Function ChatBoxRespond(TheText,FromText,SayText:String):Boolean;
var GetName:String;
begin
if(TheText='')then
Exit;
if(pos(lowerCase(FromText),LowerCase(Trim(TheText)))<>0)then
begin
GetName:=Trim(GetTextAtEx(20,415,45,SmallChars,False,False,0,2,0,40,True,tr_NormalChars));
if(pos(LowerCase(Players[Currentplayer].Name),LowerCase(GetName))<>0)then
Exit;
Result:=True;
wait(500+random(2000))
TypeSend(SayText)
writeln('| - - - - RESPOND - - - - -')
Writeln('|'+GetName+': '+FromText)
Writeln('|'+Players[CurrentPlayer].Name+': '+SayText)
writeln('| - - - - - - - - - - - - -')
Wait(500+random(1000))
end;
end;
procedure AutoRespond;
begin
if(IsTextInAreaEx(40,415,130,415,x,y,':',0,smallchars,False,True,0,0,0))then //SRL: GetLastChatText
TheChatText:=Trim(GetTextAtEx(x+8,415,0,SmallChars,False,False,0,1,16711680,40,False,tr_allChars))
ChatBoxRespond(TheChatText,'Hi','Hello!')
ChatBoxRespond(TheChatText,'Wazzup','Nothing much!')
ChatBoxRespond(TheChatText,'Idiot','Ye, you are!')
ChatBoxRespond(TheChatText,'Bye','See you!')
ChatBoxRespond(TheChatText,'Noob','Yes, im a noob!')
ChatBoxRespond(TheChatText,'Hi','Hello!')
ChatBoxRespond(TheChatText,'Wazzup','Nothing much!')
ChatBoxRespond(TheChatText,'Idiot','Ye, you are!')
ChatBoxRespond(TheChatText,'Bye','See you!')
ChatBoxRespond(TheChatText,'Noob','Yes, im a noob!')
ChatBoxRespond(TheChatText,'Hi','Hello!')
ChatBoxRespond(TheChatText,'Wazzup','Nothing much!')
ChatBoxRespond(TheChatText,'Idiot','Ye, you are!')
ChatBoxRespond(TheChatText,'Bye','See you!')
ChatBoxRespond(TheChatText,'Noob','Yes, im a noob!')
ChatBoxRespond(TheChatText,'Hi','Hello!')
ChatBoxRespond(TheChatText,'Wazzup','Nothing much!')
ChatBoxRespond(TheChatText,'Idiot','Ye, you are!')
ChatBoxRespond(TheChatText,'Bye','See you!')
ChatBoxRespond(TheChatText,'Noob','Yes, im a noob!')
ChatBoxRespond(TheChatText,'Hi','Hello!')
ChatBoxRespond(TheChatText,'Wazzup','Nothing much!')
ChatBoxRespond(TheChatText,'Idiot','Ye, you are!')
ChatBoxRespond(TheChatText,'Bye','See you!')
ChatBoxRespond(TheChatText,'Noob','Yes, im a noob!')
ChatBoxRespond(TheChatText,'Hi','Hello!')
ChatBoxRespond(TheChatText,'Wazzup','Nothing much!')
ChatBoxRespond(TheChatText,'Idiot','Ye, you are!')
ChatBoxRespond(TheChatText,'Bye','See you!')
ChatBoxRespond(TheChatText,'Noob','Yes, im a noob!')
ChatBoxRespond(TheChatText,'Hi','Hello!')
ChatBoxRespond(TheChatText,'Wazzup','Nothing much!')
ChatBoxRespond(TheChatText,'Idiot','Ye, you are!')
ChatBoxRespond(TheChatText,'Bye','See you!')
ChatBoxRespond(TheChatText,'Noob','Yes, im a noob!')
ChatBoxRespond(TheChatText,'Hi','Hello!')
ChatBoxRespond(TheChatText,'Wazzup','Nothing much!')
ChatBoxRespond(TheChatText,'Idiot','Ye, you are!')
ChatBoxRespond(TheChatText,'Bye','See you!')
ChatBoxRespond(TheChatText,'Noob','Yes, im a noob!')
ChatBoxRespond(TheChatText,'Hi','Hello!')
ChatBoxRespond(TheChatText,'Wazzup','Nothing much!')
ChatBoxRespond(TheChatText,'Idiot','Ye, you are!')
ChatBoxRespond(TheChatText,'Bye','See you!')
ChatBoxRespond(TheChatText,'Noob','Yes, im a noob!')
ChatBoxRespond(TheChatText,'Hi','Hello!')
ChatBoxRespond(TheChatText,'Wazzup','Nothing much!')
ChatBoxRespond(TheChatText,'Idiot','Ye, you are!')
ChatBoxRespond(TheChatText,'Bye','See you!')
ChatBoxRespond(TheChatText,'Noob','Yes, im a noob!')
ChatBoxRespond(TheChatText,'Hi','Hello!')
ChatBoxRespond(TheChatText,'Wazzup','Nothing much!')
ChatBoxRespond(TheChatText,'Idiot','Ye, you are!')
ChatBoxRespond(TheChatText,'Bye','See you!')
ChatBoxRespond(TheChatText,'Noob','Yes, im a noob!')
ChatBoxRespond(TheChatText,'Hi','Hello!')
ChatBoxRespond(TheChatText,'Wazzup','Nothing much!')
ChatBoxRespond(TheChatText,'Idiot','Ye, you are!')
ChatBoxRespond(TheChatText,'Bye','See you!')
ChatBoxRespond(TheChatText,'Noob','Yes, im a noob!')
ChatBoxRespond(TheChatText,'Hi','Hello!')
ChatBoxRespond(TheChatText,'Wazzup','Nothing much!')
ChatBoxRespond(TheChatText,'Idiot','Ye, you are!')
ChatBoxRespond(TheChatText,'Bye','See you!')
ChatBoxRespond(TheChatText,'Noob','Yes, im a noob!')
ChatBoxRespond(TheChatText,'Hi','Hello!')
ChatBoxRespond(TheChatText,'Wazzup','Nothing much!')
ChatBoxRespond(TheChatText,'Idiot','Ye, you are!')
ChatBoxRespond(TheChatText,'Bye','See you!')
ChatBoxRespond(TheChatText,'Noob','Yes, im a noob!')
ChatBoxRespond(TheChatText,'Hi','Hello!')
ChatBoxRespond(TheChatText,'Wazzup','Nothing much!')
ChatBoxRespond(TheChatText,'Idiot','Ye, you are!')
ChatBoxRespond(TheChatText,'Bye','See you!')
ChatBoxRespond(TheChatText,'Noob','Yes, im a noob!')
ChatBoxRespond(TheChatText,'Hi','Hello!')
ChatBoxRespond(TheChatText,'Wazzup','Nothing much!')
ChatBoxRespond(TheChatText,'Idiot','Ye, you are!')
ChatBoxRespond(TheChatText,'Bye','See you!')
ChatBoxRespond(TheChatText,'Noob','Yes, im a noob!')
ChatBoxRespond(TheChatText,'Hi','Hello!')
ChatBoxRespond(TheChatText,'Wazzup','Nothing much!')
ChatBoxRespond(TheChatText,'Idiot','Ye, you are!')
ChatBoxRespond(TheChatText,'Bye','See you!')
ChatBoxRespond(TheChatText,'Noob','Yes, im a noob!')
ChatBoxRespond(TheChatText,'Hi','Hello!')
ChatBoxRespond(TheChatText,'Wazzup','Nothing much!')
ChatBoxRespond(TheChatText,'Idiot','Ye, you are!')
ChatBoxRespond(TheChatText,'Bye','See you!')
ChatBoxRespond(TheChatText,'Noob','Yes, im a noob!')
ChatBoxRespond(TheChatText,'Hi','Hello!')
ChatBoxRespond(TheChatText,'Wazzup','Nothing much!')
ChatBoxRespond(TheChatText,'Idiot','Ye, you are!')
ChatBoxRespond(TheChatText,'Bye','See you!')
ChatBoxRespond(TheChatText,'Noob','Yes, im a noob!')
ChatBoxRespond(TheChatText,'Hi','Hello!')
ChatBoxRespond(TheChatText,'Wazzup','Nothing much!')
ChatBoxRespond(TheChatText,'Idiot','Ye, you are!')
ChatBoxRespond(TheChatText,'Bye','See you!')
ChatBoxRespond(TheChatText,'Noob','Yes, im a noob!')
ChatBoxRespond(TheChatText,'Hi','Hello!')
ChatBoxRespond(TheChatText,'Wazzup','Nothing much!')
ChatBoxRespond(TheChatText,'Idiot','Ye, you are!')
ChatBoxRespond(TheChatText,'Bye','See you!')
ChatBoxRespond(TheChatText,'Noob','Yes, im a noob!')
ChatBoxRespond(TheChatText,'Hi','Hello!')
ChatBoxRespond(TheChatText,'Wazzup','Nothing much!')
ChatBoxRespond(TheChatText,'Idiot','Ye, you are!')
ChatBoxRespond(TheChatText,'Bye','See you!')
ChatBoxRespond(TheChatText,'Noob','Yes, im a noob!')
ChatBoxRespond(TheChatText,'Hi','Hello!')
ChatBoxRespond(TheChatText,'Wazzup','Nothing much!')
ChatBoxRespond(TheChatText,'Idiot','Ye, you are!')
ChatBoxRespond(TheChatText,'Bye','See you!')
ChatBoxRespond(TheChatText,'Noob','Yes, im a noob!')
ChatBoxRespond(TheChatText,'Hi','Hello!')
ChatBoxRespond(TheChatText,'Wazzup','Nothing much!')
ChatBoxRespond(TheChatText,'Idiot','Ye, you are!')
ChatBoxRespond(TheChatText,'Bye','See you!')
ChatBoxRespond(TheChatText,'Noob','Yes, im a noob!')
ChatBoxRespond(TheChatText,'Hi','Hello!')
ChatBoxRespond(TheChatText,'Wazzup','Nothing much!')
ChatBoxRespond(TheChatText,'Idiot','Ye, you are!')
ChatBoxRespond(TheChatText,'Bye','See you!')
ChatBoxRespond(TheChatText,'Noob','Yes, im a noob!')
//And so on...
end;
begin
SetUpSRL;
Player;
activateclient;
wait(2000)
MarkTime(Mark2)
repeat
wait(700)
MarkTime(Mark1)
Count:=Count+1
AutoRespond;
Average:=(Average+TimeFromMark(Mark2))/Count-700
writeln('')
Writeln(inttostr(Count)+'. Time: '+inttostr(TimeFromMark(Mark1))+'ms!')
Writeln(inttostr(Count)+'. Average Time: '+inttostr(Average)+'ms!')
until(False)
end.
It has a timer so you can see how long it takes to find for all of those texts.
Remember to put your Player name in, or it will answer to your own messages.
You can add your own text into it, its really easy!!!
This auto responder would be a very usefull for antiban!
CHANGE ALL 415'S TO 412!