mIRC Home    About    Download    Register    News    Help

Print Thread
#204162 10/09/08 02:33 AM
Joined: Oct 2007
Posts: 214
B
Fjord artisan
OP Offline
Fjord artisan
B
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

Buggs2008 #204164 10/09/08 03:17 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Yes. here are two options.
Code:
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
}

Code:
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.

RusselB #204165 10/09/08 08:35 AM
Joined: Feb 2004
Posts: 206
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Feb 2004
Posts: 206
What about ...

Code:
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
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
Should be :
Code:
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
Buggs2008 #204167 10/09/08 01:13 PM
Joined: Oct 2007
Posts: 214
B
Fjord artisan
OP Offline
Fjord artisan
B
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

Buggs2008 #204168 10/09/08 02:20 PM
Joined: Oct 2007
Posts: 214
B
Fjord artisan
OP Offline
Fjord artisan
B
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

Buggs2008 #204181 10/09/08 11:09 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Code:
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
  }
}

RusselB #204184 11/09/08 12:12 AM
Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
Here is same code using an alias, reduce a few line of code :

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
Buggs2008 #204185 11/09/08 01:04 AM
Joined: Oct 2007
Posts: 214
B
Fjord artisan
OP Offline
Fjord artisan
B
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


Link Copied to Clipboard