mIRC Home    About    Download    Register    News    Help

Print Thread
#110309 06/02/05 07:58 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline OP
Hoopy frood
OP Offline
Hoopy frood
D
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.

#110310 06/02/05 12:05 PM
Joined: Jan 2003
Posts: 87
T
Tat Offline
Babel fish
Offline
Babel fish
T
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.

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

/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?
#110312 09/02/05 10:05 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
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.
#110313 09/02/05 11:28 AM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
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
#110314 09/02/05 01:53 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
rofl


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


New username: hixxy
#110316 10/02/05 12:07 PM
Joined: Nov 2004
Posts: 842
Hoopy frood
Offline
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?
#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