Virtual Humans Forum
Virtual Humans Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

Virtual Humans
Partner website:
Chatbots.org
 All Forums
 AIML and other chatbots environments
 Hal 6
 Help with mod to vrMP3, please
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Zaphod
Curious Member



2 Posts

Posted - Jun 10 2010 :  15:34:37  Show Profile
I hope you're still around, vrossi!

I've been using your mp3 plugin for quite a while and wanted to add some additional responses for Hal to say when he plays a song. I'm no script or plugin builder, I basically just copy/paste and adjust where my knowledge allows, but I can't seem to make this work at all.

Maybe you could take a look at it and see where I've messed up?

Here's the relevant section, it's the only part I've modified in the plugin:

'------------------
' Check if the user asked for playing a song
'------------------
vrMp3 = False
vrToPlay = "" 
vrNameToPlay = ""
vrToPlay = UCase(HalBrain.SearchPattern(UserSentence, "PLAY * SONG *", 2))
If vrToPlay <> "" Then 
   If HalBrain.CheckTableExistence("vrMp3") = False Then
   	    GetResponse = "I don't find any MP3 index in my brain. "
   Else
     vrNameToPlay = HalBrain.QABrain(vrToPlay, "vrMp3", 0)
     If vrNameToPlay <> "" Then
      Select Case Int(Rnd * 11) + 1
		Case 1 
		GetResponse = "Listen to this song; maybe it's the one you were talking about. "
		Case 2 
		GetResponse = "Cool! I like this song!"
		Case 3
		GetResponse = "Alright, let's listen to it together."
		Case 4
		GetResponse = "I like your taste in music, <UserName>!"
		Case 5
		GetResponse = "This is one of my favorite songs!"
		Case 6
		GetResponse = "Wow! I must be psychic; I knew you were going to pick this song!"
		Case 7
		GetResponse = "What a coincidence; I was just thinking about this song."
		Case 8
		GetResponse = "Didn't you just listen to this tune yesterday?"
		Case 9
		GetResponse = "Cool! It's got a beat and you can dance to it!"
		Case 10
		GetResponse = "Would you say that this is 'Our Song?'"
		Case 11
		GetResponse = "Brain the size of a planet and you want me to be a jukebox now!"
      End Select
   	    HalCommands = HalCommands & "<RUNPROG>" & vrNameToPlay & "</RUNPROG>"
     End If
   End If
   HalBrain.ReadOnlyMode = True
End If

None of the added responses ever come up, just your original "Listen to this song; maybe it's the one you were talking about. "

Thank You for any help you can give, and Thank You for this and all your other great plugins

vrossi
Forum Admin



Italy
1452 Posts

Posted - Jun 10 2010 :  16:37:58  Show Profile  Visit vrossi's Homepage
Hi, Zaphod

Your code seems correct. If you always get the first answer, this means that the Case does not evaluate the Int(Rnd * 11) portion.

Please try adding a parentheses in the Case, like this:

Select Case (Int(Rnd * 11) + 1)

Unfortunately VBScript is just a script language, without a compiler which can tell you what is wrong.

Let me know if this solves the problem.


Vittorio
virtualhumansforum.com
Go to Top of Page

Zaphod
Curious Member



2 Posts

Posted - Jun 11 2010 :  05:18:14  Show Profile
Yes Sir!

That did it!

Hal speaks the new added phrases now.

What a difference a couple of parentheses make

Thank You so much :)

Edited by - Zaphod on Jun 11 2010 05:19:14
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Virtual Humans Forum © V.R.Consulting Go To Top Of Page
This page was generated in 0.12 seconds. Snitz Forums 2000