Gu3st...
2010-01-06 10:56:37
This AI Auto Responder is using a web-based AI Chat Robot to talk and have conversations with people on RuneScape. :)
It connects to the site "http://www.cooldictionary.com/splotchy.mpl", so this will most likely not going to be added to SRL. You have to allow scar to connect to the site to be able to use this.
You will have to make your own functions that finds out if the player is talking to you or if the player is talking to anyone else, if he IS talking to you then you have to add "AI_SetupNewPlayer" with the name of the player and the text he is saying.
You would want to make own procedures to check if the player is asking about anything RuneScape related, because the bot does not know anything about RuneScape (If you ask him if he plays RuneScape then might respond with something like "I do not play runescape, but the cia does").
This bot can chat to unlimited people, and it will generate a unique ID for each person that is added to the array (using SetupNewPlayer).
using the ID the AI Bot remembers if it has talked to it so if Player is having a conversation with the Bot and then later on the Player says "Hi" to the Bot then the Bot might reply with "Have I talked with you before?".
I do not expect anyone to use this. I made it simply because the fun of it. :redface:
Enjoy!
It connects to the site "http://www.cooldictionary.com/splotchy.mpl", so this will most likely not going to be added to SRL. You have to allow scar to connect to the site to be able to use this.
You will have to make your own functions that finds out if the player is talking to you or if the player is talking to anyone else, if he IS talking to you then you have to add "AI_SetupNewPlayer" with the name of the player and the text he is saying.
You would want to make own procedures to check if the player is asking about anything RuneScape related, because the bot does not know anything about RuneScape (If you ask him if he plays RuneScape then might respond with something like "I do not play runescape, but the cia does").
This bot can chat to unlimited people, and it will generate a unique ID for each person that is added to the array (using SetupNewPlayer).
using the ID the AI Bot remembers if it has talked to it so if Player is having a conversation with the Bot and then later on the Player says "Hi" to the Bot then the Bot might reply with "Have I talked with you before?".
I do not expect anyone to use this. I made it simply because the fun of it. :redface:
Enjoy!
// MADE BY ZYT3X. FEEL FREE TO EDIT, BUT DO NOT COMPLAIN ABOUT IT NOT WORKING IF YOU DO!
type TAIPlayer = record
Name : String;
ID : Extended;
end;
AIBot = record
Players : array of TAIPlayer;
end;
var
AI : AIBot;
AI_Setup : Boolean;
const
//Extendeds
AI_SERVERID = 53455.25645524944;
function AI_GetIDFromName(Name : String): Extended;
var
I, H : Integer;
begin
H := High(AI.Players);
for I := 0 to H do
if AI.Players[I].Name = Name then
Result := AI.Players[I].ID;
end;
function AI_SetupNewPlayer(Name, Input : String): Boolean;
var
I, H : Integer;
E : Extended;
S : String;
begin
Result := False;
if not AI_Setup then Exit;
S := IntToStr(Random(99999) + 1) + '.' + IntToStr(Random(99999) + 1);
try
E := StrToFloat(S);
except
WriteLn(S);
E := 1.1;
end;
H := High(AI.Players);
for I := 0 to H do
begin
if (AI.Players[I].ID = E) then
begin
E := StrToFloat(IntToStr(Random(99999) + 1) + '.' + IntToStr(Random(99999) + 1));
I := 0;
end;
end;
SetLength(AI.Players, H+2);
H := High(AI.Players);
AI.Players[H].Name := Name;
AI.Players[H].ID := E;
Result := True;
end;
function AI_GetOutput(Input : String; ID : Extended) : String;
begin
Result := '';
if not AI_Setup then Exit;
Result := Between('<B>splotchy ==> ', '</B>', GetPage('http://www.cooldictionary.com/splotchy.mpl?input=' + Input + '&session_id=' + FloatToStr(ID) + '&Submit=Submit'));
Result := Replace(Result, '&#' + '39;', '''');
end;
function AI_TalkedToPlayerBefore(Name : String) : Boolean;
var
I, H : Integer;
begin
Result := False;
if not AI_Setup then Exit;
H := High(AI.Players);
for I := 0 to H do
if AI.Players[I].Name = Name then
begin
Result := True;
Exit;
end;
end;
function AI_Respond(Name, Input : String): Boolean;
var
S : String;
E : Extended;
begin
Result := False;
if not AI_Setup then Exit;
if AI_TalkedToPlayerBefore(Name) then
E := AI_GetIDFromName(Name)
else
if not AI_SetupNewPlayer(Name, Input) then
Exit;
S := AI_GetOutput(Input, E);
Result := S <> '';
if Result then
begin
TypeSend(S);
WriteLn('Talked to ' + Name + ': ' + S);
end;
end;
function AI_ResponderIsWorking : Boolean;
begin
Result := AI_GetOutput(' ', AI_SERVERID) <> '';
end;
function SetupAIResponder : Boolean;
begin
SetArrayLength(AI.Players, 1);
Result := AI_ResponderIsWorking;
AI_Setup := Result;
end;Save it as "CAutoResponder.scar" in "SRL/core/" folder. FindNormalRandoms; will call it :)