raw 311:*: {
%addvar = $+($2, !, $3, @, $4)
}
This sets up a proper nick!user@host mask.
The nick is $gettok(%addvar, 1, 33). The host is $gettok(%addvar, 2, 64).
This will also succesfully work with $mask(%addvar, 2).
If $address() isn't working, it means your IAL isn't up-to-date.
All this being said, if your IAL is up to date you shouldn't need to do anything like this, as $address() will just work.
See
this script as an example of how to keep the IAL up-to-date.