Macro If Statement (1 Viewer)

vf1

New Member
January 24, 2011
4
0
I am hoping that someone can help me on the translator macro here, i can't get the if statement to work.
If i test the following code, i will get to label :yesact no matter what var_zyx is.
Also i am unable to get save variable to work, the value is empty always.

Thanks

Code:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<macro>

  <item command="Set Variable: var_zyx|no" />
  <item command="If: var_zyx|==|yes|yesact|noact" />
  <item command="Label: yesact" />
  <item command="Popup: ABC|yes|1" />
  <item command="Set Variable: var_zyx|no" />
  <item command="Goto Label: end" />
  <item command="Label: noact" />
  <item command="Popup: ABC|no|1" />
  <item command="Set Variable: var_zyx|yes" />
  <item command="Label: end" />
</macro>
 

tobias funke

New Member
February 16, 2011
1
0
Home Country
United States of America United States of America
This is the macro I use to combine my receiver's discrete on/off switches into a single Translator toggle. It's worked ever since I made it 2 years ago. Maybe it can help you with your problem to see a working if-then script.


<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<macro>
<item command="Load Variables: power" />
<item command="If: var_power|==|on|Power Off|Power On" />
<item command="Label: Power On" />
<item command="Blast: Receiver - Power On|Port_2" />
<item command="Set Variable: var_power|on" />
<item command="Goto Label: End" />
<item command="Label: Power Off" />
<item command="Blast: Receiver - Power Off|Port_2" />
<item command="Set Variable: var_power|off" />
<item command="Label: End" />
<item command="Save Variables: power" />
</macro>
 

vf1

New Member
January 24, 2011
4
0
It doesn't work, somehow it can't save or load the variables...
i have to using vb scripts to resolve.

Thank you anyway.:D
 

ianc

MP Donator
  • Premium Supporter
  • December 29, 2007
    132
    1
    wicklow
    Home Country
    Ireland Ireland
    Same problem with "IF" statement. No matter what "var_turnedon" is set to the if statement evaluates as TRUE jumping to the turnoff label. Can anyone help?

    I should have mentioned - I'm trying to run tis script in "Translator"

    Thanks

    Ian

    Code:
    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <macro>
      <item command="Load Variables: tmpvars" />
      <item command="If: var_turnedon|==|on|turnoff|" />
      <item command="Popup: status|turnon|1" />
      <item command="Set Variable: var_turnedon|on" />
      <item command="Goto Label: end" />
      <item command="Label: turnoff" />
      <item command="Popup: status|turnoff|1" />
      <item command="Set Variable: var_turnedon|off" />
      <item command="Label: end" />
      <item command="Save Variables: tmpvars" />
    </macro>
     

    Users who are viewing this thread

    Top Bottom