hi,
please, I don’t really understand why this script is not working when making comparaison to switch on sim-slot, it’s seems mikrotik don’t compare string values !!! Please help ?
:local simlte [/system routerboard sim get value-name=sim-slot]
:if ($PingFailCountLTE >= $FailTreshold) do={
:if ($PingFailCountLTE >= 100) do={
:set PingFailCountLTE 100
}
:if ( $simlte != “b”){
/system routerboard sim set sim-slot=b;
/log warning " etat du port lte va changer à : $simlte"
delay 60s;
};
}
:if ($PingFailCountLTE < $FailTreshold) do={
:if ( $simlte != “a”){
/system routerboard sim set sim-slot=a;
/log warning " etat du port lte va changer à : $simlte"
delay 60s;
};
}
RouterOS does support String comparison
There are few bugs in the script so maybe that is why it is not working.
Remember to put proper construction of :if statement. There are missing “do=” syntax. proper syntax is :if (sth) do={} else={}
delay command must be followed by “:” so :delay time_in_secs is proper syntax.
Once combining plain text with variable into 1 string put it inside brackets in the following manner: :log info ("test notification number: ".$variable);