mIRC Home    About    Download    Register    News    Help

Print Thread
If anyone wants to make this.. #119925 11/05/05 04:00 AM
Joined: Jan 2004
Posts: 509
L
LostShadow Offline OP
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Jan 2004
Posts: 509
A /remainingusers alias.

What this is supposed to do is, tell you how many users are still remaining (that were there from when you joined the channel).

So, upon joining channels, you would get mIRC to keep track of all nicks. Then, everytime a user parts, or quits, the nick is removed from the list. When you part or disconenct the channel, then the list is wiped/deleted, until you rejoin the channel.

If the user quits the channel and comes back, he/she is not readded to the list, obviously.

What this does is if you join, say, a large EfNet channel with 100+ people, and you idle there, and, in like 2 weeks or so you can just do a /remainingusersleft #channel and see who in the channel currently has been there from when you joined the channel.

Now, in human memory, you can do without such an alias if you join a channel with you, and one other bot. Once that bot disconnects before you, the remaining users left drops down to 1 and stays that way forever until you leave the channel.

Any users that joins the channel after you have joined it, do nothing to as they are not 'remaining' users.

So clearly this alias has to be associated with a on part event, on quit event, and only when you join the channel, part, or disconnect.

Thanks in advance. :x

Re: If anyone wants to make this.. #119926 11/05/05 04:09 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
there is also ON KICK to consider.

Wouldnt be to hard a hash table of items named $chan|$nick maybe and remove em as the leave by part/quit/kick

I would do it but im going out in 2 mins, so Sladekraven well beat me too it smile LOL

Re: If anyone wants to make this.. #119927 11/05/05 09:28 AM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
LOL.

I've attempted it, here's the start for now..

Code:
Raw 366:*: {
  if (!$hget($2)) { hmake $2 }
  hadd -m $+($2,.total) $nick($2,0)
  var %users. [ $+ [ $2 ] ] $nick($2,0)
  while (%users. [ $+ [ $2 ] ]) {
    hadd $2 $nick($2,%users. [ $+ [ $2 ] ])
    dec %users. [ $+ [ $2 ] ]
  }
}


Creates 2 hash tables, one for storing nicknames and the other for storing the number of users. Theoretically all you'd need to do now is keep the hash table with total nicks, when they leave (Part/Quit,etc...) remove their nicks. Create that alias to take the number of items from the number of total nicks.

But I've got to go to the gym now I'm afraid, I'll continue with it when I get back though. smile

-Andy

Re: If anyone wants to make this.. #119928 11/05/05 11:56 AM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Ok, well I attempted some more. If you find any bugs I overlooked post back and tell us what it is.

Code:
Raw 366:*: {
  if (!$hget($2)) hmake $2
  if (!$hget($+($2,.total))) hadd -m $+($2,.total) $nick($2,0)
  var %users. [ $+ [ $2 ] ] $nick($2,0)
  while (%users. [ $+ [ $2 ] ]) {
    hadd $2 $nick($2,%users. [ $+ [ $2 ] ])
    dec %users. [ $+ [ $2 ] ]
  }
}

On *:Part:#: {
  if ($nick != $me) {
    if ($hfind($chan,$nick)) hdel $chan $nick 
  }
  else { hfree $chan | hfree $+($chan,.total) }
}

On *:Join:#: {
  if ($nick != $me) {
    if (!$hget($chan,$nick)) hadd $chan $nick
  }
}

On *:Kick:#: {
  if ($knick != $me) {
    if (!$hget($chan,$knick)) hdel $chan $knick
  }
}

On *:Quit: {
  if ($nick != $me) {
    var %x = $comchan($nick,0)
    while (%x) {
      if ($hfind($comchan($nick,%x),$nick)) hdel $comchan($nick,%x) $nick
      dec %x
    }  
  }
}

alias users {
  echo -a Number of users when joined: $hget($+($active,.total),1).item
  echo -a Number of users now: $nick($active,0)
  if ($nick($active,0) == $hget($+($chan,.total),1).item) echo -a Number of uses when joined is equal to number of users now.
  else {
    echo -a $iif($nick($active,0) > $hget($+($chan,.total),1).item,Joins: $calc($nick($active,0) - $hget($+($active,.total),1).item),Parts: $calc($hget($+($active,.total),1).item - $nick($active,0))))
  }
}


/users returns the following if the number of nicks is greater than the numebr of nicks when you first joined.

Number of users when joined: 5
Number of users now: 6
Joins: 1

When it's all even Stevens you get a message like:

