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.

Last edited by Erasimus; 09/07/19 02:26 AM.