mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
#188126 18/10/07 12:34 PM
N
nomer2007
nomer2007
N
when I join a chan a list of nicks will be posted on the status window. how can i save them to a textfile like nicks.txt

#channel LEeXen05 LADY_MAEVE ju22 jasper-x JrOcKiZThA rose19_dvo jm_ Guy_Wonder qc_male ^DRE^ Soul_M sexybabe XyPher_214 ana_alone OSS miSS_invisible kurusaKi_m luka_F ^^Andrea haizendhou` jesay24 Ruben`Gonzaga Lwin Nickname2 Hot_Men ^^BRyn^^ brent24 hyacinth isabelle_nicole im_alone attagirl_24 leia25 she_sk pJ17_AUdisTA TearHere`mDvO_ akoni Alexis`away cutie_nin08 HandsomeMARS_M AngGwapoKo nrop [mR-SmiLe] just_me-m safdfsd


gonna save it to the text file like


nick
nick
nick
nick
nick
nick
nick
nick


thanks for helping in advance

#188131 18/10/07 01:08 PM
5
5618
5618
5
try this:
Code:
raw 353:*:{
  var %nicks = $right($4-,-1)
  var %count = 1
  while ($gettok(%nicks,%count,32)) {
    write nicks.txt $gettok(%nicks,%count,32)
    inc %count
  }
}

As it is this will add the returned nicks to that file every time. If you want to delete the previous contents when receiving a new /names reply then just insert "write -c nicks.txt" above the for "var" line.

Last edited by 5618; 18/10/07 01:10 PM.
#188134 18/10/07 01:19 PM
N
nomer2007
nomer2007
N
it's working thanks...
one more question how can i read it using my bot and message the channel that i use !regnicks and messages the channel the regular nicks only

me: !regnicks

bot:nick1
bot:nick2
bot:nick3
and so on...


and then deletes the nicks..

Last edited by nomer2007; 18/10/07 01:25 PM.
#188135 18/10/07 01:32 PM
5
5618
5618
5
This code should be on the bot:
Code:
on *:TEXT:!regnicks:#channel:{
  while ($read(nicks.txt,1)) {
    msg $chan $read(nicks.txt,1)
    write -dl1 nicks.txt
  }
}  

something like that?

Last edited by 5618; 18/10/07 01:33 PM.
#188137 18/10/07 01:34 PM
N
nomer2007
nomer2007
N
i'll try it.. thanks


-

tried it but i got disconnected coz it msg the channel so fast
and it only gives back the 1st saved nick on the text file...

Last edited by nomer2007; 18/10/07 01:40 PM.
#188139 18/10/07 01:38 PM
Joined: Jul 2006
Posts: 4,020
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,020
You can use $* and avoid the while :

Code:
raw 353:*:tokenize 32 $4- | write nicks.txt $*


And he can use /play to play the file when someone use !regnick :

Code:
on *:text:!regnick:#channel:play "nicks.txt"


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
N
nomer2007
nomer2007
N
If i'll use play it'll give also the nicks that has @ or operator...

#188142 18/10/07 01:48 PM
Joined: Jul 2006
Posts: 4,020
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,020
This is because i don't remove the sign of each nick (@,%,+) in the raw, but you can just add a $remove :

raw *:353:tokenize 32 $remove($4-,@,%,+) | write nicks.txt $*
on *:text:#channel:play "nicks.txt"

The play is better than the while in this case because by defaut, there are 1 second before mirc send each line.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
N
nomer2007
nomer2007
N
thanks but i'm looking for a code that'll save the nicks on a text file then
on a command gets the regular nicks only...
anyway very much thanks

T
TropNul
TropNul
T
removing the status of each nick on receiving the names' raw may not be the better method because this will fill the file with all the nicknames without any way to distinguish between the nicknames later.

i think that there must be a filtering funtion if the user asks only for the regulars/voices/half-ops/ops.

[pseudocode]
open file
filter file
save result to a newfile
play newfile
delete newfile
[/pseudocode]

a better method would be to save the names in a hash table of an ini file. this will permet to 'index' any data that would be written. thus easing the retrieval for later use.

smile

#188147 18/10/07 03:06 PM
Joined: Jul 2006
Posts: 4,020
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,020
If you just want to store the regular nick, you can use a regsubex that just tokenize the regular nick :

raw *:353:tokenize 32 $regsubex($4-,/((@|%|\+).\S+)/g,) | write nicks.txt $*


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
#188149 18/10/07 03:43 PM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Um here you go, this will pop all names in tempa.txt then filter sort the nicks then !regnick will get only nicks without + or @ for nicks like !nick you will need to add another check in the if statement like I did for @ and +

