You cannot put an ON EVENT handler inside an alias. Your ON NOTICE event already has code inside it which activates only at the 2 networks, so you don't need the ON CONNECT nor the alias.

Also, for future help, it often helps to include debug messages in your code, like
echo -s $script $scriptline event $event nick $nick (1-) $1-
which lets you see whether the problem is that the EVENT isn't being triggered, or the code is not branching inside an if() condition, etc.

Also, since both your events have "nickname is" within their magic string, you can make your event be triggered by fewer false positives by changing it to:
on *:notice:*nickname is*:?: {

You'd still keep the if() conditions the same.