People often try to put /dns in an alias and straightaway access the resultant data. Due to the asynchronous nature of server lookup, there is a delay before the /dns response comes back – after which the script has long ago finished executing. Also, results are only valid in the ON DNS event, which executes when a reply is received.
So, your code must be placed in the ON DNS event if you want to use DNS info on a person. This doesn't mean you can't still tie the retrieval of dns information to a specific request.
All the following code should be placed in the Remotes section of mIRC's script editor (alt+r).
First we set up our calling alias:
; Request DNS lookup from your ISP (or local cache)
With that done, we have set a variable with the name of the target and also the destination window, $active. The variable will unset automatically after five seconds, but until that time we have that information available.
And most importantly, /dns has been called. The request has gone off to the Domain Name Servers and, as far as your alias cares, that's it. (This is why you can't make this an identifier: the eventual result has no context here.)