mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
How could be done? #213290 24/06/09 05:24 AM
Joined: Dec 2003
Posts: 18
B
BlackAcidDevil Offline OP
Pikka bird
OP Offline
Pikka bird
B
Joined: Dec 2003
Posts: 18
Basically what I want to do when joining a certain server change my nick for that server, identify myself, join a channel, and set channel modes

something like

on *:connect:irc.testserver.net /nick testnick /msg NickServ IDENTIFY password /join #testchannel /mode +abc

I looked through mirc's help file but I am not able to put these commands together in a script and have them work properly. Any help is appreciated.

Re: How could be done? [Re: BlackAcidDevil] #213292 24/06/09 11:08 AM
Joined: Dec 2008
Posts: 1,511
westor Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
Yes you can try using this:

Code:
ON *:CONNECT: {
  if ($server == irc.testserver.net) {
    nick testnick
    .msg NickServ IDENTIFY 12345
    timer 1 3 join #mychan1,#mychan2
    mode $me +abc
  }
}


more information help about it try : /help on connect

Re: How could be done? [Re: westor] #213298 24/06/09 06:01 PM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
That won't work.

He wants to set channel modes, not user modes. You can't do this from one event

See here for the reason why: http://kthx.net/ftb/#54


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: How could be done? [Re: argv0] #213322 24/06/09 09:59 PM
Joined: Dec 2008
Posts: 1,511
westor Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
I didn't read the hole post, So then try this:

Code:
ON *:CONNECT: {
  if ($server == irc.testserver.net) {
    nick testnick
    .msg NickServ IDENTIFY 12345
    timer 1 3 join #mychan1,#mychan2
    timer 1 4 mode #channel +abc
  }
}


Edit: There are more way's to do that you want, Just i gave you the more simple way that i know until now.

Last edited by westor; 24/06/09 10:01 PM.
Re: How could be done? [Re: westor] #213329 24/06/09 11:26 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I'd recommend something like
Code:
on *:connect:{
  if (<network_name> isin $network) {
    if $me != $mnick {      .nick $v2    }
  }
}
on *:notice:*is registered and protected*:{
  if ($nick == nickserv) {    .msg $v2 identify <password>  }
}
on *:notice:Password accepted*:*{
  if $nick == nickserv {    .join #chan1,#chan2,#chan3  }
}
on *:op:#:{
  if $opnick == $me {    .mode $chan <modes>  }
}

