Back / Index / Frames / Next

Return To Main MIRC Menu

  MIRC Remotes Scripts  

Having covered Events scripting in mIRC already, in this tutorial I shall show you the true potential of Remotes Scripting. A mIRC remotes script can be made to include aliases, popups, events and more, all grouped together in one exchangeable file.

Loading and Unloading mIRC Remotes Scripts is so easy, either with the command /load -rs <filename> or from the File menu of the mIRC editor. This can be used to create modular scripts. You just load and unload the modules as you want.

You will find some script modules in the Download area.

Aliases in mIRC Remotes

Adding alias scripts via a mIRC remotes script instead of the alias script is very simple. The main use of this technique is to keep all the parts of a module together. The aliases, popups and remotes of a module all in the one file.

alias <alias name> <command to perform with all parameters>

Note that the only difference between the Remote script alias above and a normal alias script is the addition of the prefix alias. In the following example an alias is combined with an event script:

alias titles {
if ($server == $null) set %served Not Connected
else set %served $server
%timez = $left($time,5)
titlebar - < $+ $me $+ > - Server: $+ [ [ %served ] ] - Time: %timez
}

on *:START:./timertitle 0 10 /titles

The alias is called 'titles' and sets the variables %served (to show the server you are connected to) and %times (to show the first 5 characters of the current time) and then displays these details, with your current nick in the titlebar as a kind of status display.

The 'on *:START' event is triggered when you start mIRC. It starts a timer up called 'title' which runs the /titles command (our alias) every ten seconds. This means that the status displayed on our titlebar is refreshed and updated every 10 seconds while mIRC is running.

There are two proceedures and one command that we haven't covered before in that example Remote Script. The square brackets around [ [ %served ] ] are used to force a re-evaluation of the %served variable's value. The dot '.' prefixing the ./timertitle command makes mIRC perform the command 'silently'. In this case preventing mIRC from echoing information about starting and stopping the timer.

/timer[name] [-ceom] [time] <repetitions> <interval> <commands>

The /timer command sets a timer that will activate the command given every <interval> seconds until it has been repeated <repetitions> times. If you specify <repetitions> as 0, the timer's command will repeat endlessly at the interval specified in <interval>.

You can optionally set a specific time, and the timer will activate at that time:

/timer9 14:30 1 1 /say It's now 2:30pm

The switches (-ceom) control other optional settings. If you specify the -c switch, this makes mIRC "catch up" a timer by executing it more than once during one interval if the real-time interval isn't matching your requested interval.

If you specify the -m switch, this indicates that the interval delay is in milliseconds (1000 milliseconds per second). Note: millisecond timers can slow mIRC down significantly because each timer can trigger many times per second, so they should not be used unless they are necessary.

To see a list of active timers type /timers. To see the setting for timer1 type /timer1. To deactivate timer1 use /timer1 off. To deactivate all timers use /timers off.

The name is optional. If a name is not specified for the timer mIRC will allocate the first free timer number to it automatically.

Popups in mIRC Remotes

To add popups via a mIRC Remotes Script you simply define which menu of popups you want to add to, and then list the popups in the same format as used when you used the popups editor.

menu status {
Server
.Links:/links
.Lusers:/lusers
.Motd:/motd
.Time:/time
}

In the above example, menu tells mIRC that we are defining items for a popup menu. The example is for the status popups, but you could set nicklist, channel, query or menubar popups instead.

If you have trouble understanding the above example you should probably refer back to the mIRC Popups scripting tutorial. The only differences between a Remotes Script popup definition and that used in a Popups script is the line:
menu status {
and the final:
}
that closes the multiple lines opened by the first line.

Remotes Events Groups

Events are scripted in the remotes editor anyway, so there is naturally no difference at all in the proceedure as described in the mIRC Events tutorial.

However, one new thing to learn about events is creating Groups, which can be enabled and disabled collectively either on command or via scripting.

#group1 off
on !1:JOIN:etc.
on !1:PART:etc.
#group1 end

Only the first and last lines of the above example are important. The central two lines are just to illustrate where you put events within a group definition.

The first line format is the # prefix to the group name. There can be no space between the # and the group name. The second part is the status of the group (off or on). When the first line ends in on the group is enabled and the events scripted within the group will be used.

