mIRC Home    About    Download    Register    News    Help

Print Thread
#134736 04/11/05 01:11 PM
Joined: Aug 2005
Posts: 32
R
r_alien Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Aug 2005
Posts: 32
Is there a way where i can get a script whenever someone joins or leaves a room (only one room i'm connected to) to write the nicks in the room to a file, with the nicks seperated by a comma or on a new line for each nick (prefeably a comma seperating nicks, but not an INI file) in the file?

#134737 04/11/05 02:21 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
/help on join
/help /write

Individual lines:
Code:
on *:join:[color:red]#yourchannel[/color]: {
  write nicks.txt $nick
}


Commas:
Code:
on *:join:[color:red]#yourchannel[/color]: {
  write -al1 nicks.txt $nick $+ ,
}


Just a warning with using commas on a single line... mIRC doesn't easily deal with really long lines. If this is something that you want mIRC to work with, you'll be much better off using individual lines.


Invision Support
#Invision on irc.irchighway.net
#134738 05/11/05 04:18 AM
Joined: Aug 2005
Posts: 32
R
r_alien Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Aug 2005
Posts: 32
OK, i got that, and i just tested the on part and on quit, but i wasn't clear enough last night (it was late at night)

But the script needs to be able to generate the total list of users on a channel at a time when a user, joins, leaves or quits.

Is there an easy way to do that? :P And no mIRC will not be reading the file, a PHP script i will create will be reading it, it is easier to do the comma seperated values in PHP, but a nick on each line could also be done.

#134739 05/11/05 01:58 PM
Joined: Sep 2005
Posts: 53
C
Babel fish
Offline
Babel fish
C
Joined: Sep 2005
Posts: 53
I have a similiar question. Lets say I added 10 people to the list and I want to show the whole list not one line. How is that possible? And I dont want me or ChanBot to show up on the list.
R Alien: You wuold have to put their names in manually or make a script like:
Code:
on *:Join:#: {
 set $+(%,user.,$nick) 
}
on *:Text:!User List:#: {
/notice $nick <-- and thats far as I got, heh.

Last edited by CraZyHanD; 05/11/05 02:05 PM.
#134740 06/11/05 02:07 PM
Joined: Apr 2003
Posts: 701
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
If you can guarantee there will be less than 40 users (actually 900 / (max nick length) users) Then this will return a list of all nicks on a specified channel
Code:
alias allusers {
  var %chan = $$1, %i = 1, %nicks
  while ($nick(%chan,%i)) { var %nicks = $addtok(%nicks,$v1,44), %i = %i + 1 }
  return %nicks
}
; This will write all users to a new line in the file channellist.txt
on !*:JOIN:#yourchannel: { write channellist.txt $allusers($chan) }
on !*:QUIT:#yourchannel: { write channellist.txt $allusers($chan) }


If the channel is bigger, it gets more difficult:

Code:
alias writeallusers {
  var %file = channellist.txt
  var %chan = $$1, %i = 1, %n = $nick(%chan,0)
  fopen allusers %file
  if ($ferr) { 
    echo -stc info Problem occurred with opening file $+(%",file,")
    fclose allusers
    return
    }
  fseek allusers $file(%file).size
  while (%i < %n) { 
    fwrite allusers $nick(%chan,%i) $+ ,
    if ($ferr) { 
      echo -stc info Problem occurred writing to file $+(%",file,")
      fclose allusers
      return
      }
    inc %i
  }
  fwrite -n allusers $nick(%chan,%i)
  fclose allusers
}
; This will write all users to a new line in the file channellist.txt
on !*:JOIN:#yourchannel:writeallusers $chan
on !*:QUIT:#yourchannel:writeallusers $chan


Link Copied to Clipboard