Code:
raw 353:*:{ 
  var %x = 1
  .timer 1 3 /filter -ffac tempa.txt filter.txt 
  .timer 1 6 /.remove tempa.txt
  while (%x <= $numtok($4-,32)) {
    .write tempa.txt $gettok($4-,%x,32) $crlf
    inc %x
  }
}

on *:text:!regnick*:#channel:{
  var %x = 1
  while (%x <= $lines(filter.txt)) {
    if ($left($read(filter.txt,n,%x),1) == @) || ($v1 == +) { %inc x }
    else { echo -a $read(filter.txt,n,%x) }
    inc %x
  }
}

#188155 18/10/07 05:27 PM
Joined: Jul 2006
Posts: 4,020
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,020
If he just want to have the regular nick, then my code do it but he said that he want to store all the nick and then check for the regular...
I think that if doesn't want to do anything with other nick, there is no reason to store them


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
But if he does the code is there.

Joined: Jun 2006
Posts: 506
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 506
Originally Posted By: Wims
If you just want to store the regular nick, you can use a regsubex that just tokenize the regular nick :

raw *:353:tokenize 32 $regsubex($4-,/((@|%|\+).\S+)/g,) | write nicks.txt $*

Or use $prefix wink
Code:
raw 366:*:if $me ison $2 { filter -wlfcxg $2 nicks.txt /[ $prefix ]/ }
on *:text:!regnick*:#channel:.play # nicks.txt | .remove nicks.txt

N
nomer2007
nomer2007
N
Code:
raw 353:*:{ 
  var %x = 1
  .timer 1 3 /filter -ffac tempa.txt filter.txt 
  .timer 1 6 /.remove tempa.txt
  while (%x <= $numtok($4-,32)) {
    .write tempa.txt $gettok($4-,%x,32) $crlf
    inc %x
  }
}

on *:text:!regnick*:#channel:{
  var %x = 1
  while (%x <= $lines(filter.txt)) {
    if ($left($read(filter.txt,n,%x),1) == @) || ($v1 == +) { %inc x }
    else { echo -a $read(filter.txt,n,%x) }
    inc %x
  }
}



i'm using that but it only echoes isn't there anything you can do to use msg # and doesn't get disconnected coz of excess flood?
and not using play file

#188211 19/10/07 06:20 AM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Originally Posted By: nomer2007
Code:
raw 353:*:{ 
  var %x = 1
  .timer 1 3 /filter -ffac tempa.txt filter.txt 
  .timer 1 6 /.remove tempa.txt
  while (%x <= $numtok($4-,32)) {
    .write tempa.txt $gettok($4-,%x,32) $crlf
    inc %x
  }
}

on *:text:!regnick*:#channel:{
  var %x = 1
  while (%x <= $lines(filter.txt)) {
    if ($left($read(filter.txt,n,%x),1) == @) || ($v1 == +) { %inc x }
    else { echo -a $read(filter.txt,n,%x) }
    inc %x
  }
}



i'm using that but it only echoes isn't there anything you can do to use msg # and doesn't get disconnected coz of excess flood?
and not using play file

]
Code:
raw 353:*:{ 
  var %x = 1
  .timer 1 3 /filter -ffac tempa.txt filter.txt 
  .timer 1 6 /.remove tempa.txt
  while (%x <= $numtok($4-,32)) {
    .write tempa.txt $gettok($4-,%x,32) $crlf
    inc %x
  }
}

on *:text:!regnick*:#channel:{
  var %x = 1
  while (%x <= $lines(filter.txt)) {
    if ($left($read(filter.txt,n,%x),1) == @) || ($v1 == +) { %inc x }
    else { .timer 1 1 /msg # $read(filter.txt,n,%x) }
    inc %x
  }
}


N
nomer2007
nomer2007
N
why do i get
X Unknown command

#188232 19/10/07 10:38 AM
Joined: Jan 2003
Posts: 1,057
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2003
Posts: 1,057
there is a typo on a line:

Code:
if ($left($read(filter.txt,n,%x),1) == @) || ($v1 == +) { %inc x }


should be:

Code:
if ($left($read(filter.txt,n,%x),1) == @) || ($v1 == +) { inc %x }

N
nomer2007
nomer2007
N
thanks that get rid of the error.

but still got this timer. even if it has a timer it still keeps on msg the channel to fast and the bot got disconnected..

oh and it hasn't deletes the nicks that has been said.

Last edited by nomer2007; 19/10/07 12:25 PM.
Page 1 of 2 1 2

Link Copied to Clipboard