Author Topic: VA not recognizing CMDSEGMENT:0 as conditional parameter  (Read 1074 times)

BeerHuntor

  • Newbie
  • *
  • Posts: 1
VA not recognizing CMDSEGMENT:0 as conditional parameter
« on: July 06, 2020, 07:38:24 AM »
I am trying to set up a simple dynamic command, but struggling to get VA to recognize the segment and do a check against that..  after researching it seemed i can use these types of command to have spoken words as variables and do code based on checks for what segment was said, but this is not seeming to work..

My command is executed with
Code: [Select]
When I say: flaps [one; two;]
and the code body is:
Code: [Select]
Begin Text Comapre: [{CMDSEGMENT:0}] Equals 'one'
  Do A Thing
  Tell me what ive done
Else If Text Compare: [{CMDSEGMENT:0}] Equals 'two'
  Do A Thing
  Tell Me what ive done
Else
  Tell me you dont understand
End Condition

Its always falling to the else block.. and not recognizing what I have said..

I am new to VA so if someone could point me in the right direction of how I can get this to work. I would be much appreciated.  Thank You.


EDIT:  After some Debug code writing to a log.txt file, it seems that the indexing of the command segment was wrong.. CMDSEGMENT:0 was picking up the 'flaps' not the [one; two;] options.

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: VA not recognizing CMDSEGMENT:0 as conditional parameter
« Reply #1 on: July 06, 2020, 09:15:43 AM »
That is correct - command segment 0 for, 'flaps [one;two;]' will always be, 'flaps', as it is the first part (zero-based) of a dynamic command.  Command segment 1 will be 'one' 'two' or blank (due to the optional dynamic command segment).

Note that you can always use the, 'Write a Value to the Event Log' action to simply output whatever you've got in your token - {CMDSEGMENT:0}.

Hope that helps!