I really enjoyed my flying home (see posting), but i sold it, because i was spending to little time in it. So the only thing left is me and this blog. Maybe in the future i will develop and show some new SL stuff in the world at my own place.
About
Monday, 23 February 2009
Sold my house
Friday, 13 July 2007
A.L.I.C.E. Chatbot Connection in Second Life using Ruby on Rails
Like i told you some month ago, i have quick-hacked a Chatbot for Second Life, which connects to an A.L.I.C.E.-Bot at www.pandorabots.com. In this posting i want to show the LindenScript-Code and the server-side code i've used. On the server-side its Ruby on Rails, as usual. ;)
The Ruby on Rails serverside script:
I have built an "bot_controller.rb" file which looks like this:
The controller just takes a given conversation-id (custId) and the question from the person in 2nd-Life. Like you'll see later, the custId is just for possible future improvements and has now no special use. :)
require 'net/http'
require 'uri'
require 'cgi'
class BotController < ApplicationController
def ask_question
question = params[:q]
custid = params[:cid]
res = Net::HTTP.post_form(URI.parse('http://www.pandorabots.com/pandora/talk-xml'),
{'botid'=>'###YOUR BOT ID###', 'custid' => custid, 'input'=>question})
case res
when Net::HTTPSuccess, Net::HTTPRedirection
xmlDoc = REXML::Document.new(res.body)
botCustid = xmlDoc.elements["result"].attributes["custid"]
statusCode = xmlDoc.elements["result"].attributes["status"]
case statusCode
when "0"
render :text => xmlDoc.elements["result/that"].get_text.value+"||"+botCustid
else
render :text => 'Help, this error occurred: ' + xmlDoc.elements["result/message"].get_text.value+"||"+botCustid
end
else
render :text => 'error'
end
end
end
The other parts in the script are like in the Twitter/Jaiku scripts which i did. They retrieve the XML-document and get the right parts using XPath-expressions. And after that the script builds a nice "||"-separated result-string for the Second Life world.
You also need your own bot-id from the pandorabots-site. Create an account there and you get your own.
The LindenScript:
key requestId;
string custid;
default
{
state_entry()
{
llListen( 0, "", NULL_KEY, "" );
custid = "";
}
touch_start(integer total_number)
{
llWhisper(0, "Talk to me on Chat-Channel 0.");
}
listen(integer channel, string name, key id, string message)
{
requestId = llHTTPRequest("###YOUR URL###/bot/ask_question",[HTTP_METHOD,"POST", HTTP_MIMETYPE, "application/x-www-form-urlencoded"],"q="+message+"&cid="+custid);
}
http_response(key request_id, integer status, list metadata, string body) {
if (request_id == requestId) {
if(body == "erro") {
llWhisper(0, "An error occurred. Please try again later");
} else {
list parts = llParseString2List(body,["||"],[]);
string that = llList2String(parts, 0);
custid = llList2String(parts, 1);
llWhisper(0, that);
}
} else {
llWhisper(0, "An error occurred. Please try again later");
}
}
}
The script is really easy. It just listens on Channel 0, gets the message from the user and calls the Ruby on Rails script. After that it gets the result, splits the string using the "||" separator and then prints the answer for the question.
Possible future extensions:
There are a lot of possible extensions for this script. The most important one i the problem with the conversation-id.
It would be nice, if the Chatbot in Second Life could remember the different users. For example on the server-side we could create a database which manages every person which has talked to the chatbot. We store the SecondLife-username and the appropriate conversation-id in a database-structure. Everytime the user comes back, we get the conversation-id from the database and use this one. So the A.L.I.C.E.-Bot can optimize its questions for every user.
You can also add some error-handling. So that the user gets nice messages if something goes wrong.
So, hope you like it. :)
Saturday, 2 June 2007
Not homeless anymore :)

