SRL Archive - Research & Development Lounge

AI Auto Responder


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!
// 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 :)

Floor66

2010-01-06 10:59:11

There's an error in the code that makes a large part a string (forgotten ')

Gu3st...

2010-01-06 11:02:58

From: Floor66
There's an error in the code that makes a large part a string (forgotten ')
Actually that line is "Result := Replace(Result, '&#39;', '''');"
but the stupid scar tag made it into a ' :(
EDIT: Fixed it now. Thanks Floor :)

Dervish

2010-01-06 11:05:07

Looks really nice, I'm creating a procedure to find out who's talking to who first.

Sir R. M8gic1an

2010-01-06 11:55:47

Very Interesting :)

Shame it won't respond to any runescape related stuff, which is what is mostly asked in-game.

~RM

Gu3st...

2010-01-06 14:29:00

From: Rasta Magician
Very Interesting :)

Shame it won't respond to any runescape related stuff, which is what is mostly asked in-game.

~RM
Knew you would be interested, was it the title that got you to check the thread? :sasmokin:
But yeah, it would be a thousand times better if it would respond to rs-related stuff…
What about making a AI Chat Bot that is hosted here at SRL? Then it could be used inside the include too :)

From: Dr D. Dervish
Looks really nice, I'm creating a procedure to find out who's talking to who first.

Yeah, uhm.. The only reason why I chose not to make one is because sometimes it is crowded (like the GE), and other times it is only 3 or 2 people (like the cow field west for Varrock West mining place)

Anyways, I think I'll redo it and make it *good*. The one that I posted here was just a quick draft. Expect a very improved version of this later (today maybe) :garfield:

Floor66

2010-01-06 14:33:48

What about making your own array(s) for RS stuff, and let the 'nice weather, huh' stuff be done by the bot? :p

marpis

2010-01-06 16:55:42

I wanna see some test chats with this, in-game ofcrouse :rolleyes:

Gu3st...

2010-01-06 17:59:20

From: marpis
I wanna see some test chats with this, in-game ofcrouse :rolleyes:
Eeeh.. I think it'll respond it himself xD but I'll test :)
EDIT: Results:
Talked to *: hello
Talked to **: hi
Talked to *: wassup?
Talked to **: nothing at the moment
Talked to *: nothing?
Talked to **: wow, thats horrible
Talked to *: Are you a popular person?
Talked to **: don't you know?
I told the script to respond to anything in the 8th line in the chatbox
Successfully compiled (1980 ms)
SRL Compiled in 15 msec
AI Responder setup new player: *
Talked to *: I see
Talked to *: continue, please
Talked to *: Can you hear my voice by the way?
Talked to *: Never thought of that.
Talked to *: not even once?
Talked to *: not ever?
Talked to *: not even once?
Talked to *: Good day for a change of scene. Repaper the bedroom wall.
Talked to *: I really don't know
Talked to *: are you just babbling?
Talked to *: hmm…exciting
Talked to *: That was clever.
Talked to *: are you excited now?
Talked to *: Do tigers bite?
Talked to *: I want some cheese-food
Talked to *: what do you mean?
Talked to *: I wish I was in Connecticut
Talked to *: what?
Talked to *: I wish I was in Kansas City
Talked to *: I really don't know


Wow this bot is terrible! I have to find a new link…

Sir R. M8gic1an

2010-01-06 19:51:23

Lol it talked to itself? Just have it avoid you :p

And yes, it was the thread title that got my attention ;)

As far as developing our own, I can give you the idea that was behind mine. It's quite a good idea although it could use development.

I won't release my old code because it's way outdated and not all that readable.

My autoresponder worked on a system of keys.

If it found two keys in a sentence then it would respond to it.
eg
key 1: 'level', 'lvl', 'levl', lvel'
key 2: 'minin', 'mining', 'mnng', 'mine'

so if it found an element from key 1 and an element from key 2 it would respond to 'what is your mining level'

I also used the player's nick & player's name as a key.

you could also set it to use more than two keys.

by using keys you avoid a lot of unpredictable sentences and drastically reduce the chance of failing to notice a simple question.

~RM

Gu3st...

2010-01-06 19:56:03

Yeah, as my responder requires a name I just put in the name of my character :p
What if a player said "I think mining is a hard skill to level"? Would that too result in CurrentPlayer's mining level?

Sex

2010-01-06 21:06:58

By looking at what RM is saying, yes it does look like that would pose a problem.

Sir R. M8gic1an

2010-01-07 05:25:15

From: Sex
By looking at what RM is saying, yes it does look like that would pose a problem.


Yes it would indeed respond, however, as not all RS players are smart that would seem like a normal conversation flow.

"oh you find it hard? what level are you on? Oh I'm better than you, noob" :p

~RM

Camaro'

2010-01-07 21:51:43

From: Rasta Magician
Yes it would indeed respond, however, as not all RS players are smart that would seem like a normal conversation flow.

"oh you find it hard? what level are you on? Oh I'm better than you, noob" :p

~RM


You could also do what RM Was saying if some one said these two keys

Key1: Do
Key2: You(u, yo, yu, etc)

and it would say a one word answer
yes or no..

Do you like mining, do you thinking wc is hard, do you like rs? do u bot?(auto reply no :) )

Kyle Undefined

