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.