mIRC Homepage
Posted By: PHMinistries puting nicklist into a variable - 18/01/03 11:52 PM
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?
Posted By: Hammer Re: puting nicklist into a variable - 18/01/03 11:56 PM
Code:

  var %nicks, %i = 1
  whlie ($nick($chan,%i)) {
    %nicks = %nicks $ifmatch
    inc %i
  }
Posted By: PHMinistries Re: puting nicklist into a variable - 19/01/03 12:52 AM
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
Posted By: Cobra Re: puting nicklist into a variable - 19/01/03 01:04 AM
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^
Posted By: Cobra Re: puting nicklist into a variable - 19/01/03 01:10 AM
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^
Posted By: PHMinistries Re: puting nicklist into a variable - 19/01/03 01:20 AM
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
Posted By: Cobra Re: puting nicklist into a variable - 19/01/03 01:31 AM
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^
Posted By: PHMinistries Re: puting nicklist into a variable - 19/01/03 01:40 AM
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

Posted By: Cobra Re: puting nicklist into a variable - 19/01/03 02:00 AM
/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
      }
    }
  }
}
Posted By: Cobra Re: puting nicklist into a variable - 19/01/03 02:02 AM
lol u keep editing your posts

as long as u got it working so your happy smile

take care

Cobra^
Posted By: PHMinistries Re: puting nicklist into a variable - 19/01/03 02:31 AM
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
Posted By: Hammer Re: puting nicklist into a variable - 19/01/03 02:53 AM
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
}

© mIRC Discussion Forums