mIRC ScriptBox
Troubleshooting Guide

Collected by the #HelpDesk (DALnet) Team

Table of Content

  1. Who cares about what mIRC version I use?
  2. 30,000 byte limit
  3. Are All Systems Go?
  4. Are your variables tidy?
  5. Remember where you can and can't put things
  6. Always check your brackets
  7. Move your script around
  8. Check for halts
  9. Remember the "ON"
  10. Try using on * instead of on 1
  11. Not every event allows $chan, $nick etc...
  12. Debug, Debug, Debug!
  13. Grammar isn't just for English
  14. Try the friendly people at #HelpDesk
  15. Last Resort: Start a fresh


1. Who cares about what mIRC version I use?  Back to Top

People who use your script, and those who may review it do.

I strongly recommend you use the latest version of mIRC - that way you can know for sure that your script will work on a large scale. Most of the scripts/examples available at our WebSite are designed to be used on the latest version of mIRC.

If you want though, you can wait to see if there is any updates to the latest version of mIRC. Like 6.0 to 6.01 or 6.15 to 6.16. Usually after a week or up to a month a second release comes out - with 0.01 added to the version number. This release is due to Khaled correcting bugs in the initial release.

2. 30,000 byte limit  Back to Top

mIRC's remote editor, by default, only lets each remote file take up 30,000 bytes. Always keep your files within this limit, as the excess code can be cut off when saving changes. There is a way to let mIRC exceed 30,000 bytes but this means that any mIRC that uses your script will have to change its size limit. I do not recommend using it, as that means if your script exceeds 30,000 bytes it will bring troubles to mIRC's which has the limit set to 30,000 bytes.

In other words, to avoid future hassles with script support/usage, keep within the limit.

3. Are All Systems Go?  Back to Top

Most scripters already know this, but for the novice/first time scripter, its important that you have mIRC setup to accept and process your scripts. The first thing you need to do is turn your remotes on. to do this, type: /remote on in any mIRC window. Next you need to turn on your events,ctcps,raw and ial. To do this, in an mIRC window type the follwing commands:

/events on
/ctcps on
/raw on
/ial on

The last thing you need to do is set your default user level. I recomend this should be set to 1 - the default level mIRC has when its first installed. If you have not changed the default user level then you need not worry. If you have and wish to change it back, open the remote editor:
Press ALT and R, click on the Options menu, select Default Level, and enter 1.

Now you should be setup and ready to script.

4. Are your variables tidy?  Back to Top

It's always a good idea to unset temporary variables, or variables which are only during an operation and have to be reset next time the operation is run. Variables that hold stuff like 'the number of the nickname in a channel that I want to do something to' for notice, colour and other misc. operations are prime suspects. If not unset, or reset, you could soon be trying to msg or colour the 300th nickname in a 17 person channel.

By unsetting temporary variables, you leave more space for other variables to use, lowering the risk of breaking the limit of variables that mIRC can use.

5. Remember where you can and can't put things  Back to Top

Many people ask why a line similar to:

on *:JOIN:#: { SET %temp $$?!="Say hello to $nick $+ ?" | IF (%temp == $true) { msg $chan Hello, $nick } }

Does not show the Yes/No dialog box. This is because most events will simply not allow $$?. Imagine having a $$? in an on TEXT event - it would never stop. But one time events, like on START, usually let you use $$? and its friends. An easy way to get around the $$? block on events like on JOIN and on TEXT, is to call the $$? from an alias. You need to call the alias using a timer. Sound confusing? Perhaps an example would be better:

on !*:JOIN:#: { .timer -m 1 1 sayhi $chan $nick }

