mIRC Home    About    Download    Register    News    Help

Print Thread
#269370 18/09/21 07:01 PM
Joined: Mar 2021
Posts: 25
D
Ameglian cow
OP Offline
Ameglian cow
D
Joined: Mar 2021
Posts: 25
; 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?

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
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.

Joined: Mar 2021
Posts: 25
D
Ameglian cow
OP Offline
Ameglian cow
D
Joined: Mar 2021
Posts: 25
and how it do it?

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
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?

Joined: Mar 2021
Posts: 25
D
Ameglian cow
OP Offline
Ameglian cow
D
Joined: Mar 2021
Posts: 25
a count of channel list i want made

Joined: Jan 2012
Posts: 301
Pan-dimensional mouse
Offline
Pan-dimensional mouse
Joined: Jan 2012
Posts: 301
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).



🌐 http://forum.epicnet.ru 📜 irc.epicnet.ru 6667 #Code | mIRC scripts, help, discuss, examples

Link Copied to Clipboard