Help with Macro: SET_GCODE_VARIABLE doesnt set my variable

That’s because macros are evaluated before they are run. All the variables are “translated” before the macro is executed so if the macro itself changes the value of a variable, that change won’t be reflected during the same execution of the macro. To work around this, create a second macro called something like TEST_RESPOND, have that macro do the RESPOND TYPE=error MSG=‘{test}’ line, and call TEST_RESPOND at the end of TEST. Keep in mind that TEST_RESPOND will need to lookup the value of the test variable from the TEST macro.

2 Likes