mIRC Home    About    Download    Register    News    Help

Print Thread
#257780 17/05/16 07:52 AM
Joined: Apr 2012
Posts: 9
G
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Apr 2012
Posts: 9
Hi, i could use some help with the following script.
The goal is to message a text file in a channel line by line each half a second. During this script the channel is moderated.

The sysntax of the command should be somethin like this:

/READTEXT sometextfile.txt #channel

Here's what i got so far, but doesn't work that.

alias READTEXT {
.mode $$2 +m
.var %numberoflines = $read($$1, 0)
.var %line = 0
.timer1 -m 0 500 {
while (%line < %numberoflines)
.inc %line 1
.msg $$2 $read($$1, %line)
}
if (%line == %numberoflines) {
.timer1 off
.mode $$2 -m
}
}

any suggestions?


Last edited by geejeeNL; 17/05/16 07:52 AM.
Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
Try use this alias:

Usage: /readtext <file> <#channel>
Example: /readtext test.txt #test_chan

Code:
alias readtext {
  var %f = $mircdir $+ $1
  if ($status !== connected) { echo 4 -a ERROR: You are not connected to a network! | return }
  if (!$1) { echo 4 -a ERROR: Specify a file! | return }
  if (!$2) { echo 4 -a ERROR: Specify a channel! | return }
  if ($me !ison $2) { echo 4 -a ERROR: You are not into the $qt($2) channel! | return }
  if (!$isfile(%f)) { echo 4 -a ERROR: The $qt(%f) file does not exists! | return }
  if (!$lines(%f)) { echo 4 -a ERROR: The $qt(%f) file is empty! | return }
  var %l = $iif($3 && $3 isnum,$3,1)
  var %r = $read(%f,nt,%l)
  if (%r) { .msg $2 %r }
  if (%l) && (%l == $lines(%f)) { return }
  .timer[READ_ $+ $2 $+ ] -m 1 500 readtext $1 $2 $calc(%l +1)
}

Last edited by westor; 17/05/16 08:18 AM.

Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Dec 2015
Posts: 148
Vogon poet
Offline
Vogon poet
Joined: Dec 2015
Posts: 148
Type "/HELP /PLAY" in mIRC.

Joined: Apr 2012
Posts: 9
G
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Apr 2012
Posts: 9
I've tried it, but unfortunally it doesn't work frown . Also i miss the part of moderating the channel during the sequence

Dazuz #257809 19/05/16 10:21 AM
Joined: Apr 2012
Posts: 9
G
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Apr 2012
Posts: 9
I miss the part of moderating the channel during the /play event. Afcourse i can put it on moderate before the /play action, but i still miss an identifier to trigger when the last line of file is reached, so i can take the moderation of the channel.

Last edited by geejeeNL; 19/05/16 10:21 AM.

Link Copied to Clipboard