VoxCommando
VoxNastics (User Guides and Mods) => Tips and Tricks => Topic started by: Haddood on March 27, 2015, 06:58:38 PM
-
now and then I face a command where I need many ifs (to simulate a switch command) ... and the command does not look efficient ...
today I had this idea to make this very simple. By replace the multiple ifs with values from a map ....
images explain it all ...
for sure for 3 ifs is not a big deal, apart from being neat ... but in case of 50, this will be a big difference
-
That does seem more efficient. :)
Actually in the case of that example, you could even do it in a single line:
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.4.2-->
<command id="587" name="one line" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
<action>
<cmdType>PY.ExecString</cmdType>
<params>
<param>LEDcolour("{M:Mapping.LED{status}}")</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
</command>
-
Wow ... Now I have to go check all my commands :)