Are manuals updated ?

Hi,

I just tried to apply script which was not using for a while and this is not working, as resume :

Script was working on 6.x.x and now this is not working on 7.6.

In few debug attempts I detected that following is not working anymore :

:global printpserverip [/system ntp client get primary-ntp]

looks like under “/system ntp client” not exists anymore “primary-ntp” and this is replaced with “servers”

Also, few wiki pages are outdated, I just checked following and can not understand is this is for 7 or this is outdated. Is there any new version compatible with router os 7.x ?
https://help.mikrotik.com/docs/pages/viewpage.action?pageId=40992869

Another question is :
Is there any built in function to split string, for example from “servers” “1.1.1.1,2.2.2.2” y want to get first one ip to variable.

Thank you in advance,
Dejan

To see what you can get out of the NTP, just past this to terminal

:put [/system ntp client get]

You should get some like this:

enabled=true;freq-drift=3529;mode=unicast;servers=199.41.243.43;80.89.32.122;status=synchronized;synced-server=199.41.243.43;synced-stratum=2;system-offset=1513;vrf=main

To get what server you have synced to:

:put [/system ntp client get synced-server]

To get configured servers.

:put [/system ntp client get server]

To get first element, convert to array and pick number 0

:put [:pick [:toarray [/system ntp client get server]] 0]

Edit:
Since its already an array, you can do:

:put [:pick [/system ntp client get server] 0]

For your variable:

:global printpserverip [:pick [/system ntp client get server] 0]

PS if there are no need for use the variable later or in another script, use local vaiable:

:local printpserverip [:pick [/system ntp client get server] 0]

(server**S**)

some examples:

:put ([:toarray "1.1.1.1,2.2.2.2"]->0)

:put ([:toarray "1.1.1.1,2.2.2.2"]->1)

:put ([/system ntp client get servers]->0)

:put ([/system ntp client get servers]->1)

:foreach server in=[/system ntp client get servers] do={
    :put $server
}

Thank you both, very useful examples for array handling.