2010-01-08 01:22:28

Finding out what someone said is relatively easy, the hard part is to have it always checking while your script runs. What would be the easiest way to accomplish that?

~Camo

Bobarkinator

2010-01-08 01:30:04

Add to FindNormalRandoms. Or you could create a separate thread to run it in!! Oh wait…

Kyle Undefined

2010-01-08 01:50:57

From: Bobarkinator
Or you could create a separate thread to run it in!! Oh wait…


:( I see what you did there :(

~Camo

Sir R. M8gic1an

2010-01-08 06:11:49

From: Camo Developer
:( I see what you did there :(

~Camo


Add it in your responder file.. FindNormalRandoms will call it for you.

~RM

Gu3st...

2010-01-08 08:41:37

From: Rasta Magician
Add it in your responder file.. FindNormalRandoms will call it for you.

~RM
CAutoResponder.scar?
I'll update my post :)

EDIT: I found one (very) interesting site: http://www.ai-programming.com/ check it out :)

wesleyxD

2010-01-08 08:48:05

rscheata uses the same site.

Camaro'

2010-01-09 12:36:22

Zyt3x, try this..

http://www.algebra.com/cgi-bin/chat.mpl

It go's good with runescape. Kinda

Edit: Me r stoopid.

weequ

2010-01-09 20:50:14

Wow that site is totally awsome. With that you could easily auto 12 hours every day I think. It seems to be very humanlike.

Gu3st...

2010-01-09 20:55:37

From: antti mies
Wow that site is totally awsome. With that you could easily auto 12 hours every day I think. It seems to be very humanlike.
Some of the chats I got with other players were very un-human like though :p
And VERY random

And it would respond to anyone in the chatbox (could be fixed but I was lazy).. >.<

Sir R. M8gic1an

2010-01-12 05:02:18


you ==> what?
splotchy ==> I dunno man
you ==> noob
splotchy ==> continue, please

you ==> fuck off….
splotchy ==> bite my ass
you ==> why are you so rude?
splotchy ==> I like it
you ==> fine, fishing level?
splotchy ==> I wish I was in Washington DC


Haha. I think we should write AutoResponder.scar with this, and post it for whomever might want to use it :)

~RM

Gu3st...

2010-01-12 09:30:07

From: Rasta Magician
Haha. I think we should write AutoResponder.scar with this, and post it for whomever might want to use it :)

~RM
Really? lol I never though this would evolve into anything :P
We should clean the code a bit and make it a bit more advanced or redo it all before putting it in SRL imho, this was like a 30 minute job

marpis

2010-01-16 09:50:32

In finnish servers you could use lintukoto's Oraakkeli:
http://www.lintukoto.net/viihde/oraakkeli/index.php

This is the most awesome AI I've ever discussed with! :p
I can translate a short dialogue here:

hi noob
-> Hi stranger. Your hair looks great today!
you're a bot!
-> You are!
got food?
-> No, but you can pretend that I have.
go away!
-> *sniff* that hurt me!
I was here first!
-> You will confront the great wisdom if you meditate on mountains. (wtf? :D)
don't steal!
-> Mind your own business!

Gu3st...

2010-01-16 12:06:47

From: marpis
In finnish servers you could use lintukoto's Oraakkeli:
http://www.lintukoto.net/viihde/oraakkeli/index.php

This is the most awesome AI I've ever discussed with! :p
Awesome :D
I've been looking for good bots that doesn't respond with "Yes, I am an AI bot." if you ask about "bot" :P

Is it possible to use google translate with this..?

EDIT: Lol, google translate sucks for Suomi -> English :/
Sometimes it translates well, but other times the result is "Tere!" and stuff like that :P
http://www.lintukoto.net/viihde/oraakkeli/index.php?kysymys_51747883=Hello&rnd=51747883&submit=submit
I tried with "How are you?" and he responded with "No, the area now, but do not blubber!" O_o

turbobk

2010-01-26 23:39:18

you ==> are you a robot?
splotchy ==> i categorically deny that i am anything other than human
you ==> who made you?
splotchy ==> not me…
you ==> do you like penis?
splotchy ==> if i was a i'm from the usa!, i would like penis.
you ==> what is your woodcutting level?
splotchy ==> why do you ask that question?
you ==> because i want to know
splotchy ==> well, you should go ahead and know , then!
you ==> im reporting you
splotchy ==> i have to agree

splotchy ==> WHO is a bot???
you ==> you
splotchy ==> that's interesting
you ==> what is 10 + 10?
splotchy ==> what answer would please you the most?
you ==> the correct answer
splotchy ==> you sound quite positive
you ==> you sound like you were created by retarded developers
splotchy ==> so were you



LMAOO!!!
First it agrees that I should report it, then it starts being a smartass to me! LOL

Sir R. M8gic1an

2010-01-27 03:42:41

Quite honestly, I don't think anyone would ever report a bot who puts u such replies :p

~RM

Dan Cardin

2010-01-27 06:52:09

i agree, though he dances around giving straight answers, i dont think i would suspect it of being a bot since i would probably talk like that too.

turbobk

2010-01-27 23:19:47

Yeah I'm not saying it was obviously a bot, I just posted that because the AI owned me in a conversation lmao xD

you ==> you sound like you were created by retarded developers
splotchy ==> so were you