I got around this by using resolve.
I resolve my public IP address. And make that a local variable. Then I compare that variable to what I pick off IP cloud or route pref-source.
This cuts down on sending unnecessary traffic to my name server provider. And NOTHING GETS WRITTEN TO MY LOG UNTIL... I send an update to the name server.
If you provide a copy of your script...
Maybe I could show you where to plug in local variables. but here are my pieces... YOU WILL NEED TO ADD THE WORD "WAN" to your public facing interface.
i.e. ether1-WAN
Pick IP From Route
:global Stat [/ip route get [find gateway=ether1-WAN] pref-src]
Pick IP from Address
:global OnEtherSub [/ip address get [find interface~"WAN"] address]
:global OnEther [:pick $OnEtherSub 0 [:find $OnEtherSub "/"]]
Pick IP from DHCP-Client
:global OnEtherSub [/ip dhcp-client get [find interface~"WAN"] address]
:global OnEther [:pick $OnEtherSub 0 [:find $OnEtherSub "/"]]
Get Public IP from IP Cloud
:global ipCloud [/ip cloud get public-address]
Resolve your current DNS name
:global RESOLVED [:resolve something.whatever.com]
Once you have those 2 things...
Compare them.
If not = then run the part of the script that sends the update to your service.
Then you will only have a log entry when they need and do updates.
(Figured this out a few years back and have been using it since.)