mIRC Homepage
Posted By: DaveC $randtok(text,C) - 06/02/05 07:58 AM
Nothing fancy, just select a random token from the list

I know it can be done simply using a $gettok(text,$rand(1,$numtok(text,C)),C), but i thought hey whats the harm in asking.
Posted By: Tat Re: $randtok(text,C) - 06/02/05 12:05 PM
I must admit, I've written that exact line of code before.

alias a.verb { return $gettok($t.verb, $rand(1,$numtok($t.verb,$asc(.))), $asc(.)) }

So... yeah. $randtok(text,C)

Ofcourse I did finally change that script to random read from a file.
Posted By: Jigsy Re: $randtok(text,C) - 09/02/05 09:53 AM
Code:

/randtok { return $gettok($1-,$rand(1,$numtok($1-,32)),32) }

 
Posted By: FiberOPtics Re: $randtok(text,C) - 09/02/05 10:05 AM
Two things:

  • He knows that, and even showed how to do it.
  • Your solution only gives support for space as a delimiter.

Guess you didn't read Dave's post carefully.
Posted By: qwerty Re: $randtok(text,C) - 09/02/05 11:28 AM
Don't underestimate his work, he managed to convert all "C" from DaveC's post to "32"!
Posted By: FiberOPtics Re: $randtok(text,C) - 09/02/05 01:53 PM
rofl
Posted By: tidy_trax Re: $randtok(text,C) - 09/02/05 04:46 PM
Code:
alias randtok { return $gettok($1,$rand(1,$numtok($1,$2)),$2) }
Posted By: Jigsy Re: $randtok(text,C) - 10/02/05 12:07 PM
I only ever use 32 with $gettok, anything else and it messes up :P
Posted By: Jae Re: $randtok(text,C) - 01/03/05 10:32 PM
That happens when you use space as a delimiter.
© mIRC Discussion Forums