When I change problematic set WAN1DownCounter to set $WAN1DownCounter then it’s start working… but still not proper. He create global but not inc it value. No more syntax error.
the right way to use a variable is to call it directly, not searching everytime on environment
why not work: before run the “:if” the “:set WAN1DownCounter” can not find “WAN1DownCounter” because is undeclared.
Soluction: delcare it (:global WAN1DownCounter do not assign any value, and do not alter it if is already set)
but now we have another problem, the first time is run do error because undefined variable + 1 fail
the soluction is check first if WAN1DownCounter is a number, if not set it to 1, if yes add 1 to actual value:
No problem, but in my post I also put in the explanations
About @eworm soluction:
is pretty the same:
I check if is it a number, because MUST be a number, if is it I add one, else I set to 1 the variable
instead @eworm check if is “nothing”, and if is it set to 1 the variable, else add one