Set value based on vrrp status

Hello,

I try to create a script that sets a variable if vrrp interface number 1 is master but I don’t know how to create an if statement if master=yes or backup=yes.

I tried the following snippet:
:local Backup [/interface vrrp find backup=yes name=ether1-VRRP]
:local Master [/interface vrrp find master=yes name=ether1-VRRP]

:if ($Backup) do={ :local vrrpState backup }
:if ($Master) do={ :local vrrpState master }

I also tried a few different approaches but haven’t saved them (e.g. variations with get).

Is this possible? I would prefer a solution based on id rather name.

Kind Regards,
Madic