mIRC Home    About    Download    Register    News    Help

Print Thread
#110309 06/02/05 07:58 AM
D
DaveC
DaveC
D
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.

#110310 06/02/05 12:05 PM
T
Tat
Tat
T
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.

#110311 09/02/05 09:53 AM
Joined: Nov 2004
Posts: 822
J
Hoopy frood
Offline
Hoopy frood
J
Joined: Nov 2004
Posts: 822
Code:

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

 

#110312 09/02/05 10:05 AM
Joined: Feb 2004
Posts: 2,013
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Feb 2004
Posts: 2,013
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.

#110313 09/02/05 11:28 AM
Joined: Jan 2003
Posts: 2,125
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,125
Don't underestimate his work, he managed to convert all "C" from DaveC's post to "32"!

#110314 09/02/05 01:53 PM
Joined: Feb 2004
Posts: 2,013
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Feb 2004
Posts: 2,013
rofl

#110315 09/02/05 04:46 PM
Joined: Nov 2003
Posts: 2,321
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,321
Code:
alias randtok { return $gettok($1,$rand(1,$numtok($1,$2)),$2) }

#110316 10/02/05 12:07 PM
Joined: Nov 2004
Posts: 822
J
Hoopy frood
Offline
Hoopy frood
J
Joined: Nov 2004
Posts: 822
I only ever use 32 with $gettok, anything else and it messes up :P

#110317 01/03/05 10:32 PM
Joined: Feb 2004
Posts: 201
J
Jae Offline
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2004
Posts: 201
That happens when you use space as a delimiter.


Link Copied to Clipboard