Author Topic: Text variable as command name  (Read 3245 times)

PsiQss

  • Guest
Text variable as command name
« on: January 31, 2017, 02:20:43 PM »
I've run throught the "Feature Requests" section hoping I'll find this suggestion and any info on the feature, but surprisingly it hasn't been suggested yet.. or I'm simply blind, in which case I'm very sorry.

Well, the title is kind of self explanatory. Would it be possible to put a text variable in the command name? Or is there any workaround for this? What I'm trying to achieve is to execute a function every time someone calls the name of the AI stored in a variable. Putting {TXT:AIName} in the name of command doesn't seem to work ;) Theoretically, I think I could make a command that's called each time something unrecognized is spoken and then compare that with the variable, but there's no way speech recognition is going to catch the right phrase with reasonably high accuracy.

I'm trying to build a profile that will be to great extend customizable by voice commands themselves And being able to call commands by a variable name would be a great feature to have. But I'm probably asking for too much :P


EDIT by Pfeil: Tokens in command names are allowed and parsed, though this is still as experimental feature.
« Last Edit: April 18, 2020, 08:42:09 AM by Pfeil »

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2827
Re: Text variable as command name
« Reply #1 on: January 31, 2017, 02:47:17 PM »
Having commands that have a variable name ('when I say') is not implemented, as VA needs to use the, 'when I say' values to indicate to the speech engine what to expect.

If you want to execute commands (as subcommands) by name and use a token, this can already be done.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4758
  • RTFM
Re: Text variable as command name
« Reply #2 on: January 31, 2017, 03:35:08 PM »
What you could do, if the object is to distribute a profile to users so they can insert their own name, is the following:

Export the profile on your end
Do a find and replace in any text editor for the name you're using, and replace it with something like "YOURNAMEHERE"
Distribute your profile
Before the user imports the profile, have them do a find and replace as well, this time replacing "YOURNAMEHERE" with their preferred input.

If you wanted to partially automate it so users don't have to open their text editor(oh the horror), you could look into using a batch file that prompts them for a name, then replaces all entries.

PsiQss

  • Guest
Re: Text variable as command name
« Reply #3 on: January 31, 2017, 03:52:15 PM »
Thanks for the reply :)

The AIName was just an example, my goal was to be able to change these with a voice command, for the sake of immersion. But I expected it to not be possible considering the fact those values have to be passed to the speech engine before execution of the command, so the value needs to be known before it can be checked.. kind of..

Hmm.. unless there was an VA Action to Change Another Command on the fly, or something like that, but that would pretty much be dynamic command creation and having commands create other commands sounds like the kind of black magic that no mortal being should be delving into...