- Posts: 133
- Thank you received: 5
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
- Topic Author
- Offline
- User
-
Less
More
2 years 4 months ago #1500
by Sat32
Replied by Sat32 on topic command and or
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
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 to join the conversation.
- CrabbyPatties
- Offline
- User
-
Less
More
- Posts: 116
- Thank you received: 1
2 years 4 months ago #1501
by CrabbyPatties
Replied by CrabbyPatties on topic command and or
Amen to that.
As long as the harmony keeps working for the wife I can take my time playing with ideas
Please Log in to join the conversation.
- Sat32
- Topic Author
- Offline
- User
-
Less
More
- Posts: 133
- Thank you received: 5
2 years 4 months ago #1537
by Sat32
Replied by Sat32 on topic command and or
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
if|isEQ{{varible}}##answer##av|23~command~1"???"av|2~command~2!##av|12~command~else!
Thanks
Please Log in to join the conversation.
- bowlingbeeg
- Offline
- User
-
Less
More
- Posts: 248
- Thank you received: 33
2 years 4 months ago #1538
by bowlingbeeg
Replied by bowlingbeeg on topic command and or
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.
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 to join the conversation.
- Sat32
- Topic Author
- Offline
- User
-
Less
More
- Posts: 133
- Thank you received: 5
2 years 4 months ago #1539
by Sat32
Replied by Sat32 on topic command and or
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 to join the conversation.
- davep
- Offline
- Admin
-
Less
More
- Posts: 367
- Thank you received: 96
2 years 4 months ago #1553
by davep
Replied by davep on topic command and or
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
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 to join the conversation.
Time to create page: 0.186 seconds