mIRC -> Tutorials -> 01

Yes, I'm a evil son of a bitch so I'm going to assume that everyone who reads this knows jack about scripting in mIRC.

There are three things you must remember;

  • the helpfile is your best friend
  • if something doesnt work, 99% of the time you messed up
  • hard work pays off

    Let's begin with something simple, a On Text event.

    Whenever someone says something on a channel, any On Text events you have loaded in your scripts are matched against what was said. Have a look at this code:

         
    on *:text:hi!:#:{
      msg $chan hi $nick how are you?
    }
         
        
    Seems easy enough, no? Press Alt+R and put it in the window that appears, if there's already some text in there use File -> New to create a new window. It's not a good idea to mix scripts unless you know what you're doing.

    Now that we've loaded this script it's time to see what it does (maybe you've already guessed it), ask someone to say "hi!" on a channel and...well, yeah, nothing special but it works :) Everytime someone says something that matches the text in the On Text event the code within the { } is executed, and a few commonly used variables are set. Like this:

         
    on *:text:hi!:#:{
      msg $chan hi $nick how are you? we're on $chan and the time is $time
    }
         
        
    You can already tell what this would do, so there's no point in trying it out, but that's how it works. You tell mIRC to wait for something to happen and when a matching On Text appears it says hi to him, or takes over the world, or anything else you've told it to.

         
    on *:text:hello:#:{
      msg $chan hello $nick !
      msg $chan isnt the weather outside nice?
    }
    
    on *:text:hi!:#:{
      msg $chan hi $nick how are you?
    }
         
        
    This is how it would look if you were to use more than one On Text event, you put them right after each other. This way you can use more than one On Text event and make your bot more fun or your script more flexible.

    If you thought this was easy (and it was), go and play around with all the different $ commands mIRC has. Press F1 while in the remote editor and a list of all the different commands and On events that mIRC supports is shown. Remember, the help file is your best friend!


    Next >>