alias sayhi {
  SET %temp $$?!="Say hello to $2 $+ ?"
  IF (%temp == $true) { msg $1 Hello, $2 } 

See how when someone joins, a millisecond later (.timer -m 1 1) a yes/no box will open. The command to make this box open was given by the sayhi alias. You should also be aware that what can work using one method on one mIRC version may not on another - or the method may become redundant: e.g. you can call dialogs from dialogs now unlike when they first came out (mIRC 5.5).

Also, when you put identifiers (e.g. $nick) in the "STRING" of an event, do not expect them to evaluate. What I mean is, say my nickname is bob, and in my remote editor I put:

on *:TEXT:hello $me:#:{ msg $chan Hello, $nick }

That line will only work when a person says "hello $me" - NOT "hello bob". The solution? There are a couple.

Solution #1:

on *:TEXT:hello *:#:{ if ($2 == $me) { msg $chan Hello, $nick } }

Solution #2:

on *:TEXT:hello *:#:{ if ($me isin $2-) { msg $chan Hello, $nick } }

They are both similar, but will do the job. So remember for any event, any identifiers put in the STRING will not evaluate.

Solution #3:

After mIRC 5.6 came out, under certain circumstances you can have identifiers in the matchtext area. It requires you use the $() identifier:

on *:TEXT:$(hello $me $+ *):#:{ msg $chan Hello, $nick }

6. Always check your brackets  Back to Top

One of the most common errors in scripting is with brackets. Sometimes brackets are placed in the wrong way, or sometimes the brackets were put in the wrong place. Usually though, people add or forget one or two brackets.

The best way to check to see if you are missing a bracket is to press the { } button in the remote editor. This will make mIRC check over all your brackets in the current remote file. If it finds an error, it will take you to where mIRC thinks the error occurred.

7. Move your script around  Back to Top

Another common thing people do is put multiple events of the same type on one file. For instance, mIRC usually hates it when you put two "on *:TEXT:*:#:" events in a single remote file.

Usually the second one won't work. This may be caused by a "halt" command in the first "on *:TEXT:*:#:" OR it could just not like having two on TEXT events in the same file.

I prefer to move the second on TEXT line to a new, or separate remote file. If the second on TEXT is part of the script linked with the first on TEXT, then combine the two.

Example using a colour/bold kicker:

on @*:TEXT:*:#:{
  IF ($count($1-,$chr(3))  > 10) { 
    kick $chan $nick Please do not use more than 10 colour codes. 
on @*:TEXT:*:#:{
  IF ($count($1-,$chr(2)) > 10) {
    kick $chan $nick Please do not use more than 10 bold codes. 
Can be combined to either:
on @*:TEXT:*:#: {
  IF ($count($1-,$chr(3)) > 10) { 
    kick $chan $nick Please do not use more than 10 colour codes. 
  IF ($count($1-,$chr(2)) > 10) { 
    kick $chan $nick Please do not use more than 10 bold codes. 

or what I prefer:

on @*:TEXT:*:#: {
  IF ( $calc($count($1-,$chr(3)) + $count($1-,$chr(2))) > 10 ) {
    kick $chan $nick Please do not use more than 10 bold and colour codes. 

8. Check for halts  Back to Top

We briefly talked about halting in the last section. When you have a /halt in an event in your script, all events of the same type following the halt will not react. There are to ways to resolve this problem:

  1. Move the event with the /halt to the end of your last remote file or
  2. Remove the /halt and put it in the last event of the same type.

9. Remember the "ON"  Back to Top

Many people simply forget the on prefix for events. You need the word "on" before most events, except for a few like RAW and RECEIVING CTCP's.

For a script that replies when someone says "hi" in a channel we would put:

on *:TEXT:*hi*:#:{ msg $chan Hello, $nick }


*:TEXT:*hi*:#:{ msg $chan Hello, $nick }

10. Try using on * instead of on 1  Back to Top

One thing I have noticed ever since we could use letter user levels is that any letter is below 1 in mIRC's user level terms.

That is, if you have any named level - like MASTER, "on 1:EVENT:" will not respond. "on *:EVENT:" will.

This is the same with CTCP's: "ctcp *:" not "ctcp 1:".

In other words, you need to replace the 1 with *. You may find that on 1: will work with user levels like Master:Nickname, but if the userlevel is like Master:nick!ident@host.domain you will encounter problems - so play it safe and use on *.

11. Not every event allows $chan, $nick etc...  Back to Top

Not every identifier works with every event. Some are limited to just one event type, like $numeric for RAW. One of the most common errors is people assume an identifier will work for everything.

The following events do not accept $chan:


And to think that the above list is just for $chan.
Of course certain identifiers like $sock, $sockname etc... will only work with on 1:SOCK... events.

ALWAYS check to see if an identifier will work first. If the identifier does not, then try an alternative, for example, for the event on NICK, you can use $comchan($nick,1) to get the first channel that both you and the nick are on. There will not always be an alternative identifier.
Also remember socket events have a very limited range of identifiers - they can't use irc related identifiers such as $nick, $chan, $1- and $address to name few.

Remember, /help on EVENT and /help identifiers can give you a lot of information.

12. Debug, Debug, Debug!  Back to Top

If your script still does not function properly, or not function at all, try debugging it - and no, not with the /debug command.
What I mean is, put /echo commands in your script at various points.

Here is an example of debugging used in an op messager
NOTE: /notice @#channel text is easier, but I'm using loops to help show debugging.

alias opmsg {
  echo -a Started onotice alias. Attempting to send $1- to all ops on $chan
  SET %onotice.total.opnicks $opnick(#,0)
  echo -a There are %onotice.total.opnicks ops in $chan
  SET %onotice.current.opnick 0
  INC %onotice.current.opnick 1
  echo -a I'm about to message opnick number %onotice.current.opnick ( $+ $opnick(#,%onotice.current.opnick) $+ )
  .notice $opnick(#,%onotice.current.opnicks) *** Op Notice ***: $1-
  IF (%onotice.current.opnick < %onotice.total.opnicks) 
    echo -a I still have to msg some ops - going to start
    GOTO start 
  echo -a I have finished messaging %onotice.total.opnick ops

Of course you don't need to put an echo at every single point, just place them in key areas, or areas where you are having trouble with. If you don't need the plain english to help debug, then use the set/inc/unset/dec -s command. set -s sets a variable, and echos what it did/changed to that variable. The opmsg alias again, but this time using /set -s:

alias opmsg {
  SET -s  %onotice.total.opnicks $opnick(#,0)
  SET -s %onotice.current.opnick 0
   INC -s %onotice.current.opnick 1 
  .notice $opnick(#,%onotice.current.opnicks) *** Op Notice ***: $1-
  IF (%onotice.current.opnick < %onotice.total.opnicks) { GOTO start }
  UNSET -s %onotice.*

For more info on debugging try "The Art of Debugging"

13. Grammar isn't just for English  Back to Top

Correct Grammar, or just plain being careful of what you type, can make a difference. If a part of your script does not seam to work, check over it for spelling mistakes and misprints.

Quite often you may have just forgot to put a letter in a command, or forgot to put the % or $ in front of a variable/identifier. Also check to see if you have any spaces where they shouldn't be - like in the middle of an identifier.

14. Try the friendly people at #HelpDesk  Back to Top

If you feel as if you just can't figure something out, then perhaps we can help. If you do not know already, #HelpDesk is mainly a channel for Bot & Scripting help.

Some things to remember before coming into #HelpDesk:

1. Please don't message ops unless they have given you permission. It can get fairly busy in a channel and msg'n just makes it harder for us to help everyone.

2. Flooding is not allowed. If you paste something like over 3 lines you have a high chance of being removed. If you do have a large script, ask an op - in the channel - if you can paste it to him/her in private, or if you can DCC Send it to the op.

15. Last Resort: Start a fresh  Back to Top

If you have tried everything suggested here, and your script still does not work, don't be afraid to unload the script (Not Delete) and start a fresh.

It can be annoying I know, but sometimes a second attempt lets you re-think through the scripts process - letting you get a better idea of what needs to be done.

Try different ideas, use different methods etc. Don't be afraid to experiment.