I had bought a license for Mikrotik 3.x and the same script doesn't work with 3.14
Can somebody adapt it to version 3.14? Without documentation on 3.x scripting host, I can't figure out there the problem lies in the script
![Sad :(](./images/smilies/icon_sad.gif)
:local i 0;
{
:do {
:set i ($i + 1);
} while=(($i < 5) && ([/ping xx.xx.xx.xx interval=3 count=1]=0))
:if ($i=5 && [/ip route get [find comment="Default Route"] distance]=1) do={
:log info "Main Gateway down";
/ip route set [find comment="Default Route"] distance=3;
}
this error::set i ($i + 1);
this error::if ($i=5 && [/ip route get [find comment="Default Route"]
distance]=1
Sorry to say, but I had tried to paste it with spaces, without spaces...all the ways i could inventsorry, script edited. It is working on my router.
I didn't know that you have to put the script in { }. Thank you. I will try later.1) When you paste script directly in console then put it all in { }.
otherwise first line where local i is defined will be treated as another script.
Big thanks for your help.:local i 0;
{
:do {
:set i ($i + 1);
} while=(($i < 5) && ([/ping xx.xx.xx.xx interval=3 count=1]=0))
:if ($i=5 && [/ip route get [find comment="Default Route"] distance]=1) do={
:log info "Main Gateway down";
/ip route set [find comment="Default Route"] distance=3;
}
}