mIRC Homepage
Posted By: invy I need some simple IRC script help please... - 01/03/07 03:07 AM
Well, it's not simple for me since I have no idea how it supposed to look like but it's probably easy as pie for you guys. I just need some examples to go by. smile

I'm just wondering about a few things:

1) how to make a script so it automatically connects me to a particular server, and join a channel with a specified username.

2) a script to connect me to a new server (without exiting the previous) and with a new/different alias. I need to join a total of 3 or 4 different servers.

3) also, a particular server requires me to login using the following command: /login username password. and make it join a particular channel, again, of course. no need to change nick for this one as it automatically does it for me when I identify.

thanks for any help. smile

Also, how to run the script so I open mIRC and it does everything automatically with a click of a button or so.
There have been several scripts done for multiple connections.

All of your requests can be handled using the /server command.

You should read through the help file in the following areas:
on connect
on start

There have been several requests like yours, and scripts have been written to do what you're asking for.
Sorry about that. I thought this was more advanced and wouldn't have been covered in the FAQ. I got the basic idea of it now, I see that you can enter the scripts in the popups tab menu.

can you direct me to the 3 areas you mentioned? I can't seem to find them in the MIRC FAQ.
try using '/help' instead of the FAQ. It has all of the mIRC aliases and commands, excluding network commands.
Bingo. Just what I was looking for. Thank you.

Now i'm still having problems. And quite frankly, I don't have the patience for this.

Under what script tab do I work under? I was using the Popups one but that seems kinda awkward. Under Remote maybe, or another one? And how exactly do I run the script when I first open mIRC? I looked through the FAQs and couldn't find info on how to run it.

Can you please give me a example for me to work with? I feel I can learn it better by example rather than trying to sit here for hours trying to make it work. I will outline what I want to do:

-connect to server irc.BLAH.org on port 55000

when I connect to this particular server, it will then ask me to identify with the '/login username password' command. So please tell me how to fit this in the script. I tried it but it just ignored the command. I'm probably doing something wrong here and don't realize what.

- join channel #BLAH.

-open a NEW server window and connect to irc.p2p-irc.net on port 6667

-change my nick to Invy if it's not already.

-join two channels on this server: #utorrent and #sportbit.

That's it. Pretty simple stuff. I mostly need to know how to successfully identify in #1, and how to make the transition to a new server window. From here, I can go by the example and connect to the rest of the servers that I need to connect to. Then i'll be satisified.

I'd appreciate any more help.
All scripts can be done in just the Remotes window. You *can* put aliases in the aliases tab and popups (menus) in the popups tab, but it isn't necessary.

To create a new window, use /server -m irc.server.net ... the -m makes a new window.

To access things in the help file, you'd use stuff like:

/help on connect
/help /server
/help on start

on START will start things when you start mIRC. on CONNECT will do stuff when you connect to a network. Examples are in the help file.

An example is:

