:global remotepri;
:global remotebak;
:local pri [ping $remotepri interval=200ms count=50];
:log info message=$remotepri;
:log info message=$pri;
:local bak [ping $remotebak interval=200ms count=50];
:log info message=$remotebak;
:log info message=$bak;
:if ( $pri > $bak ) do={
:log info message=“pri”
/ip route set [find comment=“pri”] disabled=yes
/ip route set [find comment=“bak”] disabled=no
} else={
:log info message=“bak”
/ip route set [find comment=“bak”] disabled=yes
/ip route set [find comment=“pri”] disabled=no
}
The problem is: The first time you run the script the value of local variable “pri” get the correct value but successive executions this variable does not get any value.
I hope you can help me.