*PHP (4.0.4 and up)
(If you found this via a google search… Source files for the Flash are at the end of the post…)
Update: For a tutorial, and source code, on integrating Pandorabots with Flash, click here.
This is a concise collection of all the information that’s out there (as far as my research leads me to believe – since I last checked), + some personal trial-error-experimeddling on installing Program’s to host your own ALICE bot.
This also walks you through the basics for building your own Flash interface (for your bot).
My goal was to make a tutorial for people that don’t want to use pandorabots.
I hope to build on this in the near future.
I love playing around with bots, and especially love lurking on lists like Robitron. Projects like ChatScript & RiveScript are excellent ways of tickling the inner geek and keeping you busy in all your free time…
Of course, this completely devastates your social life, but hell… Who needs friends when you can MAKE them. Ha! Pun intended!
Chatbots in games is something that I’m particularly passionate about, and sell everyone on. I’ve successfully incorporated them into a number of my client’s projects. They’ve fit beautifully into these every-time.
Naturally, if you want to see them in action visit Tetrageddon Arcade, or chat with Minibyte on the front page of AlienMelon…
This is going to cover a means of making a Flash based ALICE AIML bot that you can host without pandorabots.
You’ll need a host provider like MediaTemple where you have basic control over your own database, ect…
Now, I know that AIML is not necessarily “the best” solution out there.
There are fucktoneries of technologies/experiments, like Jabberwacky, VoiceXML, ELIZA (of course), IBM’s Watson, the list goes on and on… In terms of authoring, AIML is difficult to look at, BUT it makes the most effective and believable personality I know of… Especially if you don’t have years to develop your own personality.
I turn to it because of all the AIML sets that are so freely available out there, allowing you to quickly and easily customize your own personality… Not because it is necessarily “better”, but because there are so many sets available, you don’t need to spend years on creating something that is somewhat believable.
I terms of “building from the ground up”, I notice users still pick up on the “fakeness” of other bots too easily…
Nevertheless, picking your own solution is for you to decide, besides this is a post about building and hosting your own Flash ALICE bot!
Again, like I said, if you want to see a Flash front-end and AIML back-end in full frontal wackiness (crazy little character) then check out these two examples:
Alienmelon (minibyte, the most popular)
They Came From My Inbox (talk to the spam via the text input field at the bottom of the menu)
INSTALLING THE BOT
Head on down to
And grab yourself a copy of Programe E… That’s their PHP version.
Notice that there are a plethora of other funky awesome implementations there, and that makes things all the more exciting!
Program E is a platform for running artificial intelligence robots written in PHP. It runs bots written in AIML (Artificial Intelligence Markup Language). Custom tags are a feature of AIML engines such as Programe E and it uses MySQL for its database bits and pieces.
You’ll have to know a little thing or two about running sql scripts, which is not hard!
In fact, it can be a lot of fun!
Note that AIML is really easy to understand if you know XML. It basically is a funked up version of XML.
A noteworthy collection of AIML sets are the Annotated A.L.I.C.E. AIML files found here:
On the other hand, if you are crazy enough to start from complete scratch I suggest investigating other solutions.
You’ll also need a noteworthy AIML editor. For most people I suggest just heading down to Pandorabots and using that as a development environment.
They already have something like an “editor” there where you can keep testing & uploading.
Go to “Create a Pandorabot“, there you can also select whatever set you wish…
Create it and then go to “AIML”. You can download sets there as well.
You can do your testing and personality forging there, and then upload the sets to your own server. It’s one good way of having a reliable environment.
Another great desktop editor is the GAITObot AIML editor (Windows only, MAC users must use bootcamp):
It’s another good starting point for learning.
There is also SAE (Simple AIML Editor). It’s Free by Riot Software…
AND AI Dealer…
Pick your point of entry!
Setting up a local testing environment is also something I highly recommend for safety reasons…
I suggest MAMP for that:
It’s for godless MAC users like me.
It’ll simulate Apache, MySQL, and PHP environments.
It works charms and keeps you from making killer mistakes that’ll down all your sites because you’ve accidentally failed to terminate a loop on line 34 and it overloaded the server… or some freak shit like that…
Don’t judge me.
For setting up MAMP wordpress.org has a wonderful walk through:
Installing WordPress Locally On Your Mac With MAMP
And here is another good walkthrough:
Setting Up Your Mac For Local Development Using Coda WordPress Mamp
Either way. This is LOTS OF FUN and IS NOT HARD. :D
If I can do it, a monkey can!
So! After you’ve got all your settings upped, safeties strapped, balls secured, and your copy of Program E downloaded…
1) Create a directory (on your server) called “
programe“. Here is where you’ll install your little robot friend.
Unzip and upload all the Program E files into this directory.
2) Create a database for the program to use in MySQL. Call it something like “
3) Here’s the fun part. In the Program E install you downloaded navigate to:
sql > mysql > db.sql
Open that up. You’ll need to run that script.
If you have phpMyAdmin, then do the following…
Hit the SQL tab at the top:
Paste the contents of “
db.sql” into the “
RUN SQL query / queries on database”
And hit “
Booya! You got bot.
4) By default, AIML files and
startup.xml are in the
aiml directory. Use the
startup.xml file included in the distribution.
DO NOT use the
startup.xml you get with AIML files from alicebot.org. AIML files that work well with Program E can be found at http://sourceforge.net/project/showfiles.php?group_id=43190
Once you’ve got your AIML sets unzip and upload all the files to the AIML directory.
std-65-percent.aiml” & “
You don’t need those.
Booya! Bot got brain.
5) In the “
aiml” directory there is a “
Edit that to fit your bot’s personality. You can also do this later, but this is an important 1st step in forging your own bot.
Note that this is like the Pandorabots “
Same thing… It’s basically predefined character traits (values) that you continuously refer to in the AIML files.
6) Go to “
/src/admin/dbprefs.php“, and edit
dbprefs.php with your database information and aiml directory information.
If you have AIML files in the default directory you don’t have to change that. See
dbprefs.php for other options that can be configured.
The values you need to edit are:
$DB_HOST (database host name)
$DB_UNAME (database username)
$DB_DB (name of the programe database)
For the AIML directory for
$rootdir use the absolute path and include “/”. If this is wrong you may have to revisit this. You’ll get an error, and then you’ll know if you did it wrong. Sorry maaaaan.
For example if you’re on a (mt) gridserver:
src/admin needs to be writable by the web server because
botloader.php will create a file
subs.inc. You can also create an empty
subs.inc file and make that writable.
8) From your site access
To load the AIML into the database. This’ll take a bit so be patient!
On a dual PIII it takes approx. 1 minute for 10,000 categories.
If your PHP is running in safe mode you might need to use
botloaderinc.php to load the AIML files one at a time.
If you experience timeouts then access
Note that whenever you load
botloader.php it DELETES ALL the patterns and templates that you have in your database and then loads/reloads them from the AIML files you have. This is basically how you re-load/update your bot… by accessing that file.
9) Navigate to:
To give it a test ride.
If it talks back, you know you dundidit right!
10) For safety reasons: PASSWORD PROTECT THE ADMIN DIRECTORY WITH A .htaccess FILE SO NO ONE CAN ACCESS THAT DIRECTORY.
Lock it down, or remove it and re-upload later when needed.
11) Finally you’ll need a PHP script for the Flash end of things to access.
aiml/startup.xml there is a bit at the top
< bot id="TestBot" ... >
TestBot” with your bot name first. That’s going to be hardcoded into the following PHP script.
Start a blank .php file then copy & paste the following:
Save that as “
( $_POST ['theinput'] , $myuniqueid, 'TestBot' ); The ‘
TestBot‘ is your bot id. Rename that to the name you chose for your bot. Else your shit wont work for shit.
Done! The non-Flash end is all setup
PROGRAMMING AND CREATING THE FLASH FRONT END
In a new Flash document you’ll need two text fields.
One named “
txt_output” set as a
Dynamic Text field.
One named “
txt_input” set as an
Input Text field.
And the following actions that do something along the lines of…
ACTIONSCRIPT 3.0 would look like:
ACTIONSCRIPT 2.0 version would look like:
You get the idea…
This is a veeeeeery super simple barebones example that really just does the basic sending / receiving of variables.
You can easily take this example and extend it.
Make a class out of it. Have the text write itself out a character at a time, as if the bot is typing to you. Have multiple text fields that connect to multiple bots to create a virtual chatroom. Or have an isometric game where each character is hooked to a bot that you talk to, and they give you information to send you on your quest… You get the idea… Bots are fucking awesome, and this is how simple they are.
Now go and have some creative fun on your great bot master adventures!
(Perl) A text-based scripting language for giving responses to chatterbots.
This one’s worth keeping an eye on.