mIRC Home    About    Download    Register    News    Help

Print Thread
Channel Events \ Channel System Menu #229044 20/01/11 02:53 AM
Joined: Jan 2003
Posts: 64
M
MegaZeroX Offline OP
Babel fish
OP Offline
Babel fish
M
Joined: Jan 2003
Posts: 64
There is already functionality in place in 7.17 that allows you to customize where/whether joins/parts/quits are shown in a #channel. It would be helpful to have remote control over this functionality. Writing a script to do the same thing isn't difficult but it's certainly much faster to have the program do it.

There are a lot of channels, for instance #ActiveTrader on FinancialChat and #CLGaming on QuakeNet and where you have tons and tons of people joining/parting/quitting. This would let you screen out some of this "event traffic."

Re: Channel Events \ Channel System Menu [Re: MegaZeroX] #229047 20/01/11 04:25 AM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
It seems like what you're really asking for is not a programmatic /command to control join/part displays, but you want individual channel controls. Or perhaps you're just asking for both.

In any case, yes, individual channel controls for hiding join/parts would be nice. However, I'm not sure how high on the list this would really be, given how easy it is to script:

Code:
on ^*:JOIN:%hide.channels:haltdef
on ^*:PART:%hide.channels:haltdef
alias hidejoins %hide.channels = $addtok(%hide.channels,$1,44)
alias unhidejoins %hide.channels = $remtok(%hide.channels,$1,0,44)
alias listjoins echo -a * Hiding join/parts on: %hide.channels


You would /hidejoins #mychan to hide it, /unhidejoins #mychan to unhide it, and /listjoins to list what channels the script is working for. Note that I've ignored the QUIT event since the purpose isn't to write you a script but rather to point you in the right direction. It's not much harder, but it's not as braindead simple as JOIN/PART.

Again: yes, it would be more convenient to have a channel specific option for, but there are lots of more immediate issues that need dealing with.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: Channel Events \ Channel System Menu [Re: argv0] #229050 20/01/11 07:47 AM
Joined: Jan 2003
Posts: 64
M
MegaZeroX Offline OP
Babel fish
OP Offline
Babel fish
M
Joined: Jan 2003
Posts: 64
You're right; it would be easy to script... "except."

The problem is we wouldn't really ignore all parts and quits. We would only ignore non-active chatroom users who /part and /quit. If someone speaks on the channel, we don't ignore them leaving because we could be talking to them on the channel.

Scripting *that* would slow down mIRC. Believe me, I've tried. In some of the channels I visit, you can fill a whole 30k variables.ini in 2 hours -- and then, the script stops working. wink

Re: Channel Events \ Channel System Menu [Re: MegaZeroX] #229053 20/01/11 08:25 AM
Joined: Apr 2010
Posts: 958
F
FroggieDaFrog Offline
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 958
Am on a channel of over 1000ppl at the moment, and if my "other nicks" script hasn't had a problem then your's shouldn't

try using a hashtable, clear out old data, update with new data constantly

Here's an example(I haven't tested it):
Code:
alias hidejoins %hide.channels = $addtok(%hide.channels,$1,44)
alias unhidejoins %hide.channels = $remtok(%hide.channels,$1,0,44)
alias listjoins echo -a * Hiding join/parts on: %hide.channels

on *:TEXT:*:%hide.channels:{
  hadd -mu3600 $+(hc,$cid,:,$chan) $nick spoke
}
on *:ACTION:*:%hide.channels:{
  hadd -mu3600 $+(hd,$cid,:,$chan) $Nick spoke
}
on *:NOTICE:*:%hide.channels:{
  hadd -mu3600 $+(hd,$cid,:,$chan) $nick spoke
}
on ^*:PART:%hide.channels:{
  if ($nick == $me) { if ($hget($+(hd,$cid,:,$chan))) { hfree $v1 } }
  elseif ($hget($+(hd,$cid,:,$chan),$nick)) { hdel $+(hd,$cid,:,$chan) $nick }
  else { haltdef }
}
on *:DISCONNECT:{
  var %x = 1
  while ($hget(%x)) {
    if ($+(hd,$cid,:,*) iswm $v1) { hfree $v2 } 
    else { inc %x }
  }
}
on ^!*:QUIT:{
  var %x = 1, %c, %halt = $true
  while ($gettok(%hide.channels,%x,44)) {
    %c = $v1
    if ($nick ison %c && $hget($+(hd,$cid,:,%c),$Nick)) { 
      hdel $+(hd,$cid,:,%c) $nick 
      %halt = $false
    }
    inc %x
  }
  if (%halt) { haltdef }
}

Last edited by FroggieDaFrog; 20/01/11 08:44 AM.

I am SReject
My Stuff
Re: Channel Events \ Channel System Menu [Re: MegaZeroX] #229054 20/01/11 08:39 AM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
"Except" what you've described is not how mIRC behaves.

