mIRC Home    About    Download    Register    News    Help

Print Thread
#158137 01/09/06 08:53 AM
Joined: Sep 2006
Posts: 1
G
Grimson Offline OP
Mostly harmless
OP Offline
Mostly harmless
G
Joined: Sep 2006
Posts: 1
Why does the code below pick the same random line every time out of a file with 120 lines in it?

if ( $1- = PlayFile on ) {
.Timer1 50 1334 msg #MyChan $read(textfile.txt)
}

#158138 01/09/06 09:01 AM
Joined: Mar 2003
Posts: 612
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 612
because it is evaluating the line when you set the timer, once you have set it do /timers and you'll see

try

if ( $1- == PlayFile on ) {
.Timer1 50 1334 msg #MyChan $ $+ read(textfile.txt)
}

or

if ( $1- == PlayFile on ) {
.Timer1 50 1334 msg #MyChan $($read(textfile.txt),0)
}

-edit- and this should be in S&Ps wink

Last edited by billythekid; 01/09/06 09:30 AM.

billythekid
#158139 01/09/06 09:45 AM
Joined: Jan 2003
Posts: 1,063
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2003
Posts: 1,063
Code:
if ($1- == PlayFile on) { 
    .Timer1 50 1334 msg #MyChan $!read(textfile.txt)
}


this would be a better solution. the ! will cause timer to evaluate the identifier on each run


If it ain't broken, don't fix it!

Link Copied to Clipboard