What is the inbuilt code for searching for an array of texts and then replying one 'item' of another array EG
SCAR Code:FindText1('hey','hi','hello');
ReplyTxt1('hey','hi','hello');
Thanks.
What is the inbuilt code for searching for an array of texts and then replying one 'item' of another array EG
SCAR Code:FindText1('hey','hi','hello');
ReplyTxt1('hey','hi','hello');
Thanks.
InStrArr I think.
Haven't tested this, but it should work -
SCAR Code:program New;
{.include SRL/SRL.scar}
var
StrArr, Search, Reply : TStringArray;
n : integer;
procedure GetChatTexts(var arr:TStringArray);
var
x, y, i: Integer;
textP: TPoint;
chat : string;
begin
SetArrayLength(Arr, 1);
for i := 1 to 8 do
begin
textP := TextCoords(8);
if findcolor(x, y, 16711680, textp.x, textp.y, textp.x + 200, textp.y + 14) then
begin
chat := LowerCase(Trim(GetTextAtEx(x - 3, textp.y - 2, 0, SmallChars, False,
False, -1, 1, 16711680, 60, False, tr_allChars)));
arr[GetArrayLength(arr)-1] := chat;
end;
end;
end;
begin
SetUpSRL;
ActivateClient;
GetChatTexts(StrArr);
for n := 0 to High(StrArr) do
begin
Writeln(StrArr[n]);
end;
Search := ['hi','hey','hello'];
Reply := ['ih','yeh','olleh'];
for n := 0 to High(Search) do
begin
if(InStrArr(Search[n], StrArr, false))then
begin
TypeSend(Reply[n]);
Break;
end;
end;
end.
Will find most recent chats in the chat box, then check if they are the ones you want to reply to, then give the corresponding reply, as mentioned.
I don't understand the question... can you please elaborate?
~ Metagen
I think he means an autoresponder: if you see any of these, reply with one of those.
A G E N T 83, that looks pretty epic
Anyway of turning it into an include and just adding the
Part? Thanks.Search := ['hi','hey','hello'];
Reply := ['ih','yeh','olleh'];
Save this:
SCAR Code:var
StrArr: TStringArray;
n : integer;
procedure GetChatTexts(var arr:TStringArray);
var
x, y, i: Integer;
textP: TPoint;
chat : string;
begin
SetArrayLength(Arr, 1);
for i := 1 to 8 do
begin
textP := TextCoords(8);
if findcolor(x, y, 16711680, textp.x, textp.y, textp.x + 200, textp.y + 14) then
begin
chat := LowerCase(Trim(GetTextAtEx(x - 3, textp.y - 2, 0, SmallChars, False,
False, -1, 1, 16711680, 60, False, tr_allChars)));
arr[GetArrayLength(arr)-1] := chat;
end;
end;
end;
Procedure RespondToChat(Search, Reply : Array of String);
begin
GetChatTexts(StrArr);
for n := 0 to High(StrArr) do
begin
Writeln(StrArr[n]);
end;
Search := ['hi','hey','hello'];
Reply := ['ih','yeh','olleh'];
for n := 0 to High(Search) do
begin
if(InStrArr(Search[n], StrArr, false))then
begin
TypeSend(Reply[n]);
Break;
end;
end;
end;
As Responding.scar. It MUST be saved just inside the Includes folder.
Then do this:
SCAR Code:Program New;
{.include srl/srl.scar}
{.include Responding.scar}
Begin
SetupSrl;
RespondToChat(['Hello', 'Hi', 'Yo'], ['olleH', 'iH', 'oY']);
End.
There are currently 1 users browsing this thread. (0 members and 1 guests)