mIRC Homepage

list channel account

Posted By: danielboom

list channel account - 18/09/21 07:01 PM

; lista de canales
; /list llama

alias canal {
window @lista 300 300 400 200
aline @lista %users %usersall
}

raw 322:*:{
set %chan $2 | set %users $3 | set %modes $4 | set %topic $5-
%usersall = $calc(%users + %usersall) | canal
}

raw 323:*:{
window -c "channels list"
.iline -l @Lista 1 --- N/ofusers on all channels: 4 %usersall users ---
}

i dont know ifs its ok , any help?
Posted By: maroon

Re: list channel account - 19/09/21 03:32 AM

Depends if that you want to do, and if this is ALL the code involved in accomplishing your task.

Your code needs to take into account whether %usersall already exists, so along with your /list command it should reset %usersall all to zero.
One way to do this is to have your variable exist only for a short time, under the assumption that there will not be a long interval between any 322's or between the 323 and the final 322.
You could instead use this command to update %usersall -> inc -u5 %usersall %users
because this deletes the %usersall variable after 5 seconds.

However that does not solve the problem where your window keeps on filling up with additional info each time you run the command. You should either have a command to clear the contents of @lista at the time the /list command is used, or:

if (*N/ofusers* iswm $line(@lista,1) clear @lista
... and hope you're not having the potential of having line 1 containing a channel topic or channel name containing that string.

Also, by default the @window lines is limited to the same options/other/window-buffer so you should ensure that your window will not contain the contents of the last 5000 lines:

if (!$window(@lista)) window -j99999 @lista 300 300 400 200

You should eyeball the syntax for the /window command to see if there are other switches you want to use, like having the titlebar not show the @ in the @windowname, etc.
Posted By: danielboom

Re: list channel account - 19/09/21 06:51 AM

and how it do it?
Posted By: maroon

Re: list channel account - 19/09/21 07:52 AM

As I said before, what exactly is the "IT" you're wanting to do. What you're doing now is giving a list of channel counts and the increasing grand-total of users. Which of course is double-counting people who are in more than 1 channel, so I'm not sure exactly what's the purpose of adding together all the channel counts. Especially since this doesn't show you any people who are only in hidden channels having the +s or +p mode. Give a brief example of what you're wanting to happen. Or, are you just wanting to mimic the output of the LIST window that's already built in?
Posted By: danielboom

Re: list channel account - 20/09/21 12:28 AM

a count of channel list i want made
Posted By: Epic

Re: list channel account - 02/10/21 04:55 PM

You can try using a script like this:
Code
raw 321:*: if ($window(@ChanList)) .clear @ChanList | haltdef
raw 322:*:{
  var %chan $2 | var %users $3 | if ([+ !isin $4) var %topic $4-
  else { var %modes $+($gettok($4-,1,93),]) | var %topic $gettok($4-,2-,93) }
  if (!$window(@ChanList)) .window -kl @ChanList $mircexe 48
  if ($window(@ChanList)) .aline -l @ChanList %chan $+($chr(40),11,%users,,$chr(41)) %modes %topic
  inc -u25 %chansall | set -u25 %usersall $calc(%users + %usersall) | haltdef
}
raw 323:*:{
  if ($window(@ChanList)) { .iline -l @ChanList 1 89,89 == 14Total channels:11 %chansall $+(14,$chr(44)) 14Total users:11 %usersall 89==  | .window -a @ChanList }
  .window -c $qt(Channels List) | unset %chansall %usersall | haltdef
}
on *:KEYDOWN:@ChanList:13: chanlist_join $target
menu @ChanList {
  dclick:{ var %winchan $gettok($sline(@ChanList,1),1,32) | if ($chr(35) == $mid(%winchan,1,1)) .join -n %winchan }
}
alias -l chanlist_join { var %winlines $sline($1,0) | if (%winlines > 0) { var %i 1 | while (%i <= %winlines) { var %winchan $gettok($sline($1,%i),1,32) | if ($chr(35) == $mid(%winchan,1,1)) .join -n %winchan | inc %i } } }

When typing the command "/list" a new custom window will be created, which in some way simulates the original channel list window.

P.S. If you wanted to do something different, then please state your idea and thoughts in a more detailed description (This is a string or several strings in more than 50 words).

© 2021 mIRC Discussion Forums