mIRC Home    About    Download    Register    News    Help

Print Thread
#139170 11/01/06 11:56 PM
Joined: Dec 2005
Posts: 54
B
Bundy Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Dec 2005
Posts: 54
I have made a .txt file with 20 sentences in it. I want to play these lines of text to the channel at 30 minute intervals. Only 1 line at a time...

Now ive got this: /timer.#hottubmessage 0 1800 play #hottub hottubmessage.txt 2000

It works fine, except every 30 minutes it plays all 20 lines of text to the channel with a 2 second delay between each line...

Is it possible to play only 1 line every 30 minutes respectively, 1 - 20 in order... and loop it?

#139171 12/01/06 12:02 AM
Joined: Mar 2005
Posts: 212
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Mar 2005
Posts: 212
because the timer calls the play command which plays all 20 lines with a determened delay in milliseconds

the best thing i could think to do is use
/play with a interval delay of $calc(30*60*1000)
that should give you you 30 minute delay
and then to loop it i guess .timer 0 $calc(20*30*60*1000)
Code:
.timer.#hottubmessage 0 $calc(20*30*60*1000) play #hottub hottubmessage.txt $calc(30*60*1000)

Last edited by NeUtRoN_StaR; 12/01/06 12:13 AM.
#139172 12/01/06 12:28 AM
Joined: Aug 2005
Posts: 525
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
Posts: 525
Code:
alias delayplay {
  [color:green];  %readdelay is the incrementing variable[/color]
  [color:green];  It starts at 0, so on first run it increments to 1[/color]
  [color:green]; Subsequent calls will increment it by 1 (1..2..3...4...etc)[/color]
  inc %readdelay
  [color:green];  Set current line of the text file, according to %readdelay into %current and send to channel[/color]
  var %current = $read(hottubmessage.txt, %readdelay)
  msg #hottub %current
  [color:green];  If %readdelay has reached the last line of the file, reset it to 0[/color]
  if (%readdelay == $lines(hottubmessage.txt)) {
    set %readdelay 0
  }
}

alias startplay {
  [color:green];  Unset %readdelay so it starts from the first line when this command is issued[/color]
  unset %readdelay
  .timerdelay 0 1800 delayplay
}


Use: /startplay
You can rename the aliases and variables to whatever you like, but be sure to change them in the script where applicable if you do so.

#139173 12/01/06 05:11 AM
Joined: Oct 2004
Posts: 72
C
Babel fish
Offline
Babel fish
C
Joined: Oct 2004
Posts: 72
Quote:

Code:
.timer.#hottubmessage 0 $calc(20*30*60*1000) play #hottub hottubmessage.txt $calc(30*60*1000)

Since this timer is not a millisecond timer (-m) it plays once per 416,666... days.

#139174 12/01/06 05:38 AM
Joined: Mar 2005
Posts: 212
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Mar 2005
Posts: 212
.timer.#hottubmessage 0 $calc(20*30*60*) play #hottub hottubmessage.txt $calc(30*60*1000)

yeah i was obviously zoned out

Last edited by NeUtRoN_StaR; 12/01/06 05:39 AM.
#139175 12/01/06 06:24 AM
Joined: Dec 2005
Posts: 54
B
Bundy Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Dec 2005
Posts: 54
Thanks a mil! wink

#139176 12/01/06 06:54 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
I dont think you shouyld use the play command like that. From what I know about it, once its playing no other play command can work untill its finished .

//timer.#hottubmessage 20 1800 msg #hottub $!read(hottubmessage.txt,nt,$calc(20 - $!timer($ctimer).reps)) $(|,) if (!$timer($ctimer).reps) $!+(timer,$ctimer) 20 1 $!timer($ctimer).com
^
that loops the 20 lines then relaunches the timer

//timer.#hottubmessage 20000 1800 msg #hottub $!read(hottubmessage.txt,nt,$calc(20 - $!timer($ctimer).reps % 20))
^
that just uses 20,000 iterations of the timer and keeps playing the file line 1 to 20, 1 to 20, 1 to 20 etc etc, so it does 1000 times through the file


Link Copied to Clipboard