mIRC Home    About    Download    Register    News    Help

Print Thread
#217868 24/01/10 02:13 AM
Joined: Jan 2010
Posts: 10
B
Pikka bird
OP Offline
Pikka bird
B
Joined: Jan 2010
Posts: 10
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..

Joined: May 2009
Posts: 139
E
Vogon poet
Offline
Vogon poet
E
Joined: May 2009
Posts: 139
While we already can use if ($cid == 15) { .... }, I kind of find this somehow useful.
On <level>:[cid]:...
Not a very bad idea.


- Excalibur
- Good and Evil, there never is one without the other.
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
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.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Jan 2010
Posts: 10
B
Pikka bird
OP Offline
Pikka bird
B
Joined: Jan 2010
Posts: 10
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

Last edited by bebegood; 24/01/10 03:21 PM.
Joined: Jan 2010
Posts: 10
B
Pikka bird
OP Offline
Pikka bird
B
Joined: Jan 2010
Posts: 10
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: {

Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
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.

Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
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.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Nov 2009
Posts: 117
Vogon poet
Offline
Vogon poet
Joined: Nov 2009
Posts: 117
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.

Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
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).


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

Link Copied to Clipboard