Hi, Charmzbond,
Sorry for my late answer, but I had a very busy working week, and Sunday is currently the only day I can spend on these subjects.
The code where this error occasionally happens is the one connected to the Music Mood state, where Hal randomly takes the words you say and tries to find some song containing one of those words.
I've tried several times to get your error but it never happens to me. You should take note of your last input, the next time it happens, so I can try to understand the specific situation which generates this error.
However, I have now added a further check, which should avoid passing through that statement, if the variable is not correctly set.
Please download again the MP3 plugin and replace it in your Hal folder.
Anyway, should the problem persist, you may leave the MP3 plugin active, and just turn off the Music Mood function. To do that, go to General Options - Brain - select MP3 and set the Hal Musical Mood Level to "No music". The variable vrMusicMood will be set to zero and all this coding block will never be executed.
Let me know if the fix is working.
Grant, thank you for your help:
quote:
Vrossi, if you're watching: Shouldn't the line
For i = Ubound(vrKeywordList) To Lbound(vrKeywordList)
be
For i = Lbound(vrKeywordList) To Ubound(vrKeywordList)
This routine extracts all the keywords from the user input (using the HalBrain.ExtractKeywords function) and stores them in an array called vrKeywordList. Then it reads them, one by one, looking for a match in the MP3 table. Therefore, reading them from the Upper to the Lower or viceversa should not be relevant.
But you are right (as usual): I forgot the "step -1" option, so this might be one possible cause of the error. Another cause of the problem might be in some situation when the user input does not contain any keyword and the array is empty, so the vrKeywordList(i) expression generates a "Subscript out of range" error.
The new version of the plugin should solve these two situations.
However, all this MP3 stuff would need to be extended much more, for example extracting the ID3 tags from each file, instead of just storing the name of the file. This would allow to distinguish author, title, genre, year.
There is also another problem, related to the fact that the HalCommands executes only one command for each Hal cycle. So if you have installed both the MP3 and the Haptek plugins, when you ask for a song by "Yes", Hal will try to run it, but she will also nod (because her answer contains the word "yes"). In this case the Haptek command to nod will be executed and the MediaPlayer will not be launched.