cant get X OR Y AND Z properly working

:if ([/ping 1.1.1.1 count=5] !=0 || [/ping 2.2.2.2 count=5] != 0 && [/interface vrrp get vrrp2 priority]=90) do={[/interface vrrp set vrrp2 priority=150]}

let’s say if to change vrrep2 priority to 155 on a line to test if this line works. So by the logic, if host A or Host B is pingable AND vrrp2 priority = 90 script line should change the priority to 150 but if priority is already 150 it should do nothing as didn’t meet requirements. But it’s not working if I change, set priority to 155 it will set it with the next script run even priority is 150, not 90.

Note that (A || B && C) means (A || (B && C)) due to operator precedence, not ((A || B) && C). If you want the latter, you need to use parentheses as shown. It’s like 1+2*3 is 7, not 9.

Emil thanks a mill for clearing this, changed it as per your explanation and it works now the way it should :).

Just to show how complicate order of precedence is.

What is the result of: 60/5(7-5)

10 or 24

BODMAS just went out of my mind then it came to Mikrotik scripting :smiley: I’m new to Mikrotik scripting but with your help guys doing progress. Thanks a mill again.