Username:
Password:
  Home About Us Articles Rules Script Library FAQ Help
Not logged in (register
How do I select a random nick for mIRC
By: SonicX

Last Modified: Nov 03 12:12pm

Well, this is my first script here, so don´t fall over me :P
This script just selects a random nick (except your own) from nicklist where it´s triggered.

Hope I could help.
alias randnick {
  :newtry  
  %temp = $nick($chan,$rand(1,$nick($chan,0)))
  if (%temp == $me) {
    goto newtry
  }
  else {
    return %temp
  }
}

Comments
secretz
Nov 04 6:44am
here's another one :)
alias randnick {
while ($nick($chan,$rand(1,$nick($chan,0))) != $me) var %temp = $v1
return %temp

That way it's shorter but doesnt mean your way is all that bad. It's clearer for example.
But. %temp is global, that isnt good. Use var. Also, even though goto-loops are there, it's cooler to leave them alone.
secretz
Nov 04 6:45am
I forgot the closing bracket of randnick..
Earry
Nov 04 5:51pm
aaaaaaaw, im so proud of you SonicX! <3
Rhodry
Jun 22 11:20pm
Maybe just a minor detail... but did anyone consider what happens if its only you in the channel.

I know its a rare thing but maybe, I should have something that works. Its quite old and uses goto and such ;). But it works...

-----

alias randnick {
var %chan = $iif($1,$1,$chan)
if ($chan(%chan).status == joined) {
if ($nick(%chan,0) > 1) {
var %temp
:retry
%temp = $nick(%chan,$rand(1,$nick(%chan,0)))
if (%temp == $me && %temp) { goto retry }
return %temp
}
else {
echo $color(info) -s * $ $+ randnick: Error only one person on %chan
halt
}
}
else {
echo $color(info) -s * $ $+ randnick: You're currently not in %chan
halt
}
}

-----------

Uhm yes as you can see this allows normal $randnick or $randnick(#channel). It checks if you joined the channel or not. And ofcourse checks if there are more then just you in there.
If you don't want it to halt the script on an error you could remove the halt commands and thats fixed.
 
All content Copyright © 2004 - 2008 UtoNet IRC Network
UtoNet is sponsored and hosted by Datinix Systems