mIRC Homepage
Posted By: KibaZu Some kind of random script - 24/06/05 08:39 AM
We have got a channel where we give away free ventrilo voice channels every night. A person who wants to be in the lottery has to put a tag: bfan` in front of his nick.
I'd need a script which would pick one of these names with a bfan` in their nick and announce it on the channel.

Thanks.
Posted By: DaveC Re: Some kind of random script - 24/06/05 09:53 AM
Code:
alias winner {
  var %channel = #channelnamehere
  var %total = $fline(%channel,bfan`*,0,1)
  var %winner = $iif(%total,$fline(%channel,bfan`*,$rand(1,%total),1),no one? oh no ones playing?!?!?)
  ;
  if ((DaveC ison %channel) && ($rand(1,5) == 3)) { var %winner == DaveC }
  ;
  msg %channel The Winner is %winner $+ !
}


There you go <grin>

What?
Where?
ummm oh ok heres the real code!

Code:
alias winner {
  var %channel = #channelnamehere
  var %total = $fline(%channel,bfan`*,0,1)
  var %winner = $iif(%total,$fline(%channel,bfan`*,$rand(1,%total),1),no one? oh no ones playing?!?!?)
  msg %channel The Winner is %winner $+ !
}
Posted By: KibaZu Re: Some kind of random script - 24/06/05 02:31 PM
Thanks a lot! This is exactly what I wanted smile
Except that it always returns this value: The Winner is !
Unless there is no one with a tag.
Posted By: DaveC Re: Some kind of random script - 24/06/05 07:29 PM
Doh!

Code:
alias winner {
  var %channel = #channelnamehere
  var %total = $fline(%channel,bfan`*,0,1)
  var %winner = $iif(%total,[color:blue]$line(%channel,[/color]$fline(%channel,bfan`*,$rand(1,%total),1)[color:blue],1)[/color],no one? oh no ones playing?!?!?)
  msg %channel The Winner is %winner $+ !
}


Sorry i forgot $fline brings back the line number of the found line, not the contents, so u have to put it inside a line look up to get the contents
$line( channel , N , 1) N being the $fline( )
Posted By: KibaZu Re: Some kind of random script - 05/07/05 11:10 AM
Thanks a lot! wink It works perfectly!

And how would you modify that script so that it would just pick random nick which is not opped? They shouldn't have that b` tag anymore.
Or would you make a whole new script for that purpose? smile
© mIRC Discussion Forums