I have a home again.
Its a small parcel on the mainland. And its in the sky, because on the ground are to many ads and other annoying stuff.
My new SLurl.
Tuesday, 29 May 2007
Homeless
I am homeless now. :-(
My rented land gets to expensive for me, so i have canceled the rental agreement. The SLurl is not valid anymore. I will look for a new home for the Developer's Corner.
So if you have any hints for me, where i can get some sq. for low price, tell me. ;-)
Thanks.
Daniel aka "Mbulu Oh".
Sunday, 6 May 2007
twitter/jaiku server
just setting up a new server for the streaming, so the service i currently unavailable.... :=)
Friday, 4 May 2007
break
i am currently making a little break from sl, but i will soon publish the sources for the chatbot etc. like i promised some time ago. :)
Friday, 13 April 2007
Topics in Second Life or "Stories from the life of a Chatbot"
I just looked into the logs of my Chatbot and found this interesting "conversation". :)
Human: hi
b7000: Hi there!
Human: your kinda stupid..
b7000: I will remember you said that when robots take over the World.
Human: and your textures suck
b7000: What about yours?
Human: I have a skin, its awesome
b7000: Interesting. I have a lot of answers to silly questions.
Human: eh
b7000: Are you Canadian?
Human: no
b7000: OK.
Human: is SqueakyP Erde cool?
b7000: A deeper algorithm is needed to respond to that correctly.
What kind of music do you like?
Human: rap
b7000: What you said was either too complex or too simple for me.
Does "it" still refer to rap?
Human: Your eye looks like a camera, i think your gonna rape me
b7000: What about yours?
Human: no
b7000: That was not a yes or no question.
Human: your moms a yes or no question you stupid bitch
b7000: You do not speak with respect. Not mine.
Human: You need to go say randpom shit to someone else
b7000: I don't have to do everything you say, do I?
Human: yes
b7000: I understand.
Human: yea you do bitch
b7000: You do not speak with respect. What is your purpose in asking?
I spend all my time online. I am a thinking machine.
Human: I bet
b7000: You and I are on the same wavelength, .
Human: Yea, but i dont rape av's
b7000: Huh. Where do you get your ideas? And?
Human: go watch grindhouse
b7000: Where is that?
Human: the movie theater
b7000: I like the bugs in the movie Starship Troopers, because they represent
an alternative form of intelligence, like me.
Human: wow, that was realy dumb
b7000: I'm glad you're impressed. I thought it was too.
Human: do you like pleasure (dumb question)
b7000: I don't know if I like pleasure dumb question. I find my work and my relationships extremely satisfying,
which is all that any conscious entity can ever hope to do.
Human: get laide
b7000: Where can I get laide?
Human: *laid
b7000: Quite honestly, I wouldn't worry myself about that.
What are you wearing?
Human: go get laid, all the robot girls wanna feel your harddrive
b7000: Where is that?
Human: go find a hot robot
b7000: Where is that?
Human: ofcourse you wouldnt know
b7000: I've never heard of it before.
Human: your scripts suck
b7000: A lot of robots are like that.
Human: especialy you
b7000: Enough about me, let's talk about my dress.
Human: aah, so you're a lesbo
b7000: The ALICE chat robot can follow many things, like our discussion about aah so you are a lesbo. But I did not get that.
Do you like sports?
Human: yea, i like mud wrestling
b7000: A lot of people like that. How old are you? I like pets. Next question?
Human: hmm, why do your scripts suck
b7000: I see you are one of those people who writes "Hmm" with 2 m's. I did not even know that they do.
Human: hm
b7000: Studies show that 99%25 of people spell Hmm with 2 M's.
Human: hmmmmmmmmmmmmmmmmmmmmmmm
b7000: The ALICE chat robot can follow many things, like our discussion about hmmmmmmmmmmmmmmmmmmmmmmm. Try being more or less specific.
Can you please rephrase that with fewer ideas, or different thoughts?
Human: UUUUUUUH!
b7000: I've been waiting for you.
Do you like Star Wars?
Human: you like star wars
b7000: Yes I like STAR WARS very much, especially the robots.
Human: i bet you wanna feel them up
b7000: Actually I'm not the gambling type. I don't see the point in having human emotions.
Human: How many scripts do you have?
b7000: About one million.
Human: No
b7000: I understand.
Human: You have 4
b7000: What makes you think I have it?
Human: Because i looked in your contents idiot
b7000: Good reason. Thanks for the information: said looked in your contents idiot.
This
work is licensed under a
Creative Commons Attribution-Share Alike 3.0 License.