Help me - make script change ip adress every rto

Hi @vingjfg

sorry if make you confuse, i just want change my wan ip adress on ether1 when my internet conection down.


/system script
add name=change-ip-on-rto source={
    :local pingResult [/ping 8.8.8.8 count=3];
    :log info "Ping Result: $pingResult";
    :if (($pingResult->"received") = 0) do={
        :local newHost ([:tostr [:pick [:tonum [:rand 256]] 0 3]]);
        :local newIP ("10.130." . $newHost . ".1/17");
        :log info ("RTO detected, changing IP address to $newIP");
        :put ("Changing IP address to $newIP");
        /ip address set [find interface="ether1"] address=$newIP;
    }
}

i ask chat gpt to help me make the script , but didnt work.