[gcode_macro COUNT]gcode:{% set num=params.NUM|default(1)|int %}{% if num <=10 %}RESPOND MSG={num}COUNT NUM={num+1}# Count up 1{% else %}RESPOND MSG="Done Counting"{% endif %}
[gcode_macro DYNAMIC_MOVE]gcode:G28M117 Before:{printer.toolhead.position.z}# Above displays position after G28G90G1 Z20M117 After:{printer.toolhead.position.z}# Above displays position after G1
Preserving Variables
Dynamic Macro
This is an example of how to preserve variables across triple-newlines in Dynamic Macros.