|
Joined: Oct 2007
Posts: 214
Fjord artisan
|
OP
Fjord artisan
Joined: Oct 2007
Posts: 214 |
Hello,
I was wondering if it was possible to take this output of a line:
'^Joseph '^Jacob 'Joel .Buggs08 @Jeff
and write it to a txt file as seperate lines ex.:
'Joseph 'Jacob 'Joel .Buggs08 @Jeff
Thanks a bunch!
Cheers,
Jay
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
Yes. here are two options. var %names = '^Joseph '^Jacob 'Joel .Buggs08 @Jeff, %a = 1, %b = $numtok(%names,32)
while %a <= %b {
.write file.txt $gettok(%names,%a,32)
inc %a
} var %names = '^Joseph '^Jacob 'Joel .Buggs08 @Jeff
while %names {
.write file.txt $gettok(%names,1,32)
%names = $deltok(%names,1,32)
} I'm thinking there's an easy way to do it with /tokenize, but everything I'm able to script up is longer and more complicated than what I just posted.
|
|
|
|
Joined: Feb 2004
Posts: 206
Fjord artisan
|
Fjord artisan
Joined: Feb 2004
Posts: 206 |
What about ...
var %names = '^Joseph '^Jacob 'Joel .Buggs08 @Jeff
tokenize %names,32
.write file.txt $*
(untested) Cheers, DK
Darwin_Koala
Junior Brat, In-no-cent(r)(tm) and original source of DK-itis!
|
|
|
|
Joined: Jul 2006
Posts: 4,145
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,145 |
Should be : var %names = '^Joseph '^Jacob 'Joel .Buggs08 @Jeff
tokenize 32 %names
write file.txt $*
Last edited by Wims; 10/09/08 12:51 PM.
#mircscripting @ irc.swiftirc.net == the best mIRC help channel
|
|
|
|
Joined: Oct 2007
Posts: 214
Fjord artisan
|
OP
Fjord artisan
Joined: Oct 2007
Posts: 214 |
Thank you all so much for all the help, I really appreciate it.
This just made my life a whole lot easier.
Cheers,
Jay
|
|
|
|
Joined: Oct 2007
Posts: 214
Fjord artisan
|
OP
Fjord artisan
Joined: Oct 2007
Posts: 214 |
Hello,
Just another quick question.
Now that I am able to output the nicknames to the txt doc. Is there anyway to do a mass op/deop on the nicknames that are only listed in the txt doc. I would also like to exclude op/deoping myself in the process as my nickname will also be listed in the txt doc.
Thanks for all your help.
Jay
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
on @*:text:!op:#:{
var %a = 1, %b = $lines(file.txt), %op
while %a <= %b {
var %nick = $read(file.txt,n,%a)
if (%nick ison $chan) && (%nick != Buggs2008) {
var %op = $addtok(%op,%nick,32)
}
if $numtok(%op,32) == $modespl {
.mode $chan $+(+,$str(o,$modespl)) %op
var %op
}
inc %a
}
if %op {
.mode $chan $+(+,$str(o,$modespl)) %op
var %op
}
}
on @*:text:!dop:#:{
var %a = 1, %b = $lines(file.txt), %op
while %a <= %b {
var %nick = $read(file.txt,n,%a)
if (%nick ison $chan) && (%nick != Buggs2008) {
var %op = $addtok(%op,%nick,32)
}
if $numtok(%op,32) == $modespl {
.mode $chan $+(-,$str(o,$modespl)) %op
var %op
}
inc %a
}
if %op {
.mode $chan $+(-,$str(o,$modespl)) %op
var %op
}
}
|
|
|
|
Joined: Jul 2006
Posts: 4,145
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,145 |
Here is same code using an alias, reduce a few line of code : on @*:text:!op:#:optext +
on @*:text:!dop:#:optext -
alias optext {
var %a = $lines(file.txt) ,%m = $modespl
while (%a) {
var %nick = $read(file.txt,n,%a)
if (%nick ison $chan) && (%nick != Buggs2008) var %op = $addtok(%op,%nick,32)
if ($numtok(%op,32) == %m) {
.mode $chan $+($1,$str(o,%m)) %op
var %op
}
dec %a
}
if (%op) mode $chan $+($1,$str(o,%m)) %op
}
#mircscripting @ irc.swiftirc.net == the best mIRC help channel
|
|
|
|
Joined: Oct 2007
Posts: 214
Fjord artisan
|
OP
Fjord artisan
Joined: Oct 2007
Posts: 214 |
Wow!.
Works perfectly.
Thanks so much that helped me out so much. I appreciate all you folks helping me out.
Cheers and thanks again.
Jay
|
|
|
|
|