mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2002
Posts: 174
P
Vogon poet
OP Offline
Vogon poet
P
Joined: Dec 2002
Posts: 174
is there an easy way to get a all the poeple in a channels nicklist into a variable?

like at once you could do an alias and have all the nicks into a variable?

Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
Code:

  var %nicks, %i = 1
  whlie ($nick($chan,%i)) {
    %nicks = %nicks $ifmatch
    inc %i
  }


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
Joined: Dec 2002
Posts: 174
P
Vogon poet
OP Offline
Vogon poet
P
Joined: Dec 2002
Posts: 174
on *:text:Ms_7-11 Chatters:#Praise-Him:/msg #Praise-Him Chatters OnLine %nickPHM
/var %nicksphm, %i = 1
whlie ($nick($chan,%i)) {
%nicksphm = %nicksphm $ifmatch
inc %i
}


thats not working for me

ive tried
on *:text:Ms_7-11 Chatters:#Praise-Him:/msg #Praise-Him Chatters OnLine %nickPHM
var %nicksphm, %i = 1
whlie ($nick($chan,%i)) {
%nicksphm = %nicksphm $ifmatch
inc %i
}

and i tried puting the
var %nicksphm, %i = 1
whlie ($nick($chan,%i)) {
%nicksphm = %nicksphm $ifmatch
inc %i
}
into variables

not sure what to do

Last edited by PHMinistries; 19/01/03 01:03 AM.
Joined: Dec 2002
Posts: 208
C
Fjord artisan
Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 208
it apears as though hammer's not online right now, else i'd normaly let the person who started helping continue though.

but it would apear as though u asked to place all nicks in a given channel into a varable, hammer correctly replyed with

Code:
  var %nicks, %i = 1
  whlie ($nick($chan,%i)) {
    %nicks = %nicks $ifmatch
    inc %i
  }


you asked then what to do with it, the answer is quiet simple, you place it wherever it is u wish it to work, if it was a channel event u wanted to do it in .. place it in the remote, or simply make it an alias that can be called from anywhere by altering it just a little like so

Code:
chan_nicklist {
  var %nicks, %i = 1
  whlie ($nick($1,%i)) {
    %nicks = %nicks $ifmatch
    inc %i
  }
  return %nicks
}


then all you need to do is set your varable to $chan_nicklist(#Channelname) and the varable will contain the nicknames in a given channel (asumeing your on that channel)

for example
set %nicks $chan_nicklist(#mIRC)

that would set %nicks to the list if nicknames in #mIRC

for a channel event use $chan for the channel name u wish to get the nicklist for.

Cobra^

Joined: Dec 2002
Posts: 208
C
Fjord artisan
Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 208
ah ok u edited your post and now its more clear what your tyring to do.

Code:
on 1:TEXT:*:#: {
  if (($chan == #Praise-Him) && ($1-2 == Ms_7-11 Chatters)) {
    var %ctr = 0, %tot = $nick($chan,0), %nicklist
    while (%ctr < %tot) {
      inc %ctr | var %nicklist = %nicklist $nick($chan,%ctr)
    }
    msg $chan Chatters OnLine %nicklist
  }
}


this will msg the channel witht he nicklist each time someone sez Ms_7-11 Chatters in the channel, which it apears as though thats what u want it to do ?

Cobra^

Joined: Dec 2002
Posts: 174
P
Vogon poet
OP Offline
Vogon poet
P
Joined: Dec 2002
Posts: 174
kewl im trying to learn that part, ill work with this and get it to go whee i need Thanks smile
on *:TEXT:Ms_7-11 Chatters:#Priase-HIm: {
var %ctr = 0, %tot = $nick($chan,0), %nicklist
while (%ctr < %tot) {
inc %ctr | var %nicklist = %nicklist $nick($chan,%ctr)
}
/msg #Praise-Him Chatters OnLine %nicklist
}
}

and i cant get it to budge what so ever,
im going to keep on looking

