mIRC Homepage

add connection id to events

Posted By: bebegood

add connection id to events - 24/01/10 02:13 AM

i mean, will be good if u add to events connection id, like:

example, 15 - will be $cid

on *:TEXT:!anytext:#channel:15: {

on *:CONNECT:15: { - too..
Posted By: Excalibur

Re: add connection id to events - 24/01/10 04:08 AM

While we already can use if ($cid == 15) { .... }, I kind of find this somehow useful.
On <level>:[cid]:...
Not a very bad idea.
Posted By: argv0

Re: add connection id to events - 24/01/10 12:15 PM

This is an error prone solution, since there's absolutely no guarantee that your connection will consistently be cid 15. Even with /scon numbers (the proper indexed values), it's error prone to assign events to an indexed connection. You should never even be writing "if ($cid == 15)", let alone "on *:TEXT:*:#:15", this is just bad practice.

Instead you should be checking $network (or a combination of $network and $nick if you have multiple connections to a network) for proper support. It would be "neat" if mIRC supported network names there, but given the amount of complexity you'd be adding to the syntax with such a feature, I really don't see the problem of just writing an extremely simple if statement.
Posted By: bebegood

Re: add connection id to events - 24/01/10 03:20 PM

Originally Posted By: Excalibur
While we already can use if ($cid == 15) { .... }, I kind of find this somehow useful.
On <level>:[cid]:...
Not a very bad idea.


yes and u can use if ($chan == #something), if ($1- == something) {

but it is added to event, so add connection id will be good too :p
Posted By: bebegood

Re: add connection id to events - 24/01/10 03:23 PM

Originally Posted By: argv0
This is an error prone solution, since there's absolutely no guarantee that your connection will consistently be cid 15. Even with /scon numbers (the proper indexed values), it's error prone to assign events to an indexed connection. You should never even be writing "if ($cid == 15)", let alone "on *:TEXT:*:#:15", this is just bad practice.

Instead you should be checking $network (or a combination of $network and $nick if you have multiple connections to a network) for proper support. It would be "neat" if mIRC supported network names there, but given the amount of complexity you'd be adding to the syntax with such a feature, I really don't see the problem of just writing an extremely simple if statement.



rofl, i just set it when i connect,set %connect_1 $scon(1) , set %connect_2 $scon(2)

so, after on *:TEXT:!something:#:%connect_1: {
Posted By: 5618

Re: add connection id to events - 24/01/10 03:35 PM

For starters it's a bad idea since it would break ALL existing on TEXT (NOTICE/ACTION/INPUT etc.) events.
The additional of a cid-section is pretty useless in my opinion, due to its lack of use. A $network additional would be far more useful.
Posted By: argv0

Re: add connection id to events - 25/01/10 06:57 PM

Quote:
i just set it when i connect,set %connect_1 $scon(1) , set %connect_2 $scon(2)


That is exactly what I mean by error-prone.

But more importantly, as 5618 said, you would break scripts.

Since /ab:cd is a valid command, the following could be interpreted in two ways:

on *:TEXT:*:#:15:echo -a hi

/echo -a hi or /15:echo -a hi. Both are valid, and "name:" is a reasonable alias prefix to the point where I'll bet there's at least a few scripts out there using that naming convention. The drawback is possible broken scripts and the gain is purely aesthetic.
Posted By: gooshie

Re: add connection id to events - 25/01/10 10:39 PM

I would rather it have a $serverip component with comma separated values and work with variables and identifiers just like the channel part of the event. $network and $server are sorta bogus identifiers since they can be set to anything the server wants. I wrote my script to check $serverip before it auto-idents to NickServ. But I think its a little late in the day for mIRC to go adding any of these features.
Posted By: argv0

Re: add connection id to events - 26/01/10 04:24 AM

The fact that $network is filled by the server is what makes it so useful for scripting, because it takes the server's actual ip out of the equation. This is especially important if mIRC starts scanning through a network's servers after an unsuccessful attempt. Also, if you didn't use mIRC's server list but simply decided to change servers or started using a bnc, you'd have to change your script each time you did so. That, again, makes it error prone. Yes, there are a few ways to maliciously take advantage of the server filling out $network, but it's really not a common attack vector (not to mention it barely gets you anything).
© 2022 mIRC Discussion Forums