on *:START: {
  server irc.network1.net 6667 -i nick -j #chan,#chan
  server -m irc.network2.net 6667 -i nick -j #chan,#chan

on *:CONNECT: {
  if ($network == network1) {
    login password stuff
  elseif ($network == network2) {
    Do something if needed
i think it is easer just to use perform.ini like i have
The nice thing with not doing that is that you can keep your entire script in a single file rather than spreading it out over multiple files. It also makes it easier to distribute. Distributing with a popups file is troublesome for users.
I tried using perform on connect before, but the problem with that is it only works for servers that are in the server list! The ones I add myself don't show up in it!

How do I get around that? I think perform would be easier.
ugh i'm getting pissed off! no matter what I do it keeps telling me this:

[16:34] -irc.org- *** Looking up your hostname...
[16:34] -irc.org- *** Checking Ident
[16:34] -irc.org- *** Found your hostname
[16:34] -irc.org- *** No Ident response
[16:34] -irc.org- *** You didn't specify a password.
[16:34] -irc.org- *** Login Failed. Please use /LOGIN <nickname> <password> to gain access.
perform (mirc's) only works according to Network name and not server.

to findout your network name, type //echo -a $network
this should show network name (if it has one)

if you connect to server only (that does not belong to network)
perform wont work then, you should do your own scripting then
with ON CONNECT event:

on 1:CONNECT:{
if ($server == your.server.name) { do your login commands }
I'd assume that you have to wait until your login is accepted before joining a channel on the restricted network
(which we're calling BLAH), and that the server sends you a notice that your login was successful.
So going by your third post:
on *:START: {
  server irc.BLAH.org 55000
  server -m irc.p2p-irc.net 6667 -i Invy -j #utorrent,#sportbit
on *:CONNECT: {
  if ($network == BLAH) {
    editbox -an /login username password
on *:SNOTICE:*response_text_here*:*:join #BLAHchan

Obviously you need to change:
  • irc.BLAH.org
  • BLAH
  • username password
  • response_text_here
  • #BLAHchan
to your values.

Copy the edited script to Windows clipboard.
Open mIRC.
Type ALT+R twice.
On the menu, choose File | New
Paste the edited script. [or paste the original and edit it here.]
On the menu, choose File | Save As...
and name the script something recognizable, e.g. MyConnects.mrc
Click OK.
To test, close and reopen mIRC.

Any problems, post back.
Yes, you are correct, LonDart. I have to wait for the server to prompt me for my login info. Then, I can use the /login username password and it will automatically change my username to what is registered in the db.

Everything seems to work fine, except, i'm just a bit confused on that response_text_here part that you mentioned...

What part of the response text do I type in there? The "You didn't specify a password" or the "Login Failed. Please use /LOGIN <nickname> <password> to gain access." part?

Also, do you have any idea why there is about a 10 second pause between the following two lines or how to fix it?:

[18:02] -irc.BLAH.org- *** Found your hostname
*pauses for about 10 seconds here*
[18:02] -irc.BLAH.org- *** No Ident response
*the rest of server response....*

I really appreciate all the help so far.

When you login to that server manually, doesn't it give you a message when your login is successful?

For example, when I auth on my network, a bot notices me and I see
[timestamp] -bot- Authentication Successful!
so I use
on *:NOTICE:*Authenticat*:*: join #mychannel
(I wildcarded it like that to also catch the bot's response of "You have already Authenticated yada yada" )

I was assuming your message would come from the server, so you would use
on *:SNOTICE:*response_text_here *:*: join #mychannel

Replace *response_text_here* with the message you get when you login successfully.
No point trying to join if it didn't work smile

If SNOTICE doesn't work, try NOTICE.

The ident lag is probably a firewall issue. I'll have to try to find what it was that I did. I know I tried several things before it worked okay.

Re-reading I see you have to wait for a prompt to log in.
So we need to change the
on *:CONNECT: {
on *:SNOTICE:<exact prompt text here>:*: {

I'm trying to make sense, really I am.
Ok... when I successfully identify with the /login username password , I get this:

[19:05] * Your nick is now MYNICK
[19:05] -irc.org- *** Connecting to MySQL...
[19:05] -irc.org- *** Connected to MySQL. Authenticating you...
[19:05] -irc.org- *** You have been authenticated!
[19:05] -irc.org- *** Spoofing your IP.
[19:05] -irc.org- *** You are exempt from idle limits.

[insert LUSERS MOTD and TIME here]

and that's it... so, which one of those lines is the response?

btw, I fixed the no ident response by forwarding the port in my WRT54GL router. no more lag..thanks.
I would use
on *:SNOTICE:*You have been authenticated*:*: join #mychannel

Were you able to get the login automated?
Say you see a prompt of "Please log in"
on *:SNOTICE:*Please log in*:*: {
    editbox -an /login username password
ought to work.

I still can't get it to login it just says:

[20:48] -irc.BLAH.org- *** You didn't specify a password.
[20:48] -irc.BLAH.org- *** Login Failed. Please use /LOGIN <nickname> <password> to gain access.

BTW, do you think it's that editbox part that is the problem? There isn't really an edit box...
OMG I fixed it! This worked:

on *:START: {
server irc.BLAH.org 50000 MYPASSWORD

on *:SNOTICE: {
if ($network == irc.BLAH.org) {
editbox -an /login MYNAME MYPASSWORD
on *:SNOTICE:*you have been**: /join #CHANNEL

So yeah, apparently my password needs to be after the PORT NUMBER.

Is that middle 'SNOTICE' part redundant, do you think? Also, I deleted all the { and } brackets and it worked fine without them.... it makes everything look complicated.

Thanks for all the help! ^_^
Yeah. If sending your password with the server command works, you can
trash that first on SERVER (the one with the editbox line).

If you add more servers to the on START, remember to use
/server -m etc. etc.
to keep from closing the other server connections.

Glad you got it working smile
The first SNOTICE section is invalid anyhow. Just remove it. You cannot remove {}'s without problems unless everything in the event is on a single line. And that can make it difficult for people to help fix problems later because it's harder to read.
brackets are used to specify a chain of commands, when it's only one command you can skip using brackets
And his had multiple commands on multiple lines. I know what works and doesn't. smile
© mIRC Discussion Forums