mIRC Home    About    Download    Register    News    Help

Print Thread
get a list of everyone in the chan into a txt file #241340 10/04/13 06:50 AM
Joined: Apr 2013
Posts: 27
R
RuLerZ Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Apr 2013
Posts: 27
I have been looking for a code that puts every person currently in a channel I'm in into a text file. I am currently adding users to a text file as they join but if I get disconnected and people join they don't get added to the file unless I manually add them.

Does anyone have any ideas? Thanks in advance.

Re: get a list of everyone in the chan into a txt file [Re: RuLerZ] #241341 10/04/13 07:46 AM
Joined: Oct 2012
Posts: 164
D
Deega Offline
Vogon poet
Offline
Vogon poet
D
Joined: Oct 2012
Posts: 164
When you re-connect & re-join the channel the names list is sent, so when you get raw 366 (End of Names list) simply loop through $nick($2,N) and use /write's -s switch.
Code:
raw 366:& #channelname *:{
  var %i = 1
  while ($nick($2,%i)) {
    write -s $+ $v1 file.txt $v1
    inc %i
  }
}

Change: #channelname to your channels name.

Re: get a list of everyone in the chan into a txt file [Re: RuLerZ] #241342 10/04/13 02:59 PM
Joined: Apr 2013
Posts: 27
R
RuLerZ Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Apr 2013
Posts: 27
Thank you so much this works perfectly. Now when I get disconnected I have it delete the file then rejoin and it remakes the file and on join people get added and as they part/quit/kick they get removed. You are awesome!! TY so much.

Re: get a list of everyone in the chan into a txt file [Re: RuLerZ] #241343 10/04/13 09:31 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
Code:
on *:disconnect: {
 if ($isfile(file.txt)){ write -c file.txt }
}

This will clear the file for you when you disconnect. Or you can use it when you connect.
Code:
on *:connect: {
 if ($isfile(file.txt)){ write -c file.txt }
}

Now you dont need to delete the file every time you disconnect from the server.


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: get a list of everyone in the chan into a txt file [Re: sparta] #241344 10/04/13 10:06 PM
Joined: Oct 2012
Posts: 164
D
Deega Offline
Vogon poet
Offline
Vogon poet
D
Joined: Oct 2012
Posts: 164
Well, you can put it into the same event. Plus there is no need to check if it exists first, you're going to clear and write to it anyway wink
No need for the -s switch either, now that its cleared.
Code:
raw 366:& #channelname *:{
  write -c file.txt
  var %i = 1
  while ($nick($2,%i)) {
    write file.txt $v1
    inc %i
  }
}

Re: get a list of everyone in the chan into a txt file [Re: Deega] #244063 21/01/14 04:56 AM
Joined: Apr 2013
Posts: 27
R
RuLerZ Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Apr 2013
Posts: 27
I have been using this code for a while now and it has been perfect but I have found that when there are 2k+ people in the channel mirc freezes on connect.

I am wondering if there was any other way to write this that would allow for much larger channels.

Any help is appreciated.

Re: get a list of everyone in the chan into a txt file [Re: RuLerZ] #244124 25/01/14 04:05 AM
Joined: Apr 2013
Posts: 27
R
RuLerZ Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Apr 2013
Posts: 27
Here is a video example of raw 366 loop unable to handle over 14.5k users. I am wondering if there is another way rather then looping. http://www.youtube.com/watch?v=i_djV_epz-Y

Last edited by RuLerZ; 25/01/14 04:10 AM.
Re: get a list of everyone in the chan into a txt file [Re: Deega] #244129 25/01/14 02:32 PM
Joined: Jan 2004
Posts: 1,274
L
Loki12583 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,274
That video is private.

This may work better:

Code:
on me:*:join:#chan:{
  write -c names.txt
}

raw 353:& & #chan *:{
  write names.txt $replace($4-,$chr(32),$crlf)
}

Last edited by Loki12583; 25/01/14 02:50 PM.
Re: get a list of everyone in the chan into a txt file [Re: Loki12583] #244145 26/01/14 04:46 AM
Joined: Apr 2013
Posts: 27
R
RuLerZ Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Apr 2013
Posts: 27
Thank you so much Loki, you are awesome! Since I Add people on join and remove people on part I found the need to use ini files for performance so I altered the code to reflect using an INI:
Code:
on me:*:join:#chan:{
  remove -b inroom.ini
}

raw 353:& & #chan *:{
  writeini inroom.ini room $replace($4-,$chr(32),$chr(61) $+ $adate at $time $+ $crlf) $chr(32)
}

I am putting the date entered in the ini for each nick hence replacing spaces with =date at time to keep the ini formatted correctly, and just choose for a space to be placed at the end of the raw dump on the last nick.

This is working great I can use this code in 80k+ people with join/part writing ini scripts with little to no freezing.

The only fine tuning I need to do is the first person entered is incorrect:
lucky1223=01/26/2014=at 05:31:46
roflbaum=01/26/2014 at 05:31:46
ashrak_usedasashield=01/26/2014 at 05:31:46
jihaz=01/26/2014 at 05:31:46
skyblue_x=01/26/2014 at 05:31:46

There seams to be an extra = sign after date on the first person entered the rest are perfect in the ini.

Thanks again!

Last edited by RuLerZ; 26/01/14 04:54 AM.
Re: get a list of everyone in the chan into a txt file [Re: RuLerZ] #244149 26/01/14 05:25 AM
Joined: Jul 2006
Posts: 3,559
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,559
Try using $replacex instead of $replace, where are you testing this, which server?
Quote:
Since I Add people on join and remove people on part I found the need to use ini files for performance so
Tracking nicknames does not really require performance, only if you are tracking 80000+ nicknames at once. But the slowness before, was due to the while loop and the use of /write (which opens and closes the file each time you use it). INI files are stored in RAM and eventually flushed to the disk, which is why it's faster.


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: get a list of everyone in the chan into a txt file [Re: Wims] #244379 22/02/14 03:59 AM
Joined: Feb 2014
Posts: 9
L
LizardJammer Offline
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
L
Joined: Feb 2014
Posts: 9
I was looking to adapt this code to be used with hash tables but I cannot get the $crlf to make a new table entry. Here is what I have:
Code:
raw 353:& & #channame *:{
  /hadd -s inroom $replace($4-,$chr(32),$crlf)
}

Outcome:
Code:
BotNick

Nick1Nick2Nick3.....

Maybe there is a better way to add everyone in the room to a hash table, I was trying to write to a file then load the file into the hash table but was wondering if there was a cleaner way to do this?

Re: get a list of everyone in the chan into a txt file [Re: Wims] #244388 23/02/14 01:34 AM
Joined: Apr 2013
Posts: 27
R
RuLerZ Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Apr 2013
Posts: 27
Hi Wims, I am using the bot on Twitch servers.

Also LizzardJammer, let me know if you get hash tables working with this, that would be instantly faster for me as well.

Last edited by RuLerZ; 23/02/14 01:35 AM.