Welcome to the Allonis forum! Tell us and our members who you are, what you like and why you became a member of this site. We welcome all new members and hope to see you around a lot!

command and or

Sat32's Avatar Topic Author
User User
  • Posts: 133
  • Thanks: 5

Re: command and or

2 years 6 months ago
#1500
Yeah this thing has so much potential, the biggest issue is fighting understanding.
I Keep testing stuff out and altering design plans over and over

As long as the harmony keeps working for the wife I can take my time playing with ideas

Please Log in or Create an account to join the conversation.

CrabbyPatties's Avatar
User User
  • Posts: 117
  • Thanks: 2

Re: command and or

2 years 6 months ago
#1501

As long as the harmony keeps working for the wife I can take my time playing with ideas
Amen to that.

Please Log in or Create an account to join the conversation.

Sat32's Avatar Topic Author
User User
  • Posts: 133
  • Thanks: 5

Re: command and or

2 years 6 months ago
#1537
this maybe a stupid question but how do you separate commands in a if?
if|isEQ{{varible}}##answer##av|23~command~1"???"av|2~command~2!##av|12~command~else!

Thanks

Please Log in or Create an account to join the conversation.

bowlingbeeg's Avatar
User User
  • Posts: 248
  • Thanks: 33

Re: command and or

2 years 6 months ago
#1538
Not a stupid question, the If statements aren't the easiest to understand, especially if you're nesting them or trying to do multiple commands. I'll try and explain with an example written in C++ style and then the equivalent in MyServer6

if (count == 1)
{
a = 2;
b = 3;
}
else
{
c = 4;
}

Now in MyServer6 syntax as a single statement:

If|IsEqual##{{count}}##1##Macro|SetVariable|a~2!SetVariable|b~3##SetVariable|c~4

or how it looks inside a macro. Note the double !'s at the end of the if statement(this is where it can get tricky with the !'s):

Macro|
If|IsEqual##{{count}}##1##Macro|
SetVariable|a~2!
SetVariable|b~3##SetVariable|c~4!
!

The issue with macros nested inside macros is keeping the !'s straight. The double ! at the end is to signify the end of one statement in the outer macro, whereas the single ! is to signify the end of a statement in the inner macro. As you can imagine if you start nesting more macros within each other you have to start adding in extra !'s to the outer macros, even comments.

For example:

Macro|
// Set the count !!
SetVariable|count~1!!
// Check the count !!
If|IsEqual##{{count}}##1##Macro|SetVariable|a~2!SetVariable|b~3##SetVariable|c~4!!

And then when you save the macro it would end up looking like the output below. I find the code above to be easier to read/write but after you save the macro you're stuck with this output:

Macro|
// Set the count !
!
SetVariable|count~1!
!
// Check the count !
!
If|IsEqual##{{count}}##1##Macro|
SetVariable|a~2!
SetVariable|b~3##SetVariable|c~4!
!

Hopefully that helps.

Please Log in or Create an account to join the conversation.

Sat32's Avatar Topic Author
User User
  • Posts: 133
  • Thanks: 5

Re: command and or

2 years 6 months ago
#1539
Thanks for the help I got it working, after I did I figured out it's just easier to debug if there separated

Please Log in or Create an account to join the conversation.

davep's Avatar
Admin Admin
  • Posts: 371
  • Thanks: 98

Re: command and or

2 years 6 months ago
#1553
For the inline myServer If statement there is an easy test for AND where you can append the variables in the test.

For instance
if ((variable_x = on) AND (variable_y = off)) then
     do something interesting

The myServer version can be
If|isEQ##{{variable_x}}{{variable_y}}##onoff##do something interesting

 
The following user(s) said Thank You: bowlingbeeg, andrew

Please Log in or Create an account to join the conversation.

Time to create page: 0.315 seconds