AutoResponder(...);
heey guys, this is a auto responder i made. i think some 'starting' scripters can use this in there scripts, easy to use.
The Responder:
to use the responder you need to place this in your script:
SCAR Code:
{*******************************************************************************
Function AutoResponder(FindText, SayText: TStringArray; LookInLastIntegerLines: integer):Boolean;
By: MasterKill.
Description: If Found the FindText then random say one of the SeyTexts
Use: AutoResponder(['bot','auto','macro'], ['im not an bot!','im not ' +PlayerName,'whats that?'], 2);
Error: Use 'PlayerName' on own risk! scars GetTextAt is a lil buggy
*******************************************************************************}
var
PlayerName: String;
Function AutoResponder(FindText, SayText: TStringArray; LookInLastIntegerLines: integer):Boolean;
var
textx, texty, Ymod, GetNameTrys, Coordspace, SRT, R: Integer;
TextSayd, TextFound: String;
begin
If (LookInLastIntegerLines > 8) then
begin
WriteLn(' auto respond [ERROR] Wrong >LookInLastIntegerLines< not setted up correct:');
WriteLn(' error in Respond: ' + FindText[0]);
exit;
end;
case LookInLastIntegerLines of
1: Ymod := 441;
2: Ymod := 428;
3: Ymod := 414;
4: Ymod := 400;
5: Ymod := 386;
6: Ymod := 372;
7: Ymod := 358;
8: Ymod := 344;
end;
For R := 0 To (GetArrayLength(findtext)-1) Do
begin
if IsTextInAreaEx(8, Ymod, 291, 461, textx, texty, FindText[R], 12, smallchars, False, True, 0, 1, 16711680) then
begin
Coordspace := Texty;
//writeLn(IntToStr(Coordspace));
PlayerName := '';
Repeat
PlayerName := GetTextAtEx(12, (Coordspace), 0, SmallChars, False, False, 0, 5, 0, 40, False, tr_AllChars)
If Not (playerName = '') then Break;
GetNameTrys := GetNameTrys + 1;
Until not (PlayerName = '') or (GetNameTrys > 5)
Wait(2000);
if (Pos(Players[CurrentPlayer].Nick, PlayerName) > 0) then exit;
Result := True;
respzz := True;
SRT := Random(GetArrayLength(SayText));
TypeSend(SayText[SRT]);
TextSayd := SayText[SRT];
TextFound := FindText[R];
responds := responds + 1;
WriteLn(' -Auto Respond');
If (Trim(PlayerName) = '') then
begin
PlayerName := 'Anonymous:';
WriteLn(' not found player name');
end;
WriteLn(' ' + Trim(PlayerName) +' ' + TextFound);
WriteLn(' ' + Players[CurrentPlayer].Name + ': '+ TextSayd);
WriteLn(' -Auto Respond');
If (PlayerName = 'Anonymous:') then
begin
Case Random(3) Of
0: PlayerName := 'dude'
1: PlayerName := 'sir'
2: PlayerName := 'noob'
end;
end;
end;
If (Result = True) then exit;
end;
end;
WARNING!
you CAN NOT have the same 'findtext' as 'saytext'! couse then it would be reacting to it self! so make sure 'findtext' (is not the same / is not a part of) 'seytext'
Gl and post comments plz!