Script for Failover

Hi every body. I’m new in scripting and I want to run a failover between 3 Internet connections. I used to set some default routes for different links with Routing Marks for each one and playing with “distance” in routes. and it works great but now i have some ISP problems so i need to ping some IP like 8.8.8.8 for check. Netwatch is not usable for me, because of 3 different “routing marks”. So, at last i wrote this script for checking the IPs with two other routing mark:

:if ([ping 8.8.8.8 count=1 routing-table=checkping-ISP1] = 1)
do={ip route set [find comment=“ISP1”] distance=2}
else={ip route set [find comment=“ISP1”] distance=10}

:if ([ping 8.8.8.8 count=1 routing-table=checkping-ISP2] = 1)
do={ip route set [find comment=“ISP2”] distance=2}
else={ip route set [find comment=“ISP2”] distance=10}

:if ([ping 8.8.8.8 count=1 routing-table=checkping-ISP3] = 1)
do={ip route set [find comment=“ISP3”] distance=2}
else={ip route set [find comment=“ISP3”] distance=10}

this script is not working.
please help me to fix the script