Author Topic: Wildcards revisited  (Read 277 times)

MalcomR

  • Jr. Member
  • **
  • Posts: 51
Wildcards revisited
« on: March 26, 2025, 02:10:48 PM »
I posted originally in this thread https://forum.voiceattack.com/smf/index.php?topic=4569.msg20793#msg20793 and got some helpful responses.  However, I'm still having issues trying to make this work.

My example is [Set;] Altitude [to;*] or [Set;] Altitude [to;] * where I want to say anything for the altitude.  The first form works fine and this is what is shown in the log (I'm using the inline script referenced in https://forum.voiceattack.com/smf/index.php?topic=3658.0). I said Altitude 4000 and this is in the log (see attachment).

Th command sees the altitude in place of the wildcard.  How do I access that wildcard value in the command? None of the CMDSEGMENTS 0-3 are set (that is the Wildcard n log entries).  The wildcard before and after actions give me what is before the wildcard or after but not the wildcard itself.

I really don't want to generate a command using something like [1000..45000] as that would generate a lot of commands and VA complains.

I suppose I could use the {CMD} and parse it to get the number from it.

Thanks.

Thanks.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4855
  • RTFM
Re: Wildcards revisited
« Reply #1 on: March 27, 2025, 01:40:37 PM »
There are tokens for that: "{CMD_BEFORE}", "{CMD_AFTER}", and "{CMD_WILDCARDKEY}".

Regardless, you'd likely want to run the output through the "{TXTNUM:}" token anyway just to make sure it's only the number.

MalcomR

  • Jr. Member
  • **
  • Posts: 51
Re: Wildcards revisited
« Reply #2 on: March 27, 2025, 02:06:56 PM »
I saw those but they give me the portions before and after the wildcard * while the wildcardkey gave me the word altitude which is before the wildcard value of 4000 instead of the expected 4000. This is when I say Altitude 4000.

I did some more testing and found that the 4000 is actually in {CMD_AFTER} which is supposed to be the text after the wildcard phrase.  Based on the documentation I would have expected  {CMD_BEFORE} to contain Altitude and {CMD_AFTER} nothing since there is nothing after the wildcard. {CMD_WILDCARDKEY} should have the  wildcard phrase, 4000 since that is where the wildcard goes..  But maybe I'm not understanding what the manual is saying.
 
Attached is the output when I dump the Before and After and the command I'm experimenting with.

Yes, I agree that a sanity check is needed!

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4855
  • RTFM
Re: Wildcards revisited
« Reply #3 on: March 27, 2025, 02:13:36 PM »
The "wildcard phrase", is literally anything that is predefined. Doesn't matter whether that phrase uses dynamic sections or anything else.

"Altitude" is the predefined part of the recognized input, thus that is returned by "{CMD_WILDCARDKEY}". "4000" occurs after the predefined phrase, and as such it is returned by "{CMD_AFTER}".

MalcomR

  • Jr. Member
  • **
  • Posts: 51
Re: Wildcards revisited
« Reply #4 on: March 27, 2025, 03:00:40 PM »
Okay.  I see now.  Thank you.