mIRC Home    About    Download    Register    News    Help

Page 1 of 2 1 2 >
Topic Options
#209304 - 09/02/09 06:29 PM Unique nick/alternate for every network
unworthy Offline
Pikka bird

Registered: 09/02/09
Posts: 10
I always use a unique nick/alternate for every network. Is this possible in mIRC without installing a copy into multiple folders?

-unworthy

Top
#209312 - 09/02/09 11:36 PM Re: Unique nick/alternate for every network [Re: unworthy]
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
Yes.

The method I use, is to store the information in a custom ini file, although there may (and probably are) other options.

An example from my ini file:
Quote:

[network1]
mnick = main nick
anick = alt nick
password = password


The I use the following script
Code:
on *:connect:{
  if $ini(connections.ini,$network) {
    .mnick $readini(connections.ini,n,$network,mnick)
    .anick $readini(connections.ini,n,$network,anick)
  }
}
on ^*:notice:*This nickname is registered and protected.*:*:{
  if ($nick == nickserv) {
    .msg nickserv $readini(connections.ini,n,$network,password)
  }
  haltdef
}
on *:disconnect:{
  if !$ini(connections.ini,$network) {
    .writeini -n connections.ini $network mnick $mnick
    .writeini -n connections.ini $network anick $anick
    .writeini -n connections.ini $network password $$?="Enter nickserv password for $network"
  }
}

Additionally the /server command will allow you to specify the main and alternate nicks using the -i switch

See /help /server for more details.

Top
#209325 - 10/02/09 02:50 PM Re: Unique nick/alternate for every network [Re: RusselB]
unworthy Offline
Pikka bird

Registered: 09/02/09
Posts: 10
Perfect! Thank you so much, Russel!

Code:
.writeini -n connections.ini $network password $$?="Enter nickserv password for $network"


By the way, that line doesn't seem to be working, as I disconnected from several networks and it created mnick/anick, but never asked for password, nor did it create an entry in connections.ini.

Top
#209355 - 11/02/09 12:13 AM Re: Unique nick/alternate for every network [Re: unworthy]
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
Regretfully I'm at a loss to understand why that part didn't work, as I have been using that script for the past couple of years.

Top
#209358 - 11/02/09 12:44 AM Re: Unique nick/alternate for every network [Re: unworthy]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3494
Loc: France
How are you disconnecting from several network ? I've tried to use $? in a on disconnect event, and even when I disconnect from several network, it work, i've used :
Code:
on *:disconnect:echo -a $$?="test $network "
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#209359 - 11/02/09 12:56 AM Re: Unique nick/alternate for every network [Re: Wims]
DJ_Sol Offline
Hoopy frood

Registered: 04/01/07
Posts: 1156
Loc: Seattle
$$?="test $network "

This shows a message box and cannot be used in a script event. Best to just echo the window with normal text and identifiers. $nick . $network . $server . $me . $scid($cid).mnick

Also, right before you connect you can set nick. /nick newnick

Like,

server -n irc.server.net | nick <nickname> | server irc.server.net

This will open a new status window and crate a cid for the new connection but not connect to it. Then set nick and connect to server.

Top
#209360 - 11/02/09 01:10 AM Re: Unique nick/alternate for every network [Re: DJ_Sol]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3494
Loc: France
Tell me you have tested, before came here and say this...
It work perfectly fine, try it.
If you use //scid -at1 disconnect, it disconnect you from the first server connected, then waiting for the input request, then disconnect from the second server connect etc...
Also :

Originally Posted By: DJ_Sol
server -n irc.server.net | nick <nickname> | server irc.server.net

Originally Posted By: RusselB
Additionally the /server command will allow you to specify the main and alternate nicks using the -i switch
-m and -i could/should be used
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#209362 - 11/02/09 01:35 AM Re: Unique nick/alternate for every network [Re: Wims]
unworthy Offline
Pikka bird

Registered: 09/02/09
Posts: 10
Originally Posted By: Wims
How are you disconnecting from several network ? I've tried to use $? in a on disconnect event, and even when I disconnect from several network, it work, i've used :
Code:
on *:disconnect:echo -a $$?="test $network "


Using /quit or the disconnect button. Neither prompted.

Top
#209365 - 11/02/09 02:17 AM Re: Unique nick/alternate for every network [Re: unworthy]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3494
Loc: France
The problem is simple, what happen here is that $network" does not exists, mirc would said it if you have checked the "identifier warning option" in the mIRC script editor, but since there's a '.', it quiet the output and you don't see anything.
The question is why is there a dot since /writeini does not output a message that could be annoying (like /timer) ? I've seen so many script (whole script or not) do this on several command, always wondering why they wanted to hide errors...
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#209369 - 11/02/09 03:13 AM Re: Unique nick/alternate for every network [Re: Wims]
unworthy Offline
Pikka bird

Registered: 09/02/09
Posts: 10
Originally Posted By: Wims
The problem is simple, what happen here is that $network" does not exists,


Ah, yes. So, mirc sees the ." as part of the variable name. I added a space and it works exactly as expected. That's definitely a bug, as mirc should know the ." isn't part of the name, once it finds that the character after the . isn't alphanumeric. Instead, mirc thinks it's looking for the " property of the $network variable!

Thanks to Wims, and everyone, for the help.

Top
#209370 - 11/02/09 03:22 AM Re: Unique nick/alternate for every network [Re: RusselB]
unworthy Offline
Pikka bird

Registered: 09/02/09
Posts: 10
Originally Posted By: RusselB
Regretfully I'm at a loss to understand why that part didn't work, as I have been using that script for the past couple of years.


Sure, but when was the last time you disconnected from a network that you'd never visited, or that wasn't already present in connections.ini? wink I'm thinking that doesn't happen very often. laugh