the command /enable #<group name> will switch a group 'on' while the command /disable #<group name> will switch the group off. When a group is disabled the events within the group are totally ignored by mIRC.

#blooz off
on *:INPUT:*:{
if ($left($1,1) == /) return
if ($left($target,1) == @) return
set %myline $1-
/say 11:12,11:2,12:12,2:11,2 %myline 12,2:2,12:12,11:11,0:
/halt
}
#blooz end

;Note:  = Ctrl + K (see text control page for details)

The above script takes the text you input at an editbox and looks to see if it begins with a '/' command prefix, or if it was entered into a custom window. If either of those conditions are true it returns to mIRC's normal processing, ignoring the rest of this script.

If the entered text was neither prefixed with a '/' slash nor entered into a custom window mIRC knows that this is just a chat message and adds colour codes to the line automatically to 'jazz it up'.

By following these lines with an popup to switch the group (and thus its effect) on and off you have a quick and easy text effect. You just type as normal and when the effect is on (group is enabled) you have funky text effects added. But whenever you wish you can turn the effect off (disable the group).

menu menubar {
Blooz Text:
.Switch ON:/enable #blooz
.Switch OFF:/disable #blooz
}

Putting it all together

If you have been through all the tutorials to this point you have covered all the essential details of mIRC scripting. All that remains is to put the ideas together and create some scripts.

When writing scripts it can be a good idea to include comments. Comments help you (and others who might use the script) to understand the steps and proceedures you are following. Prefix a line with a semi-colon ';' to let mIRC know it is a comment and mIRC will ignore the line when processing the script.

;This is an example of a comment
; mIRC ignores these lines

Writing a script can be a little like putting together a jigsaw puzzle. The whole script is made up of smaller functions, controls and sub-routines that must be carefully fit together to form the unified whole.

Using comments will help you in identifying the pieces as you go about putting it all together. Moreover, when you later update or rework the script, long after you have forgotten the details of each step, the comments will help you once again.

Remote Script Samples

Having completed the tutorials of each of the various aspects of scripting, and having now learnt about unifying those processes into a single mIRC Remotes Script the only fitting examples are modular scripts.

You can play with the mIRC script writing Java Applet. to generate your own example mIRC Remotes scripts. You have all the basic understanding needed to start creating your own scripts. Play around with the principles you have learnt and you will surprise yourself with what can be easily accomplished.

The Downloads area will provide you with a range of samples to download and examine. All scripts and add-ons in the Downloads Area are fully functional. Take a look at what they do and how they accomplish it. Use the search function in mIRC's help files to quickly locate any commands or identifiers that you dont understand.

  MIRC Workshop Exclusive  

MIRC Workshop proudly presents Black Knight's mIRC script writing Java Applet. This applet lets you quickly and easily generate lines of code for mIRC scripts. The Script Writer applet is especially suited to writing Remote Scripts including aliases, popups and events.

Simply use the menu driven generator to create multiple lines of code including colours, bold and underline codes, a wide range of preset identifiers, commands, events, and anything else at all with 'own input' and edit capabilities.

A few simple clicks and any additional custom input you like and your code is ready to cut and paste into your mIRC scripts. Best of all, using this applet is totally FREE!

The mIRC Script Writing applet is a MIRC Workshop exclusive. No other site offers you such a great and easy way to generate your scripts and popups.


Choose a Subject from the list to continue. (Some subjects contain several tutorials.)

  1. What's New Here
  2. What is mIRC?
  3. Setting mIRC options
  4. Basic IRC chat
  5. Basic mIRC use
  6. MIRC Text Controls
  7. MIRC Commands
  8. MIRC Identifiers
  9. MIRC Variables
  10. MIRC If-Then-Else
  11. MIRC Aliases
  12. MIRC Popups
  13. MIRC Remote Events
  14. MIRC Multi-Scripts
  15. Script Writing Applet
  16. Downloads Area
  17. IRC Warfare *New
  18. Useful MIRC Links
  19. About The Author
 


Back to Top of Page

Return To Main MIRC Menu

Back / Index / Frames / Next

©1999 The Black Knight (Contact)