Saturday, May 31, 2008

Actionscript 3 Pandorabot Chat Class

Pandorabots has an XML-RPC interface that allows botmasters to link the A.I. chat bot to third party applications such as SMS, Second Life and Flash. Flash James Durrant, released a free script to integrate Pandorabots with Flash Actionscript 2. Now with Actionscript 3 becoming so widely adopted, another programmer, Marcus Dickinson, has updated Jamie's old Flash Chat interface into something more current.

Marcus announced these new features in his AS3 script:

One line implementation - You can get a basic Flash Chat Pandorabot going by filling in the "yourbotid" and "Common Bot Name" arguments in this one line of code:

var botChat:Chat = new Chat("yourbotid","Common Bot Name",stage.stageWidth/2,stage.stageHeight/1.3, 85, false);

Drag - The topbar is draggable like any other application window.

Close Button - Want users to stay on your site but able to turn the chatbot off? There's a handy close button for that.

Typing Speed - A simple variable (85 up above), that controls the typing speed of your robot. Want it to respond more slowly or quickly? Adjust that. Anyway, there are a lot more subtle things in the class as well, and I hope you enjoy it.

You can download the necessary files at

Finally, Marcus says, "Help me get my own Superbot, make a paypal donation to"

Wednesday, May 28, 2008

Program E Bug Fix

This is the fix we found for the bug we reported in Program E.

I am working with a developer who knows PHP well but not too much AIML. I know AIML but not much PHP. He found something in the code that apparently fixes the bug, at least in the tests we have done. I don't know if anyone is officially maintaining Program E at the moment, but anyone working with the code may be able to check this solution.

By the way, we are using version 0.8 of Program E.

Here is what he said:

Dr. Wallace, this is piece of code which was changed by me. The only line I added is highlighted below.

This code is executed when no match is found by the “graphwalker”.

As graphwalker searches for matches it adds words matched by the “*” wildcard to $inputstarvals.

But when it reaches it the end of the input and finds no matches it should clear $inputstarvals reference and return back to the root of the tree.

// Else no match found...

if ((($whichresult[0]==-1)&&($whichresult[1]==-1)&&($whichresult[2]==-1))||($continuenode==1)) {

//If we were most recently on a wildcard (*,_) then we are still matching it.

if (($onwild==1)&&($word!="")&&($word!="")&&($word!="")){

debugger("On wild and in *. keep going with graphwalker.",2);


return graphwalker($remains,$parent,1,1,$parton,$inputstarvals,$thatstarvals,$topicstarvals,$patternmatched);


else {
//We didn't find anything. We need to come back out


debugger("Result is blank from query in *. Returning blank",2);

return "";



Attached is the latest (Program E 0.9) version of this script. We use version is 0.8. This code should work the same way in the latest version. Changes which were introduced between 0.8 and 0.9 are not related to this piece of code.

Program E Bug

We found a bug in the Program E AIML interpreter and discovered a possible workaround. This post describes the bug; we will publish the solution in a subsequent post.

Suppose you create a simple default category:

<template>Keywords: <star/></star>

Assuming there is no other AIML, this category will just echo
whatever you type:

Client: Hello there
Bot: Keywords: Hello there
Client: testing one two three
Bot: Keywords: testing one two three

Now add a second AIML category,

<pattern>_ TEST ME *</pattern>
<template><srai>TEST ME</srai></template>

We get the expected result:

Client: xxx test me xxx
Bot: Keywords: TEST ME

Ok, finally, add one more category:

<pattern>TEST * ME</pattern>
<template>TEST ME</srai></template>

Now it is messed up:

Client: test xxx me
Bot: ME

What happened to the "TEST"?
and even the one that worked before is broken:

Client: xxx test me xxx
Bot: ME

If we copy the same AIML test file over to Pandorabots:

Client: test xxx me
Client: xxx test me xxx

blogger templates | Make Money Online