Joined: Dec 2002
Posts: 208
C
Fjord artisan
Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 208
the problem is you didnt do it exactly like i showed you.

you removed the if and put the conditional compoents into the remote header itself (which is ok to do, although i dont recomend it), but in removing the conditional u forgot to remove the matching } that went to it below

also there is NEVER a need to use / in a script
the / chr is used when writeing commands to a window's editbox so that mirc knows that what your typeing is to be run as a command instead of as plain text to be sent to that window

and therefore in scripts / 's are never needed.

Cobra^

Joined: Dec 2002
Posts: 174
P
Vogon poet
OP Offline
Vogon poet
P
Joined: Dec 2002
Posts: 174
on *:TEXT:!Ms_7-11 Chatters:#Praise-Him: {
var %nicksphm, %i = 1
while ($nick($chan,%i)) {
%nicksphm = %nicksphm $ifmatch
inc %i
}
msg #praise-him Chatters OnLine %nicksphm
}
}

got it,
i didnt understand what to do with var, and hammer misspelled while and i missed it to,
so it didnt work
but it does now, thanks guys


Last edited by PHMinistries; 19/01/03 01:58 AM.
Joined: Dec 2002
Posts: 208
C
Fjord artisan
Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 208
/me faints

*gasp*

gota learn how to write more organized/optimized code .. instead of having 50 on text events combine them useing if then else logic

Code:
on 1:TEXT:*:#: {
  if ($chan == #Praise-Him) {
    if (%simcast == on) {
      if ($network == Teens4Jesus) { scid %net1.id msg $chan 4T4J &lt; $+ $nick $+ &gt; 13 $1- }
      if ($network == PHMinistries) { scid %net2.id msg $chan 12PHM &lt; $+ $nick $+ &gt; 4 $1- }
      if ($1-2 == Ms_7-11 Chatters) {
        var %ctr = 0, %tot = $nick($chan,0), %nicklist
        while (%ctr &lt; %tot) {
          inc %ctr | var %nicklist = %nicklist $nick($chan,%ctr)
        }
        msg $chan Chatters OnLine %nicklist
      }
    }
  }
}

Joined: Dec 2002
Posts: 208
C
Fjord artisan
Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 208
lol u keep editing your posts

as long as u got it working so your happy smile

take care

Cobra^

Joined: Dec 2002
Posts: 174
P
Vogon poet
OP Offline
Vogon poet
P
Joined: Dec 2002
Posts: 174
Code:
on *:TEXT:!Ms_7-11 Chatters:{
  if (%simcast == on) {
    scid %net1.id var %nicksphm, %i = 1
    while ($nick($chan,%i)) {
      %nicksphm = %nicksphm $ifmatch
      inc %i  |  scid %net2.id {
        var %nickst4j, %i = 1
        while ($nick($chan,%i)) {
          %nickst4j = %nickst4j $ifmatch
          inc %i
          scid %net2.id /msg #praise-him 4T4J Chatters  %nickst4j
          scid %net2.id /msg #praise-him 12PHM Chatters %nicksphm 
        }
      }
    }

any idea why this isnt working?

might be something stupid on my part though

Last edited by Hammer; 19/01/03 02:43 AM.
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
Code:
on *:TEXT:!Ms_7-11 Chatters:#Praise-Him:{
  if (%simcast != on) halt
 
  var %nicksPHM, %nicksT4J, %chan = $chan, %i = 1, %activeCID = $activecid
 
  scid %net1.id
  while ($nick(%chan,%i)) {
    %nicksPHM = %nicksPHM $ifmatch
    inc %i
  }
 
  %i = 1
 
  scid %net2.id
  while ($nick(%chan,%i)) {
    %nicksT4J = %nicksT4J $ifmatch
    inc %i
  }
 
  scid %net1.id msg %chan 4T4J Chatters  %nicksT4J
  scid %net2.id msg %chan 12PHM Chatters %nicksPHM
 
  scid %activeCID
}



DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C

Link Copied to Clipboard