It would help if you say what you expect it to be doing and what it is doing instead. Basically, what isn't working?

The one thing that stands out is that you are avoiding picking yourself as the nick, but only one time. It's not in a loop, so if you end up randomly selecting yourself twice, you'll be the winner. It won't keep trying for someone else without a loop. Of course, if you have many people in the channel, that's not likely to happen often, but if you're going to avoid your nick, you should avoid it completely.

And I'm not sure what's with the ELSE. From looking at it, I'd say that everything after the ELSE should always happen, so you should probably remove that.

Oh, and you don't have to do an evaluation when setting a dynamic variable...

This works fine when setting the variable:
set %var $+ . $+ $network $+ . $+ $chan


set $+(%var,.,$network,.,$chan)

It only needs evaluated (brackets or $eval()/$() ) when being read.

Invision Support
#Invision on