Macro one-liner vs multiple lines

BECOME PART OF THE COMMUNITY - Sign up here
  • Hello forum,

    I have some strange behavour that hopefully someone can explain.

    So I have created macros to act as a color picker to replace one specific preset:

    To add an icon to the current active color I have programmed the macro as following:

    1. Replace preset with color

    2. Call a macro that resets all the appearances of all macros to their default (without icon)

    3. Assign appearance with icon to the selected macro

    Using this strategy only last macro activated gets this X icon appearance.

    But the strange thing is that the macro that resets all the appearances to their default only works if it's a one-liner:

    So I have started by splitting up the macro in multiple lines to make it more manageable, but to make it work all the lines needs to be ; seperated in line 1.

    Otherwise it does't work, there will be multiple icons visible instead of the last active macro.

    I thought that there is no difference between multilines and one line seperated with ";"

    Can someone explain why the multiline variant doesn't work?

    Thanks.

  • I thought that there is no difference between multilines and one line seperated with ";"

    The difference is the timing.

    Please open a system monitor window, and look at the timestamps of each command when you executes your macros with multiple lines versus semicolon separation

    1. Replace preset with color

    2. Call a macro that resets all the appearances of all macros to their default (without icon)

    3. Assign appearance with icon to the selected macro

    Using this strategy only last macro activated gets this X icon appearance.

    This strategy assumes that any tasks initiated and delegated by step 2 is fully completed before step 3 is executed.

    This is not the case when you use nest multiple macros.

  • The syntax is just "Assign Appearance x At Macro y". You don't need the "property 'appearance'" at the end.

    Thanks Ryan I did not know that.

    The difference is the timing.

    Please open a system monitor window, and look at the timestamps of each command when you executes your macros with multiple lines versus semicolon separation

    This strategy assumes that any tasks initiated and delegated by step 2 is fully completed before step 3 is executed.

    This is not the case when you use nest multiple macros.

    Ok that explains, would be nice if there is an option to synchronously nest multi-line macros. For now I will use the semicolon seperation.

    Edited once, last by hannie (September 27, 2021 at 7:56 PM).

  • For simple nesting, change the value of the Wait column of the macroline that triggers the other macro, from Follow to the time the other macro actually needs to complete

    For complex nesting (and looping, conditions etc), the best grandMA3 tool to use is Plugins, not Macros

    ------

    Nevertheless, from your screenshots and description, I would suggest instead of using commandline to change which Appearance each macro uses, you could rather change the appearance of the Appearances:

    Assign individual appearances with the X-icon and proper color to each macro then:

    Hide the X-icon on all macros/appearances by turning off their Image Alpha:

    Set Appearance 21 Thru 36 Property ImageAlpha 0

    then show the X-icon on the desired macro/appearance only, by switching on again that specific Image Alpha:

    Set Appearance 21 Property ImageAlpha 255

    This way the commandline interpreter only needs to process two lines instead of 17, making it easier to include in each original macro and to resist the urge of nesting macros.

  • That is a very in depth answer, thanks for taking the time.

    Changing the ImageAlpha is indeed a good suggestion.

    The only downside is that the appearances needs to be duplicated as the appearance is also used for the sequences in my showfile.

    I was re-creating the ma_startshow and added some new stuff just to learn from.

    After duplicating the appearances to the same macro number it can be very easily assigned:

    Assign Appearance 607 thru 621 at Macro 607 thru 621

    It works well, thanks.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!