Hey, the parts of the code you marked off as something you don't understand - they are not actually code. lines marked with
/*
through
*/
are comments that do not get executed. I left them in there for reference while i was coding it. Each line of the /whois reply has a number beginning the message, to identify what kind of message it is. Usually, the replies to whois have $1 set to yourself, and $2 set to whoever is being /whois'ed.

In this code, each time a 307 arrives, I attached an /ialmark to their nick to tell that it's been identified. And each time someone changes nick because it needs to double-check whether they've identified for the $newnick too.

The last thing the /whois reply does is send a 318, which is when the script decides what to do. Either it sees that a 307 has recently been seen for this nick,in which case there's nothing to do except remove the ialmarks, and to take them off the list of nicks that you're waiting for a reply from.

So far you wanted something that checked if they have identified for a specific nick, regardless whether they are logged into a nickserv account. But now you want to do something else depending on whether they're registered too? That would involve adding a tag each time the 330 arrives. And when the 318 arrives, you want to do what if they are not logged into nickserv, that's different than what you're doing if they're using some random nick too?