As noted, the timing is the biggest hassle, and rather than guess at a fixed time delay, my code waits for specific information to be received before going onto the next step.
Thus, even if services are extremely lagged (and I've seen lags of up to 10 seconds for services), or extremely fast (in the millisecond range), there is minimum delay between when an operation has been completed and when the next one will take place.
The main problem that I have with this code (although I use something similar myself), is the fact that if services go completely down, then come back, you will end up with a repeat of the join to the channels, which could make you end up sending a message to the wrong channel, due to the fact that each channel takes focus when you join it.
There are ways of avoiding most of that, but they require even more code than has already been done here.

Re: How could be done? [Re: RusselB] #213330 25/06/09 12:24 AM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
What if the mode +abc has already been set? Maybe a check for $chan(#).mode is needed so that it won't set the mode again once you enter the channel?

Re: How could be done? [Re: Tomao] #213332 25/06/09 01:07 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Good point. That check is easily added, as I'm quite sure you know.

Re: How could be done? [Re: RusselB] #213333 25/06/09 03:02 AM
Joined: Dec 2003
Posts: 18
B
BlackAcidDevil Offline OP
Pikka bird
OP Offline
Pikka bird
B
Joined: Dec 2003
Posts: 18
Thanks to everyone for replying!

Here's what I have:
Code:
on *:connect:{
  if (slashnet isin $network) {
    if $me != $mnick {      .nick $v2    }
  }
}
on *:notice:*is registered and protected*:{
  if ($nick == nickserv) {    .msg $v2 identify abc123  }
}
on *:notice:Password accepted*:*{
  if $nick == nickserv {    .join #testchannel  }
}
on *:op:#:{
  if $opnick == $me {    .mode $chan +k 123xyz  }
}
I don't understand where the nick gets changed from my normal nick to the nick I want to use on this server. I am using slashnet.org only for an online game clan and want to use my clan name only with this server. I messed around with the code for a couple hours just to try to even get identify to work when I set my nick to the correct one before joining the server. I just can't seem to get any of this do anything.

Even just trying this after identifying isn't doing anything.
Code:
on *:notice:Password accepted*:*{
  if $nick == nickserv {    .join #testchannel  }
}


What am I missing?

Thanks!

Last edited by BlackAcidDevil; 25/06/09 03:04 AM.
Re: How could be done? [Re: BlackAcidDevil] #213336 25/06/09 03:57 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
In
Code:
 if $me != $mnick {      .nick $v2    }
change $mnick to the nick you want to use for that network.

Re: How could be done? [Re: RusselB] #213337 25/06/09 05:22 AM
Joined: Dec 2003
Posts: 18
B
BlackAcidDevil Offline OP
Pikka bird
OP Offline
Pikka bird
B
Joined: Dec 2003
Posts: 18
The nick changing part is working great. After some reading in the mirc's help file and looking at the code I am understanding whats happening a lot better.

Code:
if $me != MyNick {      .nick $v2    }

if i'm not equal to MyNick /nick MyNick. Where $v2 is the second part of $me != MyNick

Code:
on *:notice:*is registered and protected*:{
  if ($nick == nickserv) {    .msg $v2 identify abc123  }

on notice from nickserv with the statement *is registered and protected* /msg nickserv identify password. Where * are wild cards for the beginning and ending of the message

This part of the code is not working nor is the rest for obvious reasons; this part is broke. When I change my nick I get 2 notices:
-NickServ- This nickname is registered and protected. If it is your nickname, type /msg NickServ IDENTIFY password. Otherwise, please choose a different nickname.
-NickServ- If you do not change your nickname within one minute, it will be changed automatically.

The way the script is written I don't see why 2 notices should really matter as the script is just waiting for the first notice to proceed to the next command of identifying.

Hopefully I don't sound like an idiot. Any ideas? Thanks!




Last edited by BlackAcidDevil; 25/06/09 05:25 AM.
Re: How could be done? [Re: BlackAcidDevil] #213338 25/06/09 06:51 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
You're missing the location parameter for the ON NOTICE event.
Code:
on *:notice:*is registered and protected*:*:{ 


The two notices are used for different reasons.
The first one (as mentioned in this post) is the notice from nickserv telling you that the nick is registered and protected.
If you want to use the nick, you have to identify yourself as tnee owner of the nick, otherwise nickserv may (and probably will) change your nick after 20-60 seconds.

The second notice is nickserv's message confirming that the identification sent for the first notice was accepted.

Re: How could be done? [Re: RusselB] #213340 25/06/09 10:23 AM
Joined: Dec 2008
Posts: 1,511
westor Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
And what about if the server netsplit and the services came back or when restarting network services and the user is on the currently channels that have joined on the CONNECT ?

e.g:
Code:
on *:notice:Password accepted*:*{
  if ($nick == nickserv) { .join #chan1,#chan2,#chan3 }
}


this must be like this corrected:

Code:
on *:notice:Password accepted*:*{
  if (($nick == nickserv) && ($me !ison #chan1,#chan2,#chan3)) { .join #chan1,#chan2,#chan3 }
}


Re: How could be done? [Re: westor] #213343 25/06/09 12:05 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
It can be modified like you have shown, but saying that it must be changed is ridiculous. If you do a /join #channel when you are already on that channel, you simply force that channel to become the active channel.

Additionally, the op was enquiring as to why the ON NOTICE event was not triggering, which is what I answered.

Out of curiosity, did you try your modification?
I tried the following
Code:
//var %chans = #DragonsDen,#Help,#X-Staff,#mirc_scripting | echo -a $iif($me ison %chans,$v2,$v1)
on a network where I was on all of the channels specified, and it returns the $v1 whether I'm on all of the channels or not, thus your modification that must be made, by my testing, does not work, which, imo, is worse than having channels re-joined while already on the channel.

Last edited by RusselB; 25/06/09 12:24 PM.
Re: How could be done? [Re: westor] #213344 25/06/09 12:07 PM
Joined: Nov 2006
Posts: 1,559
H
Horstl Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
You cannot check for "ison <multiple channels>". You'd have to check each channel separately... the suggested condition will always fail and the code will always issue the join command (and the "correction" will have zero effect).
But if you're already on some a channel, another /join command won't hurt at all smile

Re: How could be done? [Re: RusselB] #213348 25/06/09 01:49 PM
Joined: Jun 2003
Posts: 994
C
CtrlAltDel Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Jun 2003
Posts: 994
Originally Posted By: RusselB

The main problem that I have with this code (although I use something similar myself), is the fact that if services go completely down, then come back, you will end up with a repeat of the join to the channels, which could make you end up sending a message to the wrong channel, due to the fact that each channel takes focus when you join it.
There are ways of avoiding most of that, but they require even more code than has already been done here.


Not you particularly, but to everyone ...

Does the /join -n #1,#2,#3 not eliminate the "taking focus" problem mentioned here?

Originally Posted By: Tomato
What if the mode +abc has already been set?


If the channel mode is already set and you try to reset it, nothing happens. At least not on any of the networks I'm on.


I refuse to engage in a battle of wits with an unarmed person. wink
Re: How could be done? [Re: CtrlAltDel] #213350 25/06/09 02:35 PM
Joined: Dec 2008
Posts: 1,511
westor Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
Originally Posted By: Tomato
If the channel mode is already set and you try to reset it, nothing happens. At least not on any of the networks I'm on.


This is depended from the network services, The newest network services like (Unreal 3.2.7) if you try to set a channel mode and exists then the network use HALT into your mode!

Re: How could be done? [Re: CtrlAltDel] #213367 25/06/09 03:33 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Quote:
Does the /join -n #1,#2,#3 not eliminate the "taking focus" problem mentioned here?
Yes it will, but I didn't know if the OP wanted the channels opened in minimized format, as that means they will have to go through and un-minimize any channel(s) that they want to see.

Re: How could be done? [Re: RusselB] #213375 25/06/09 06:48 PM
Joined: Dec 2003
Posts: 18
B
BlackAcidDevil Offline OP
Pikka bird
OP Offline
Pikka bird
B
Joined: Dec 2003
Posts: 18
RusselB thanks for all your help and writing that code for me! Also thanks to all the other people that replied with suggestions! This is what I have and it is working great.
Code:
on *:connect:{
  if (slashnet isin $network) {
    if $me != MyNick {      .nick $v2    }
  }
}
on *:notice:*is registered and protected*:*:{
  if ($nick == NickServ) {    .msg $v2 identify password  }
}
on *:notice:Password accepted*:*:{
  if ($nick == NickServ) {    .join #testchannel  }
}
on *:op:#:{
  if ($opnick == $me) {    .mode $chan +k 123xyz  }
}

Re: How could be done? [Re: BlackAcidDevil] #213376 25/06/09 07:11 PM
Joined: Dec 2003
Posts: 18
B
BlackAcidDevil Offline OP
Pikka bird
OP Offline
Pikka bird
B
Joined: Dec 2003
Posts: 18
I guess not, thought channel modes were being set but they are not. I'm gonna figure this out myself. Thanks again!

Re: How could be done? [Re: BlackAcidDevil] #213380 25/06/09 10:35 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
If the mode(s) that you are applying are not being kept, try checking with chanserv to see what (if any) modes are locked using mlock.
If the mode(s) that you are trying to set are being countered by chanserv's mlock, then you need to find out who has access to change the mlock options on chanserv for the channel in question.

That's the only thing I can think of that would keep the code you posted from working.

Page 1 of 2 1 2