Who's Online

We have 56 guests online

Wikipedia

Wikipedia

Go english german french spanish italian

Like us on FaceBook:


Home » #Class Lessons » Introduction to mIRC Scripting

Introduction to mIRC Scripting

PDF Print E-mail
Written by MindForge Team    Friday, 26 May 2006 13:37
Things needed for Scripting: mIRC program, mIRC helpfile. These can be found @ www.mirc.com

mIRC scripting is not a very hard "programming language" to master,
and it can be learned thru hard work and diligence.

Basically, mIRC scripting is made up of 3 main components : Aliases, Popups and Remote.
The following will be a general overview of these 3 main components.

Aliases

Aliases are the commands which you create in the Aliases tab of the
mIRC Scripts Editor and which you then type in your edit box (Alt+a).

Example : /mf /server <Mindforge server name>
Effects : Whenever you type /mf in the edit box, the script will process the alias which will then
               connect to a MindForge irc server via the command /server <Mindforge server name>
Note : This command can be used to connect to the same server everytime you enter mIRC.

You can also combine several commands by binding them together using { }
You can make a simple away system for instance ...

Example :
/setaway {
   away $$?="Enter AwayReason"
   nick $$?="Enter AwayNick"
   ame I'm currently away from my keyboard
 }

Or on one line, using " | " as a separator :

/setaway { away $$?="Enter AwayReason" | nick $$?="Enter AwayNick" | ame I'm currently away from my keyboard }

Effects : The $$? creates a popup window prompting you for a string/integer (letters/numbers).
Note : To test the effects of it, type : //say $$?="Enter what you want to say here"
            Or type : //echo -a $$?*="Enter 123"

When you type /setaway, the above command pops up 2 dialog boxes, one requests your Away Reason,  the other requests your Away Nick, then it sends to all channels that you are Away.

Aliases are not limited to this. You can also bind commands to keys like F1, F2, F3 ... etc.

Example : F1 { /server <Mindforge server name> }
Effects : Whenever you press F1, it will connect to the irc server that you have binded.

Popups

Popups are the simple graphic user interface used in mIRC.
They allow right click for menus and menubar (Alt+p).
There are 5 kinds of Popups which can be found in 5 different viewing areas.

a) Status    - popup menu with right click in Status window.
b) Channel   - popup menu with right click in any Channel window.
c) Query     - popup menu when right clicked at any Query window.
d) Nick List - popup menu when right clicked at selected Nick in the Nick List. *
e) Menu Bar  - popup menu when click on the Commands tab of the Menubar. **
 
*  Nick List is the box which contains all the nicks present in a channel.
** Menubar is the bar up top which contains, "File", "View" ... etc.

To start editing your current Popups, go to the Popup edit menu (Alt+p),
choose the Popup you want to edit by clicking on View, then choose the view you want.

You are a helper in the channel #Scripting, and you want to  address a User by highlighting his name in the Nick list ?

Format : <menu item>:<commands>
Example : At the bottom of Nick List Popup edit menu, type: Say: msg $chan $$1 $+ : $$?="Enter msg"
Effects : Say is the Menu item, while msg $chan $$1 $+ , $$?="Enter msg" are the command lines.
 
Of course, you can add multiple commands to a Menu item.

Example : Set Away: { away $$?="Enter away Reason" | nick Nube[Away] }

Just like Aliases, the brackets { } are used to combine multiple commands to a single binded item.
You can change the Menubar title of "Commands" to something else by adding it  as the first word in the first line of the Popup menu of the Menubar.

In Popups, you can define Menus and Sub-Menus too.
Adding a full stop ( . ) in front of a Menu item will make it a Sub-Menu.
To add more Sub-Menus, add another full stop.

Example :
 Test Menu
 .Test1: echo -a test1
 .Test2: echo -a test2
 ..Sub Menu
 ..Test3: echo -a test3

 
Remote

Remotes are automated commands triggered on certain events and they are considered as one of the most important elements in scripting automated functions.

Remotes are edited in the Remote editor (Alt+r).
There are no fixed formats for Remotes.
The mIRC help file shows the different formats for different events.

You wish to identify yourself to Services automatically everytime you connect ?

Format :  on <level>:CONNECT:<commands>
Example : on *:connect:/msg nickserv identify MyRegisteredNick $$?*="Enter Password"
Effects : This line of scripting pops up a password dialog box everytime you connect to IRC.

To see a list of events that Remotes are able to trigger on, type in any window : /help remotes

You want to auto-notice a specific person when they join in channel #test ?

Example :
 on *:join:#test: {
   if ( $nick == Nubela ) /notice $nick Hi, welcome to $chan $+ .
 }
Effects : Whenever somebody named Nubela joins #test, this line of code will auto-notice Nubela with the text.

Remotes not only trigger sets of commands on various events,  but they can integrate Aliases and Popups as well.

You want to add an Alias command into your script via Remotes ?

Example : alias mf { /server <irc server name> }
Effects : Does same thing as the line written in Aliases section : /mf /server <Mindforge server name>

mIRC allows you to change the display of events such as channel mode changes.

Example :
 on ^*:RawMode:#: {
   echo $colour(mode) $chan $$$ $nick sets mode: $1-
   haltdef
 }


Effects : Here, the above event changes the display which you would normally see as :
 *** Fred sets mode: +o Nubela
 to :
 $$$ Fred sets mode: +o Nubela