The setting for show/hiding joins/parts in Alt+O -> IRC -> Events will show or hide ALL join/parts, regardless of whether they spoke. Making this setting work for individual channels would not magically make it do what you just described-- and it was not part of your initial suggestion.

So now it sounds like you've quietly introduced a new requirement: you also want mIRC to only hide these events if the user is inactive.

THAT won't happen-- or at least, I highly doubt it will. That makes the feature fairly incongruous and seemingly random (how do you define "active"? everybody would have their own heuristics)

Lastly, I reserve my right to *not* believe you. There's no reason scripting that behaviour yourself should/would slow down mIRC. If you're "filling 30k" of variables in 2 hours, you're undoubtedly doing it wrong. Here is a slightly modified version of the above that excludes active users:

Code:
ON *:TEXT:*:%hide.channels:hadd -mu60 hidejoins $+($cid,.,$nick) $true
ON ^*:JOIN:%hide.channels:haltdef
ON ^*:PART:%hide.channels:if (!$hget(hidejoins,$+($cid,.,$nick))) haltdef | hdel hidejoins $+($cid,.,$nick)


Show me that script acting slow and I'll change my mind.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: Channel Events \ Channel System Menu [Re: MegaZeroX] #229058 20/01/11 11:39 AM
Joined: Dec 2002
Posts: 344
D
drum Offline
Pan-dimensional mouse
Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 344
For the record, mIRC already keeps track of how long a particular user has been idle on a given channel with $nick(#,nick).idle. This should work:

Code:
ON ^*:PART:%hide.channels:if ($nick(#,$nick).idle > 60) haltdef


Quit would require a bit more work (in particular if you want to only hide the quit message from one channel when you have more than one common channel), but it should still be fairly efficient.

Re: Channel Events \ Channel System Menu [Re: MegaZeroX] #229075 20/01/11 07:07 PM
Joined: Jan 2003
Posts: 64
M
MegaZeroX Offline OP
Babel fish
OP Offline
Babel fish
M
Joined: Jan 2003
Posts: 64
Froggie: Thanks for reminding me about the -uN switches; I had totally forgotten about those.

I think another rationale for feature inclusion is the idea that we don't need mIRC and scripts doing the same thing. If you just click the system menu, the functionality is there. Do we really need to make a popup that does entirely the same thing? Since mIRC already has this functionality (you're at the 20 yard line), it makes sense just to finish the deal rather than have a script replicate the functionality totally.

argv0... Sequence of events here is that I made a feature suggestion and you made a counter-suggestion, which you are entitled to. After I reiterated that I thought the feature was needed, you say you "don't believe me." Thanks but this isn't kindergarten.

Here is the script I was using as of the last effort:

Quote:
on ^1:PART:#:{
if (%HaltDef: [ $+ [ $chan ] ]) { // If we are hiding events on this channel
var %%%evaluate = $+($chr(37), $chr(37), NoHaltDef:, $chan, :, $nick)
if ($eval(%%%evaluate, 2)) unset %%NoHaltDef: $+ $chan $+ : $+ $nick
else haltdef
}
}
on ^1:QUIT:{
var %%%comchan.scan = 1
var %%%comchan.max = $comchan($nick, 0)
while (%%%comchan.scan <= %%%comchan.max) {
var %%%comchan.chan = $comchan($nick, %%%comchan.scan)
if (%HaltDef: [ $+ [ %%%comchan.chan ] ]) { // Once again, if we are hiding events on this channel.
var %%%evaluate = $+($chr(37), $chr(37), NoHaltDef:, %%%comchan.chan, :, $nick)
if ($eval(%%%evaluate, 2)) unset %%NoHaltDef: $+ %%%comchan.chan $+ : $+ $nick
else haltdef
}
var %%%comchan.scan = $calc(%%%comchan.scan + 1)
}
}

Re: Channel Events \ Channel System Menu [Re: MegaZeroX] #229080 20/01/11 08:10 PM
Joined: Dec 2002
Posts: 344
D
drum Offline
Pan-dimensional mouse
Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 344
Since I'm bored I'll go ahead and give you a fully working script that should avoid any performance issues:

Code:
on ^!*:JOIN:%hide.channels:haltdef

on ^!*:PART:%hide.channels:if ($nick(#,$nick).idle > 180) haltdef

on ^!*:QUIT:{
  var %i = $comchan($nick,0)
  while (%i > 0) {
    var %c = $comchan($nick,%i)
    if (($istok(%hide.channels,%c,44)) && ($nick(%c,$nick).idle > 180)) haltdef
    dec %i
  }
}


I understand that you'd rather see this implemented directly in mIRC, but my personal opinion is that it is unlikely to happen. This is your best alternative.

Re: Channel Events \ Channel System Menu [Re: MegaZeroX] #229082 20/01/11 08:18 PM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Originally Posted By: argv0
Show me that script acting slow and I'll change my mind.


It won't act slow but it does have a slight bug. Your on PART event needs some braces:

ON ^*:PART:%hide.channels:if (!$hget(hidejoins,$+($cid,.,$nick))) { haltdef | hdel hidejoins $+($cid,.,$nick) }

Otherwise it will try to /hdel an item that doesn't exist when the person leaving is not in the hashtable.

Originally Posted By: MegaZeroX
Here is the script I was using as of the last effort:

Quote:
on ^1:PART:#:{
if (%HaltDef: [ $+ [ $chan ] ]) { // If we are hiding events on this channel
var %%%evaluate = $+($chr(37), $chr(37), NoHaltDef:, $chan, :, $nick)
if ($eval(%%%evaluate, 2)) unset %%NoHaltDef: $+ $chan $+ : $+ $nick
else haltdef
}
}
on ^1:QUIT:{
var %%%comchan.scan = 1
var %%%comchan.max = $comchan($nick, 0)
while (%%%comchan.scan <= %%%comchan.max) {
var %%%comchan.chan = $comchan($nick, %%%comchan.scan)
if (%HaltDef: [ $+ [ %%%comchan.chan ] ]) { // Once again, if we are hiding events on this channel.
var %%%evaluate = $+($chr(37), $chr(37), NoHaltDef:, %%%comchan.chan, :, $nick)
if ($eval(%%%evaluate, 2)) unset %%NoHaltDef: $+ %%%comchan.chan $+ : $+ $nick
else haltdef
}
var %%%comchan.scan = $calc(%%%comchan.scan + 1)
}
}


Variables are horrible inefficient when compared to hashtables. Try using drum or argv0's scripts and you will see speed improvements.

Re: Channel Events \ Channel System Menu [Re: hixxy] #229084 20/01/11 10:07 PM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
The missing { } is intentional. As you can see, I'm haltdef'ing when the item is not present in the table. It is only present when they are active. Your change makes it so the item is never reset.

In any case, deleting an item that doesn't exist is not a bug, since it's effectively a noop. The point is to reset any state when they leave.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: Channel Events \ Channel System Menu [Re: MegaZeroX] #229086 20/01/11 10:14 PM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Originally Posted By: MegaZeroX
After I reiterated that I thought the feature was needed, you say you "don't believe me."


I'm not saying I don't believe the feature is needed. I was responding to:

Originally Posted By: MegaZeroX
Scripting *that* would slow down mIRC. Believe me, I've tried.


Don't act like you're a scripting champ and you "obviously" know what is feasible, when you don't. The point is that scripting it is not inefficient.

Again, it's unclear what you're suggesting. First you asked for programmatic commands, then you asked for channel specific settings, now [it seems like] you're asking to only hide inactive users. All of these three are completely separate suggestions, and you haven't really clarified exactly what you want.

To clarify my end: I believe that a channel independent UI control for showing/hiding events is "useful" (not "needed"). However, the rest of it (programmatic command, only hiding inactive users) brings this feature into scripting territory.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: Channel Events \ Channel System Menu [Re: drum] #229088 20/01/11 10:16 PM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
drum: You can't [just] use $nick(#,$nick).idle.

Idle is reset on join, which means 5 seconds after join, $nick(#,$nick).idle == 5.

Anyone who quickly joins/parts will show up even if they've said nothing in the channel. This actually accounts for a large chunk of "event noise" in large channels, where people join and quickly leave. You would see random parts from people who have said nothing. That's why I use a switch set via ON TEXT.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: Channel Events \ Channel System Menu [Re: argv0] #229089 20/01/11 10:27 PM
Joined: Jan 2003
Posts: 64
M
MegaZeroX Offline OP
Babel fish
OP Offline
Babel fish
M
Joined: Jan 2003
Posts: 64
Quote:
Don't act like you're a scripting champ and you "obviously" know what is feasible, when you don't


You're still trying to make this personal. Like I said, this isn't kindergarten.

Last edited by MegaZeroX; 20/01/11 10:28 PM.
Re: Channel Events \ Channel System Menu [Re: argv0] #229091 20/01/11 11:15 PM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Originally Posted By: argv0
The missing { } is intentional. As you can see, I'm haltdef'ing when the item is not present in the table. It is only present when they are active. Your change makes it so the item is never reset.

In any case, deleting an item that doesn't exist is not a bug, since it's effectively a noop. The point is to reset any state when they leave.


You're right. It's been a while since I scripted properly, I could have sworn that /hdel used to throw an error if the item didn't exist.. but it looks like it only throws an error when the table doesn't exist.

Re: Channel Events \ Channel System Menu [Re: MegaZeroX] #229092 21/01/11 12:02 AM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Actually, you're the one making it personal. I've asked you repeatedly to get back on topic and clarify your feature suggestion. You've yet to do so, and instead chosen to focus on "personal" issues. Frankly, I'm not even sure what you really want from this suggestion, anymore.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"