ChangeIP script for v3.0rc11

I’m having problems getting the changeip script to run under v3.0rc11 has anyone got a working script or can someone take a look at the following script and tell me where I’ve gone wrong:

If I break the script up it works up until setting the global variable ddnsip but doesn’t like anything thereafter.

:log info "DDNS: Begin"

:global ddnsuser "username"
:global ddnspass "password"
:global ddnshost "hostname"
:global ddnsinterface "adsl"
:global ddnslastip

:global ddnsip [ /ip address get [/ip address find interface=$ddnsinterface] address ]

:if ($ddnslastip = "" ) do={ :global ddnslastip "0.0.0.0/0" }

:if ($ddnsip = "" ) do={

  :log info ("DDNS: No ip address present on " . $ddnsinterface . ", please check.")

} else={

  :if ($ddnsip != $ddnslastip) do={

    :log info "DDNS: Sending UPDATE!"
    :log info [ /tool dns-update name=$ddnshost address=[:pick $ddnsip 0 [:find $ddnsip "/"] ] key-name=$ddnsuser key=$ddnspass ]
    :global ddns-lastip $ddnsip

  } else={ 

    :log info "DDNS: No change" 

  }

}

:log info "DDNS: End"

it was already discussed many many times since new variable system was introduced.
Easy way to debug your script for syntax errors is print script form console:
/system script print from=changeip

:global ddns-lastip $ddnsip <— and here it is - syntax error

You don’t have such a variable ddns-lastip also if you want to use variable name with ‘-’ character in it, then put variable names in quotes, otherwise syntax error.

Many thanks for this, very helpfull.

Out of interest I did search the forum and the wiki for assistance before posting, however there is very little reference to v3 changes as such searching is pretty useless, it would be great if someone would actually post something that specifically relates to v3 changes with regard to scripting.

Thanks again!