mIRC Homepage
Posted By: colt45 What sort of notices is this? - 27/06/19 07:56 AM
[07:50:17] * Your nick is now Colt45
[07:50:17] -NickServ- This nickname is registered and protected. If it is your
[07:50:17] -NickServ- nick, type /msg NickServ IDENTIFY password. Otherwise,
[07:50:17] -NickServ- please choose a different nick.
[07:50:17] -NickServ- Password accepted - you are now recognized.
[07:50:17] You need a registered nick to join that channel.
[07:50:18] * NickServ sets mode: +r

As you can see that it took 1 second for NickServ to set mode +r and my script went too fast.

So what and how do I fix that?

I've tried these 3 ON SNOTICE, ON NOTICE and ON ERROR but these 3 don't seem to pick up that "You need a registered nick to join that channel."

Also, tried to use ON USERMODE but can't find a way how to write code inside ON NOTICE as I didn't like to write code much, I'm still a newbie to coding.

Code
on *:notice:*:*:{
  if ($network == somenetwork) && ($nick == NickServ) {
    if (registered == $4) && (protected. == $6) { /ns identify password123 }
    if (Password == $1) && (accepted == $2) && (recognized. == $7) { /join #channel }
  }
}


The code above works for me, but it's just that I rarely get that "You need a registered nick to join that channel." - I think maybe because the server may be lagging a little?

By the way, I don't fancy the "timer" - but maybe a delayed script would work .. i.e. /delay 1 /join #channel .. this delay the command by 1 second? or something like that would be cool.

Thanks
Posted By: Loki12583 Re: What sort of notices is this? - 27/06/19 10:27 AM
It's not a notice, it's some raw numeric. You can capture it with /debug @debug

I can guess it's happening on reconnect? And you have 'rejoin channels on connect' enabled?

What's was wrong with your usermode code?
Posted By: colt45 Re: What sort of notices is this? - 27/06/19 11:02 AM
Ah right, I guess I have to figure out how to use raw numeric.

"Rejoin Channels on connect" is disabled as sometimes I join a channel or 2 but forgets to part channel after a while so I rather have everything done via script so that it'll force myself into necessary channels.

How do I use usermode under my script? do I have to make a new "on USERMODE"?

Everything runs when I first run mIRC so I use "ON START" and "ON CONNECT".
Posted By: maroon Re: What sort of notices is this? - 27/06/19 01:56 PM
/help Raw events

This will trap all raw events, followed by the normal display created by them. Once you figure out which one you want, the numeric can replace the 1st asterisk. Note that raw events are slightly different in that their $1- is populated a little differently than TEXT or NOTICE, so expect $1 to be your current nick. The raw text string will also be different than the normal string displayed, so you can't always assume what the raw string will be simply by looking at the status window message you otherwise see.

Code
raw *:*:{ echo 5 -s raw event $numeric -> $1- }
Posted By: colt45 Re: What sort of notices is this? - 28/06/19 02:52 PM
Originally Posted by maroon
/help Raw events

This will trap all raw events, followed by the normal display created by them. Once you figure out which one you want, the numeric can replace the 1st asterisk. Note that raw events are slightly different in that their $1- is populated a little differently than TEXT or NOTICE, so expect $1 to be your current nick. The raw text string will also be different than the normal string displayed, so you can't always assume what the raw string will be simply by looking at the status window message you otherwise see.

Code
raw *:*:{ echo 5 -s raw event $numeric -> $1- }



Cheers, i got that to work now... however, is there's a way I can write code into 1 block? i.e.

Code
on CONNECT {
}

on NOTICE {
}

RAW {
}


All into 1 code block? Or that's not possible? As I'd like to keep script all tidy so that I can follow the code easier rather than looking up in CONNECT and code if necessary and then code bit extra under NOTICE and RAW, etc.. wink

Sorry if i'm sound like a n00b but i'm actually not good at scripting - can only do very basic frown
Posted By: Erasimus Re: What sort of notices is this? - 09/07/19 12:07 AM
Quote

Cheers, i got that to work now... however, is there's a way I can write code into 1 block? i.e.

Code
on CONNECT {
}

on NOTICE {
}

RAW {
}


All into 1 code block? Or that's not possible? As I'd like to keep script all tidy so that I can follow the code easier rather than looking up in CONNECT and code if necessary and then code bit extra under NOTICE and RAW, etc.. wink

Sorry if i'm sound like a n00b but i'm actually not good at scripting - can only do very basic frown


Personally I would not do it all in one block as you are asking for, that is really muddying things up. I find it easier to have a sequence of On Notices like the following -
Code
On *:NOTICE:*This nickname is registered and protected*:*:{ //nickserv identify %Password }

On *:NOTICE:*Password accepted - you are now recognized*:*:{ /Join #<whatever> }


I have regularly seen the join command(s) be sent to the server, well before the +r message comes back to my client, but it doesn't appear to make any difference to the joins. I suspect that the server I am using (it's a small private one) is queuing up messages to be sent out. Remember the setting of the +r may have been applied before you get the message saying it has been applied.

If you want to wait for that and then act you can leave out the 'password accepted' On Notice from above and replace it with
Code
On *:USERMODE: {  if ($1 = +r) { /join #<whatever> }  }


There is the other advantage to having an On Notice for each message that you want to respond to. The way you are doing it, every single NOTICE that is sent to your client will be processed by your single block On Notice, and execution is only aborted (asssuming the message doesn't match what you are testing for) within certain parts of your code, and that code will get bigger as you continue to make it a single all encompassing block.

In the standard method, I used (and thats the way it is presented in examples) the non-matching notice is aborted out of the block without going inside it.

The more you process inside the block before the message is found to not match, the longer your code will take to achieve that, in other words you are slowing the script down.

One other change that I do is to get rid of all those unnessary messages that fill up the status window by using the '^' character at the ON Notice 'declaration' part and haltdef to stop mIRC from displaying them.
Think about it, does you really need the other 2 lines ?
Quote
[07:50:17] -NickServ- nick, type /msg NickServ IDENTIFY password. Otherwise,
[07:50:17] -NickServ- please choose a different nick.
when you responded to the first ?

Code
On ^*:NOTICE:*This nickname is registered and protected*:*:{ 
   //nickserv identify %Password
   /echo -st Identifying to Nickserv
   haltdef
}

On ^*:NOTICE:*/msg NickServ IDENTIFY*:*:{ haltdef }
On ^*:NOTICE:*please choose a different nick*:*:{ haltdef }

On ^*:NOTICE:*Password accepted - you are now recognized*:*:{ 
     /echo -st Password Accpted - Joining Channels
     /Join #<whatever>
    haltdef
}


Then same thing applies when you are dealing with raw numericals. One humungous block is confusing to read later on (a few years after you wrote it) while several different on raw commands, one for each numeric that you process is easier to understand.

Incidently, what you refrred to in your original post are notices. Thats why they started with ' -NickServ- '
I suspect the 1st line is actually from your mIRC client since it startes with an astrix -> * Your nick is now Colt45.
You would only see that if you changed to that nick just before the message appeared.
© mIRC Discussion Forums