[3.6.0-rc.2] error: Unexpected characters after expression
-
Ones more
I have the following 0:/macros/Lights/set.g to control two different lights at my machine:
; call this to set any light to a given value or call this to turn off all lights ; can be called with parameter D: String of the device (light) you want to control ("main", "head"), all if permitted ; can be called with parameter B: Power the given light is set to, 0 if permitted ; create var for power and check input for out of bound var power = 0 if exists(param.B) && param.B >= 0 && param.B <= 1: set var.power = param.B ; set each device accordingly if !exists(param.D) || param.D == "main": M42 P0 S{var.power} if !exists(param.D) || param.D == "head": M42 P1 S{var.power}
When executing thjs via
M98 P"0:/macros/Lights/set.g"
, I get the following:
Error: in file set.g line 8: Unexpected characters after expressionWith 3.5.4 this macro executed without any warning or error.
Any idea on that?
-
@marvineer Try removing the colon ":" at the end of each of the if statements. See: https://docs.duet3d.com/User_manual/Reference/Gcode_meta_commands#conditional-construct
-
oh wow, sometimes the obvious...
Thanks! -
undefined marvineer marked this topic as a question
-
undefined marvineer has marked this topic as solved