'Or' in conditional

37 views
Skip to first unread message

Cento Studios

unread,
May 16, 2016, 2:04:07 PM5/16/16
to VoiceAttack
There any way to create this?

Example

If {CMD} not contain [variable 1]

Or

If {CMD} not contain [variable 2]

Or

If {CMD} not contain [variable 3]

Execute comand X

Esle

Do nothing

End


Gary

unread,
May 16, 2016, 2:41:21 PM5/16/16
to VoiceAttack
Hi, Cento.

There is currently no, 'or' or 'and'.  In your example, you will need to nest your conditional statements:

If {CMD} does not contain [variable 1]
    If {CMD} does not contain [variable 2]
        If {CMD} does not contain [variable 3]
            Execute Command
        End If
   End If
End If
(there is no need for, 'else')


On a side note, notice that the example above resolves as, 'and's and not 'or's.  'Not' and 'Or' in your example will yield results that you would not want. For example, if you want to execute the command only if it does not contain, 'weapon' or, 'missile':

Spoken command by user: 'fire weapon'

if {CMD} does not contain 'weapon'
    does not execute (good)

-OR-

if {CMD} does not contain 'missile'
  executes (not good)



Hope that helps some!

Gary

Pfeil

unread,
May 19, 2016, 4:56:15 PM5/19/16
to VoiceAttack
You can do it using {Exp:}:

Begin Text Compare : [{EXP: Not ('{CMD}' LIKE '{TXT:Variable1}' Or '{CMD}' LIKE '{TXT:Variable2}' Or '{CMD}' LIKE '{TXT:Variable3}')}] Equals '1'
    Write '[Blue] Yes' to log
Else
    Write '[Blue] No' to log
End Condition

Cento Studios

unread,
May 20, 2016, 4:46:27 AM5/20/16
to VoiceAttack
But {EXP: Not ('{CMD}' LIKE '{TXT:Variable1}' Or '{CMD}' LIKE '{TXT:Variable2}' Or '{CMD}' LIKE '{TXT:Variable3}')} not enter into the text box

Pfeil

unread,
May 20, 2016, 3:33:51 PM5/20/16
to VoiceAttack
Ah, you must be on the "Release" version, that's been fixed in the Beta.
Reply all
Reply to author
Forward
0 new messages