|
Joined: Oct 2007
Posts: 92
Babel fish
|
OP
Babel fish
Joined: Oct 2007
Posts: 92 |
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
|
|
|
|
Joined: Jun 2007
Posts: 933
Hoopy frood
|
Hoopy frood
Joined: Jun 2007
Posts: 933 |
try this: 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.
|
|
|
|
Joined: Oct 2007
Posts: 92
Babel fish
|
OP
Babel fish
Joined: Oct 2007
Posts: 92 |
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.
|
|
|
|
Joined: Jun 2007
Posts: 933
Hoopy frood
|
Hoopy frood
Joined: Jun 2007
Posts: 933 |
This code should be on the bot: 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.
|
|
|
|
Joined: Oct 2007
Posts: 92
Babel fish
|
OP
Babel fish
Joined: Oct 2007
Posts: 92 |
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.
|
|
|
|
Joined: Jul 2006
Posts: 4,180
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,180 |
You can use $* and avoid the while : raw 353:*:tokenize 32 $4- | write nicks.txt $* And he can use /play to play the file when someone use !regnick : on *:text:!regnick:#channel:play "nicks.txt"
#mircscripting @ irc.swiftirc.net == the best mIRC help channel
|
|
|
|
Joined: Oct 2007
Posts: 92
Babel fish
|
OP
Babel fish
Joined: Oct 2007
Posts: 92 |
If i'll use play it'll give also the nicks that has @ or operator...
|
|
|
|
Joined: Jul 2006
Posts: 4,180
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,180 |
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
|
|
|
|
Joined: Oct 2007
Posts: 92
Babel fish
|
OP
Babel fish
Joined: Oct 2007
Posts: 92 |
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
|
|
|
|
Joined: May 2007
Posts: 89
Babel fish
|
Babel fish
Joined: May 2007
Posts: 89 |
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.
|
|
|
|
Joined: Jul 2006
Posts: 4,180
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,180 |
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
|
|
|
|
Joined: Aug 2005
Posts: 1,052
Hoopy frood
|
Hoopy frood
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 +
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
}
}
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
|
|
|
|
Joined: Jul 2006
Posts: 4,180
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,180 |
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
Hoopy frood
|
Hoopy frood
Joined: Aug 2005
Posts: 1,052 |
But if he does the code is there.
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
|
|
|
|
Joined: Jun 2006
Posts: 508
Fjord artisan
|
Fjord artisan
Joined: Jun 2006
Posts: 508 |
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
raw 366:*:if $me ison $2 { filter -wlfcxg $2 nicks.txt /[ $prefix ]/ }
on *:text:!regnick*:#channel:.play # nicks.txt | .remove nicks.txt
|
|
|
|
Joined: Oct 2007
Posts: 92
Babel fish
|
OP
Babel fish
Joined: Oct 2007
Posts: 92 |
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
|
|
|
|
Joined: Aug 2005
Posts: 1,052
Hoopy frood
|
Hoopy frood
Joined: Aug 2005
Posts: 1,052 |
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 ] 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
}
}
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
|
|
|
|
Joined: Oct 2007
Posts: 92
Babel fish
|
OP
Babel fish
Joined: Oct 2007
Posts: 92 |
why do i get X Unknown command
|
|
|
|
Joined: Jan 2003
Posts: 1,063
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 1,063 |
there is a typo on a line:
if ($left($read(filter.txt,n,%x),1) == @) || ($v1 == +) { %inc x }
should be:
if ($left($read(filter.txt,n,%x),1) == @) || ($v1 == +) { inc %x }
If it ain't broken, don't fix it!
|
|
|
|
Joined: Oct 2007
Posts: 92
Babel fish
|
OP
Babel fish
Joined: Oct 2007
Posts: 92 |
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.
|
|
|
|
|