If it wasn't for the fact that you plan on sharing the script with others, I'd suggest that you use the address book
/abook - Color tab
/abook -l (mIRC 6.2 only)
For your nick, you can enter $me in the box where you would enter the nickname or address
I also suggest you read the topic at
Nick Coloring Since you do want to share the code, this is going to be more difficult, since the /abook command is (extremely) limited as to what it can do regarding entries in the address book.