|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
OP
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
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.
|
|
|
|
Joined: Jan 2003
Posts: 87
Babel fish
|
Babel fish
Joined: Jan 2003
Posts: 87 |
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.
|
|
|
|
Joined: Nov 2004
Posts: 842
Hoopy frood
|
Hoopy frood
Joined: Nov 2004
Posts: 842 |
/randtok { return $gettok($1-,$rand(1,$numtok($1-,32)),32) }
What do you do at the end of the world? Are you busy? Will you save us?
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,019 |
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.
Gone.
|
|
|
|
Joined: Jan 2003
Posts: 2,523
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,523 |
Don't underestimate his work, he managed to convert all "C" from DaveC's post to "32"!
/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,019 |
Gone.
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
alias randtok { return $gettok($1,$rand(1,$numtok($1,$2)),$2) }
New username: hixxy
|
|
|
|
Joined: Nov 2004
Posts: 842
Hoopy frood
|
Hoopy frood
Joined: Nov 2004
Posts: 842 |
I only ever use 32 with $gettok, anything else and it messes up :P
What do you do at the end of the world? Are you busy? Will you save us?
|
|
|
|
Joined: Feb 2004
Posts: 201
Fjord artisan
|
Fjord artisan
Joined: Feb 2004
Posts: 201 |
That happens when you use space as a delimiter.
|
|
|
|
|