Announcement

Collapse
No announcement yet.

Dynamic VR

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Dynamic VR

    Hi Spud, all,

    I'm looking to do something akin to the HS built-in functionality of building media VR statements from existing media. My scope is small: I only care about Pandora stations.

    To do this, I'd need to gather a list of Pandora stations programmatically. Check.

    Then use a simple String.Format to build a VR statement. Check.

    Then modify a trigger on a new or existing event. Impossible.

    This may have been possible via script in HS2 when we had access to the EventClass object, but it doesn't seem possible now. The only triggers we can create programmatically are time-based triggers.

    So, I'm looking for any ideas out there. Spud, in the plugin SDK world, do you have access to the EventClass object, or the ability to alter the trigger of a new or existing event?

    Does anyone have any other ideas about how to do this? Again, I just want to create/alter an event with a single trigger: Kinect "a phrase was recognized" - the text of that phrase.

    Thanks!!

    FYI the Kinect plugin rocks and has restored my faith in HS VR.

    hjk
    ---

    #2
    I don't think there is a way to dynamically modify a trigger right now. And even if you could do it, you would need a way to tell the Kinect plugin to parse the triggers and rebuild the grammar accordingly, which right now is impossible unless you restart the plugin or modify manually one trigger.

    So what I would suggest is:
    1. We use global variables and leverage HS replacement variable feature to create dynamic trigger. For example in the "a phrase was recognized" trigger you could set something like:
    Code:
    Play $$GLOBALVAR:pandora_stations:
    Then from a script you would set the pandora_stations global variable to what you want (for example <station one|station two|station three>)

    2. I would add a function available from scripting to reload the kinect grammar that you would call everytime you change one global variable used in a trigger.

    Both 1 and 2 need the Kinect plugin to be modified, so if you agree with this roadmap, I will add those 2 features to my TODO list.
    Last edited by spud; March 3, 2015, 02:46 PM.

    Comment


      #3
      Spud, this is pure genius.

      I appreciate your work on the plugin and adding these enhancements to your list. This is a great workaround and will work perfectly. There are a few other situations I'd also use this for in the same way.

      In fact, I think this works out much more nicely than creating/removing or altering triggers of events.

      Thanks!!

      hjk
      ---

      Comment


        #4
        This is implemented in version 3.0.0.27

        You can now use replacement variables in "A Phrase was Recognized" triggers.
        Click image for larger version

Name:	replacement_variables.jpg
Views:	2
Size:	23.4 KB
ID:	1176605

        it works with global variables as well as all others type of replacement variables supported by HS: http://homeseer.com/support/homeseer..._variables.htm

        A "Rebuild Grammars" action has been added as well as a function available through scripting: RebuildGrammars
        Last edited by spud; March 3, 2015, 08:18 PM.

        Comment


          #5
          Wait I'm not really following this but it looks magical can you give another example on how it would be applied?

          Comment


            #6
            Originally posted by kideon View Post
            Wait I'm not really following this but it looks magical can you give another example on how it would be applied?
            Hey Kideon,

            So, you know how the built-in HS VR does some automatic things (at least in HS2), for example, building VR statements based on the titles of music in your music collection? I was looking for a way to replicate something similar using the Kinect plugin.

            So I wrote a small script to enumerate my Pandora stations, and build a VR string like:
            Play Pandora [station] <station 1|station 2|...>

            Then I tried to mess with an existing event trigger, to alter the Kinect phrase on it. But we don't have access to HS3's EventClass using scripting. So I floated this question to Spud, who came up with a great idea. We can't alter the phrase in an existing event, but we CAN make the phrase dynamic using global variables! So with this new build, we can do this:

            1. Set up an event. I call mine "Kinect VR - Media - Pandora stations". Use a recognition phrase like this: Play Pandora [station] $$GLOBALVARandora_stations:

            2. Set up a Global Variable called "pandora_stations"

            3. Use my script to populate the text of the Global Variable "pandora_stations" with the pipe-separated list of stations: station1|station2|station3

            4. Run my script to populate the stations, then run the "Rebuild Grammars" action of the Kinect plugin. Maybe do this once a day.

            And that's basically it. I haven't tried it all the way through yet, but that's the layout as I understand it. You can use the same technique to do anything like this -- build a set of events that you can dynamically call by voice, things like that.

            Hope that makes sense. It IS magical!

            hjk
            ---

            Comment


              #7
              So how does the script get called?

              Comment


                #8
                Oh I just have it execute on a schedule. Maybe once a day. Rebuild the Pandora stations and populate a global variable, then run "Rebuild Grammars."

                Comment


                  #9
                  Ahh ok I got it so when this play event triggers it calls another script that uses the kinect be syntax to make the branch choice?

                  Comment

                  Working...
                  X