Top
#209371 - 11/02/09 03:30 AM Re: Unique nick/alternate for every network [Re: unworthy]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3494
Loc: France
There's no bug.
The dot '.' is used to quiet output, this mean that nothing will be print out.
If for example you do //timer 1 1 noop, it will echo in you window :
Quote:
* Timer 1 activated
* Timer 1 halted
If now you do //.timer 1 1 noop, you won't see this message.
In the situation above, mirc parse $network" as an identifier and simply, either tell you that it does not exists if you have enabled the option "identifier warning" (as an error message), either it return the $null value.In both case, mirc will stop because it's either an error and mirc stop, either the double $ make mirc stop because he his seeing $$?="... (this return $null too).This is why RusselB never see any error, not because he doesn't use his feature often.


Edited by Wims (11/02/09 03:50 AM)
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#209372 - 11/02/09 03:47 AM Re: Unique nick/alternate for every network [Re: unworthy]
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
You'd be right that it's been a while.. probably a year minimum.

Top
#209376 - 11/02/09 05:10 AM Re: Unique nick/alternate for every network [Re: Wims]
unworthy Offline
Pikka bird

Registered: 09/02/09
Posts: 10
Originally Posted By: Wims
There's no bug.
The dot '.' is used to quiet output, this mean that nothing will be print out.
If for example you do //timer 1 1 noop, it will echo in you window


I think you've misunderstood what I wrote. I realize that the '.' in front of writeini silences the output, however, that isn't the problem to which I'm referring. The '.' at the very end of the line is the problem.

By adding a space after the 2nd $network, and before the '.' at the very end, the line works exactly as expected, because $network is defined, but $network[size:14pt].
isn't defined. (Notice the trailing period?)

That's the bug, (in my opinion), because mirc shouldn't see the '.' as being part of the variable name unless an alphanumeric character follows it.[/size]

Top
#209377 - 11/02/09 06:03 AM Re: Unique nick/alternate for every network [Re: unworthy]
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
This is not a bug, but, imo, expected behaviour.

It is possible to set up an alias called network. and call it as an identifier (see /help $isid)

In the code I provided $network exists but $network. does not
(ie: there is no trailing period with the $network identifier anywhere in the code I provided).

If you alter a working code and it stops working, then the problem is with the alteration of the code, not with mIRC.

Top
#209381 - 11/02/09 10:47 AM Re: Unique nick/alternate for every network [Re: unworthy]
DJ_Sol Offline
Hoopy frood

Registered: 04/01/07
Posts: 1156
Loc: Seattle
Yeah, teh identifier is $network, not $network. The bug is yours. smile Typo's are my bane!



$?*!="message"

Note: This identifier cannot be used in a script event.

So why does it work in the disconnect event then?

Top
#209386 - 11/02/09 01:51 PM Re: Unique nick/alternate for every network [Re: DJ_Sol]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3494
Loc: France
I was beleived this note was for $input but indeed, don't know why.


Edited by Wims (11/02/09 01:54 PM)
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#209387 - 11/02/09 02:42 PM Re: Unique nick/alternate for every network [Re: RusselB]
unworthy Offline
Pikka bird

Registered: 09/02/09
Posts: 10
Originally Posted By: RusselB
This is not a bug, but, imo, expected behaviour.

It is possible to set up an alias called network. and call it as an identifier (see /help $isid)


Alright, let's call it a feature. It is possible, but that doesn't give it an established purpose or make it especially useful. On the other hand, the purpose of a leading period in an identifier is well established. (e.g. echo -q) Of course, I may have forgotten, or missed, something in the docs, so don't hesitate to correct any mistake on my part.

Quote:
In the code I provided $network exists but $network. does not
(ie: there is no trailing period with the $network identifier anywhere in the code I provided).


Hm, nor is there one in my reply. I must be suffering from some form of dementia or senility in my old age crazy, because I don't remember making alterations. blush In fact, that must have been the only alteration, because the rest of the script matches verbatim. shocked

Quote:
If you alter a working code and it stops working, then the problem is with the alteration of the code, not with mIRC.


I couldn't agree more, except for the last three words. The usefulness of a trailing period in an identifier is somewhat debatable, imo.

In any case, thanks again for sharing the wonderful script! Huzzah!

Top
#209389 - 11/02/09 04:26 PM Re: Unique nick/alternate for every network [Re: unworthy]
DJ_Sol Offline
Hoopy frood

Registered: 04/01/07
Posts: 1156
Loc: Seattle
Many times Ive hit a ket without knowing while the script editor was open. Lol, or start typing somewhere else but the cursor was in the remote editor?? I can't be alone on this.

Top
#209427 - 12/02/09 03:16 PM Re: Unique nick/alternate for every network [Re: RusselB]
unworthy Offline
Pikka bird

Registered: 09/02/09
Posts: 10
I'd like to alter this script to update the e-mail address, as well, however, the connect event doesn't occur until after the connection is already made, and thus, uses the previous emailaddr setting. What's the best method of scripting an update to the setting just prior to connection?

Originally Posted By: RusselB

The I use the following script
Code:
on *:connect:{
  if $ini(connections.ini,$network) {
    .mnick $readini(connections.ini,n,$network,mnick)
    .anick $readini(connections.ini,n,$network,anick)
  }
}
on ^*:notice:*This nickname is registered and protected.*:*:{
  if ($nick == nickserv) {
    .msg nickserv $readini(connections.ini,n,$network,password)
  }
  haltdef
}
on *:disconnect:{
  if !$ini(connections.ini,$network) {
    .writeini -n connections.ini $network mnick $mnick
    .writeini -n connections.ini $network anick $anick
    .writeini -n connections.ini $network password $$?="Enter nickserv password for $network"
  }
}


Top
Page 1 of 2 1 2 >