Number of users when joined: 5
Number of users now: 5
Number of uses when joined is equal to number of users now.

And for part it should change Joins: to Parts:

All the best. smile

-Andy

Re: If anyone wants to make this.. #119929 12/05/05 02:03 AM
Joined: Dec 2002
Posts: 1,321
H
Hammer Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
Why not simply /names the channel whenever you wish to see how many are left that have been there since you joined? Any nicks that come after your own have been there longer than you.

Code:
[color:green];  Usage: /RemainingUsers [#]<channel>
;  [/color]
alias RemainingUsers {
     [color:green]
  ;  Create the matchtext field for raw 353 and 366 to trigger on
  ;  [/color]
  set -u600 %353 $me & #$$1 *
  set -u600 %366 $me #$1 End of /NAMES list.
     [color:green]
  ;  Open a minimized, hidden desktop listwindow to store the nicks; it's entirely possible that this
  ;  alias might be used on a channel with a large number of nicks (like 2500) which makes storing
  ;  the nicks in a variable untenable. And since (join) order is quite likely important, a hash table
  ;  wouldn't be the best idea either. That leaves either a file (slow access) or a hidden @window.
  ;  [/color]
  window -nhdl @RemainingUsers
     [color:green]
  ;  Now request the join order from /NAMES.
  ;  [/color]
  .raw names #$1
}
   [color:green]
;  353 RPL_NAMREPLY
;  [/color]
raw 353:%353:{
     [color:green]
  ;  Remove the @'s and +'s from in front of nicks. If your network uses additional symbols in front
  ;  of nicks, add them to the list of symbols inside the $remove().
  ;  [/color]
  var %rnicks = $remove($4-, @, +)
     [color:green]
  ;  Check to see if there are already nicks in @RemainingUsers, which would mean that we've found $me
  ;  somewhere in a previous 353.
  ;  [/color]
  if $line(@RemainingUsers, 0) {
       [color:green]
    ;  Since $me is already in @RemainingUsers, add all these new nicks to variable.
    ;  [/color]
    var %nicks = %rnicks
  
  }
     [color:green]
  ;  Or if $me is found in this line, then we can start processing nicks
  ;  [/color]
  elseif $istok(%rnicks, $me, 32) {
       [color:green]
    ;  Chop off any nicks prior to $me.
    ;  [/color] 
    var %nicks = $gettok(%rnicks, $+($findtok(%rnicks, $me, 1, 32), -), 32)
  
  }
     [color:green]
  ;  Now check to see if we need to process this 353 any more.
  ;  [/color]
  if %nicks {
       [color:green]
    ;  Add each nick to @RemainingUsers
    ;  [/color]
    var %i = 1
    while $gettok(%nicks, %i, 32) {
  
      aline @RemainingUsers $ifmatch
      inc %i
  
    }
  }
     [color:green]
  ;  Halt the normal display.
  ;  [/color]
  halt
}
   [color:green]
;  Echoing alias for /filter -k used in RPL_ENDOFNAMES to display the nicks.
;  [/color]
alias -l f_echo {
  
  echo -gtic info2 $gettok(%366, 2, 32) $1
  
}
   [color:green]
;  366 RPL_ENDOFNAMES
;  [/color]
raw 366:%366:{
     [color:green]
  ;  Get rid of the first line, which will be equal to $me.
  ;  [/color]
  dline @RemainingUsers 1
     [color:green]
  ;  Display the list however you like. This example uses /filter with an alias to echo.
  ;  [/color]
  filter -wk @RemainingUsers f_echo
     [color:green]
  ;  Clean up the /set variables used and close the data window.
  ;  [/color]
  unset %353 %366
  window -c @RemainingUsers
     [color:green]
  ;  Halt the normal display.
  ;  [/color]
  halt
}

/RemainingUsers #mIRC

cool


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
Re: If anyone wants to make this.. #119930 12/05/05 09:29 AM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Ohh heh, very nice dude. I like. smile

Re: If anyone wants to make this.. #119931 28/05/05 03:59 PM
Joined: Jan 2004
Posts: 509
L
LostShadow Offline OP
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Jan 2004
Posts: 509
filter -wk @RemainingUsers f_echo

Sorry, I get an error message. Invalid window.

Re: If anyone wants to make this.. #119932 30/05/05 11:45 AM
Joined: Dec 2002
Posts: 1,321
H
Hammer Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
Are you using mIRC v6.15 or higher? /filter -k did not appear until then. The scriptlet works when using 6.16.


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