Author Topic: Random Number Generation for LCB  (Read 2220 times)

0 Members and 1 Guest are viewing this topic.

Akash

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
    • View Profile
Random Number Generation for LCB
« on: December 27, 2014, 10:23:28 PM »
Random Number Generation logic is something I could not find in VC.
May be I have not explored it fully being new to this tool.
The reason I need Random Number Generator (RNG) is to have VC respond to the user in various ways for the same event/trigger/command.
For example, if you say "Thank You", it would be nice to hear "Welcome", but very soon it would feel monotonous.
I was thinking about putting a list of responses together so that VC can pick a random response when somebody says Thank You.
The list would have responses like...
1) Welcome
2) You're Welcome
3) My Pleasure
4) Oh, don't even mention it
5) For sure
and so on ....

If there already a way to pickup a response randomly then please educate me and that would be great, but if not then RNG will help picking a response randomly and make VC responses more natural.
Just a thought.


Thanks & Regards,
Akash

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: Random Number Generation for LCB
« Reply #1 on: December 28, 2014, 12:28:25 AM »
you can read your responses from a map or payload file ... phrases separated by a comma, or you can hard code responses using | as a separator ... search the forums and you will find many examples ...

you can start with http://voxcommando.com/forum/index.php?topic=776.msg7742#msg7742 ...

from that thread you can try this
TTS.SpeakSync   response 1 | response 2 | response 3

if you need mathematical random number you can get it through python py.execstring

finally maybe the more experienced people have better suggestions ...
 
When Voice command gets tough, use hand gestures

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2009
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Random Number Generation for LCB
« Reply #2 on: December 28, 2014, 12:00:42 PM »
Thanks Haddood!  ::bow

Those are all good solutions --> "|" between TTS phrases, or PayloadXML.GetRandomP if you want to draw on a very long list, or PayloadXML.GetPhrase, with the 3rd parameter set to "Random".

Apart from searching via Google or on the forum, two wiki pages well worth keeping as a ready reference are the Actions page, and the Variables page.

http://voxcommando.com/mediawiki/index.php?title=Actions#GetPhrase

http://voxcommando.com/mediawiki/index.php?title=Variables

Of course, in this case, where we want TTS-related actions, it also makes sense to look at the actions for the TTS plugin.

http://voxcommando.com/mediawiki/index.php?title=Plugin_TTS#Speak

if you need mathematical random number you can get it through python py.execstring

It's generally not necessary to use Python just to generate a random number. We have the variable {Rnd.#.#} in VC that does exactly this. http://voxcommando.com/mediawiki/index.php?title=Variables#.7BRnd.1.10.7D

In other words, there are usually several ways to do things in VC. Because of this, it can take a while to become familiar with the program. So many options!
« Last Edit: December 28, 2014, 02:57:20 PM by nime5ter »
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: Random Number Generation for LCB
« Reply #3 on: December 29, 2014, 08:18:40 AM »

It's generally not necessary to use Python just to generate a random number. We have the variable {Rnd.#.#} in VC that does exactly this. http://voxcommando.com/mediawiki/index.php?title=Variables#.7BRnd.1.10.7D


missed that  :bonk :bonk :bonk
When Voice command gets tough, use hand gestures