Welcome to Synthiam!

The easiest way to program the most powerful robots. Use technologies by leading industry experts. ARC is a free-to-use robot programming software that makes servo automation, computer vision, autonomous navigation, and artificial intelligence easy.

Get Started
Asked — Edited

Help With Error On $Botresponse Aiml

Quick question as I am editing the settings file for the AIML Bot plug in. I got a clean set up with just the AIML Bot plug in. Mostly works just fine, but on occasion I get a correct $BotResponse that is not spoken, with an error message. Can anyone tell me whats happening.

Again correct response is given, just wont speak the response do to error?!

User-inserted image


Upgrade to ARC Pro

Experience the latest features and updates. You'll have everything that is needed to unleash your robot's potential.


I believe the plugin needs to strip some characters to avoid get stuck in the ARC's regular expressions.

I just added the AIM bot (no changes)

And i asked the question "favorite movie?"

User-inserted image

I tried to process the $BotResponse in a EZ-Script script and i get similar errors.
No problem, maybe someone else will chime in.

I didn't alter any of the response files, only the settings config file.

I havé Hadrien the same problèmes in my synbot plugin and have add a filterîng code in the plugin
ptp, is it new lines in the source files? It looks like some number of characters in the screenshot. I've been out at a conference all day and traveling - I'll take a peek now that i'm back at my hotel
United Kingdom
I noticed these similar errors as well on certain bot responses. Like Will said, the bots response will show up in the text response window, but not spoken using either Say() or SayEZB() and shows an error in the ARC debug window. Do you also notice the large spaces in the sentence of the bots response that is NOT spoken (look for n post #6). A spoken response will not have this large space and a response that is not spoken with a debug message, will.

After some troubleshooting, I did find one possible cause in some of the AIML files. Don’t quote me on the exact tags as I’m not near a computer right now, but It had something to do with a bots template response that contained < Set > < Name > or < Topic > tags. The tags actually fit in the large spaces in the sentence of the bots response I mentioned above. It’s essentially giving two responses in one sentence, the first half of the sentence, then the topic which contains and redirects to the second part of the sentence, and I think there in lays the problem.

User-inserted image

Example: First part of the response...

My favourite movie is 2001 a space Odyssey.

Then the topic tags that sets the movie name, followed by the second part of the response (look in the AIML response window in post #6, you will see the large space between the above response and the one below), ...

Have you seen 2001 a space Odyssey?

What I tried on one response that gave a debug error, was to delete the above Name, Set and Topic tags and left just the Category, Pattern and template tags with the original user question and slight change to the bots template answer as I removed the set topic for the movie name, so instead of Have you seen 2001?, I put Have you seen it?. Saved the edited file, reloaded it in the AIML control and this actually did stop the debug error and the response was spoken. Did this on a couple more responses with the same results. Not an ideal fix but good for trial and error as I got a result and hopefully will help with finding a solution.

I had the error pop up with favourite movie, fav band and fav song. I’m still going through this and when I’m by a computer tomorrow, I’ll see if I can find the exact AIML tags that throws the error up and let you guys know. Hope what I have posted so far is of some help.

@Steve G:
The problem is related to the linefeed character 0x0A.

A temporary fix script:

create a file "fix_linefeed.vbs" paste the following content/script:


Option Explicit


Sub Main
Dim Path
Dim FileName
Dim Files

Path = "C:\Users\Public\Documents\EZ-Builder\Plugins\aa184830-399a-4716-bdfc-e766fd792a51\aiml\*.aiml"
Files = ListDir(Path )
If UBound(Files ) = -1 then
WScript.Echo "No aiml files found."
For Each FileName In Files
WScript.Echo FileName
FixLineFeed(FileName )
End If

Path = "C:\Users\Public\Documents\EZ-Builder\Plugins\aa184830-399a-4716-bdfc-e766fd792a51\config\*.xml"
Files = ListDir(Path )
If UBound(Files ) = -1 then
WScript.Echo "No xml files found."
For Each FileName In Files
WScript.Echo FileName
FixLineFeed(FileName )
End If
End Sub

Public Sub FixLineFeed(ByVal FileName )
Const ForReading = 1, ForWriting = 2
Dim fs, txt, contents

Set fs = CreateObject("Scripting.FileSystemObject" )
Set txt = fs.OpenTextFile(FileName, ForReading )
contents = txt.ReadAll

contents = Replace(contents, vbCr & vbLf, "[CR-LF]" )
contents = Replace(contents, vbLf, "[CR-LF]" )
contents = Replace(contents, vbCr, "[CR-LF]" )
contents = Replace(contents, "[CR-LF]", vbCR & vbLf )

Set txt = fs.OpenTextFile(FileName, ForWriting )
txt.Write contents
End Sub

Public Function ListDir (ByVal Path )
Dim fso: Set fso = CreateObject("Scripting.FileSystemObject" )
If Path = "" then Path = "*.*"
Dim Parent, Filter
if fso.FolderExists(Path ) then ' Path is a directory
Parent = Path
Filter = "*"
Parent = fso.GetParentFolderName(Path )
If Parent = "" Then If Right(Path,1 ) = ":" Then Parent = Path: Else Parent = "."
Filter = fso.GetFileName(Path )
If Filter = "" Then Filter = "*"
End If
ReDim a(10 )
Dim n: n = 0
Dim Folder: Set Folder = fso.GetFolder(Parent )
Dim Files: Set Files = Folder.Files
Dim File
For Each File In Files
If CompareFileName(File.Name,Filter ) Then
If n > UBound(a ) Then ReDim Preserve a(n*2 )
a(n ) = File.Path
n = n + 1
End If
ReDim Preserve a(n-1 )
ListDir = a
End Function

Private Function CompareFileName (ByVal Name, ByVal Filter ) ' (recursive )
CompareFileName = False
Dim np, fp: np = 1: fp = 1
If fp > Len(Filter ) Then CompareFileName = np > len(name ): Exit Function
If Mid(Filter,fp ) = ".*" Then ' special case: ".*" at end of filter
If np > Len(Name ) Then CompareFileName = True: Exit Function
End If
If Mid(Filter,fp ) = "." Then ' special case: "." at end of filter
CompareFileName = np > Len(Name ): Exit Function
End If
Dim fc: fc = Mid(Filter,fp,1 ): fp = fp + 1
Select Case fc
Case "*"
CompareFileName = CompareFileName2(name,np,filter,fp )
Exit Function
Case "?"
If np <= Len(Name ) And Mid(Name,np,1 ) <> "." Then np = np + 1
Case Else
If np > Len(Name ) Then Exit Function
Dim nc: nc = Mid(Name,np,1 ): np = np + 1
If Strcomp(fc,nc,vbTextCompare )<>0 Then Exit Function
End Select
End Function

Private Function CompareFileName2 (ByVal Name, ByVal np0, ByVal Filter, ByVal fp0 )
Dim fp: fp = fp0
Dim fc2
Do ' skip over "*" and "?" characters in filter
If fp > Len(Filter ) Then CompareFileName2 = True: Exit Function
fc2 = Mid(Filter,fp,1 ): fp = fp + 1
If fc2 <> "*" And fc2 <> "?" Then Exit Do
If fc2 = "." Then
If Mid(Filter,fp ) = "*" Then ' special case: ".*" at end of filter
CompareFileName2 = True: Exit Function
End If
If fp > Len(Filter ) Then ' special case: "." at end of filter
CompareFileName2 = InStr(np0,Name,"." ) = 0: Exit Function
End If
End If
Dim np
For np = np0 To Len(Name )
Dim nc: nc = Mid(Name,np,1 )
If StrComp(fc2,nc,vbTextCompare )=0 Then
If CompareFileName(Mid(Name,np+1 ),Mid(Filter,fp ) ) Then
CompareFileName2 = True: Exit Function
End If
End If
CompareFileName2 = False
End Function

then execute:


cscript fix_linefeed.vbs

and the problem is gone.

PS: No harm is done, if you run multiple times the script.
new plugin is updated to work now without being affected by line feeds
Thanks, really important this works in my meeting.
United Kingdom
Thanks for finding the error ptp and for the update DJ.

There is something about updating the AIMLBot plug in that people should be aware of.... after the hours and hours of AIML file editing I have put in to my project over the past couple of weeks, updating the plug in has now replaced all of my edited Config settings and more to the point, ALL of my edited AIML files with the default files, so all my changes have now been over written and lost and I will have to start again from scratch. *mad*

So if like me you have spent a looong time editing to make lots of changes to personalise your AIML files... make sure you do a back up of your edited AIML and Config folders before carrying out any future AIMLBot plug in updates until a solution is found, so you don't lose all of your work.
@DJ, if we update AIML files in the plugin folder, will plugin updates blow out our file edits? Or potentially blow them out?

Which I guess after reading SteveG last post, actually relates to his post.
Yes it’ll overwrite. I’ll think of a solution
@DJ, thank you! I don't say it often enough, but you are awesome! The tools you've brought to the community are amazing! And AIMLBot was a fantastic idea, thank you, thank you for doing that DJ!
I had same issue. But now working on a complete copies of the files in case it happens again. Maybe its opening and pointing the plug to the folder of aiml files you want to use. For me I have one set for ALAN and one set for Alena and a set of unaltered originals.
Can you use aimlbot fully offline with speech recognition?
Not without entering a lot of pre determined phrases. I can modify it to use the internal speech recognition engine without pre defined phrases, but accuracy is terrible lol
@dj Sures
    Being able to have a robot offline (like in a public place with no internet) and still able to understand (built-in or using your plugin) and respond (AIML) would be awesome. Sorry @fxrtst not trying to hijack your thread. :):)
#23   — Edited
I'd second that. Even with poor accuracy it would be nice to have as a backup if you are someplace with no internet and bad cell reception.