GatoX Script
Tutorial













Home

Viper Bot | Scripts | Tutorial | Pics of the Scripts





mIRC Script Tutorial
















 

MIRC Identifiers sound very technical, but its just a term for some characters that identify a value. Still sounds techie? An identifier is like a magic word that will be replaced by mIRC with whatever value it refers to.

The mIRC Identifier $me means your nickname. No matter how many times you change your nick, $me is the identifier for the current one. Wherever you use $me, mIRC will replace that identifier with your nickname.

Simple and good isn't it. The mIRC Identifiers are needed so that your scripts can find the values that may change. MIRC Identifiers are no more than that. There are many identifiers, since there are many things you may need to refer to in your scripts that can change between the time of scripting and the time of use.

Pretty much everything that you can select or change has an identifier. You can refer to the first word in any string of text ($1); the folder (directory) where you installed mIRC ($mircdir); the currently selected nicks in the nicklist ($snicks); etc.

Again, a full list of mIRC's identifiers can be found in the mIRC Help files. In this tutorial I will detail only a few examples of the most practical of the identifiers to start with.

MIRC Identifiers can be used at the command line as well as in scripts, but, for mIRC to evaluate them you must prefix the command with two '//' slashes rather than the normal one. If you only use 1 slash '/' mIRC will not convert the identifier given in an editbox to its value. This only applies to command lines - identifiers and variables are always evaluated in scripts.

NOTE: One essential thing to remember about identifiers is that they almost always will only work if there is at least one space on either side. If an identifier is not seperated by spaces from other characters in scripts then mIRC will usually fail to 'see' it. ALWAYS space identifiers from anything else in your scripts or commands.

  MIRC Identifiers  

$me identifies your current nick. It becomes very useful in scripting of all kinds.

$1 $2 $3 $4- identify parameters in text etc. These are both the simplest and most confusing of all identifiers since they can refer to a vast range of values. In text strings $1 is the first word, $2 is the second, and so on. Adding the dash '-' to the end means 'onwards'. So $1- equals all words from the first. $2- means from the second word onwards.

The reason for the confusion is that many things create strings which mIRC can choose the first parameter from. In popups for instance, $1 would be the nick selected in the case of nicklist popups.

With experience (or help files) you will learn what parameters mIRC will be evaluating in any given situation. This is because you are generally going to use $1 $2 etc. in very specific circumstances. You will learn about this in the scripting tutorials. For now it is enough to know that $1 means parameter 1.

$? is a very useful and powerful identifier. $? causes mIRC to prompt the user for a value to enter. You can also put your own text on the prompt. $?="Enter your name" will cause mIRC to open a dialog box that has the text 'Enter your name', a text field for you to enter your data into, and 'OK' and 'Cancel' buttons.

The $? identifier is pointless at the command line, but is invaluable in scripts to get user input. To see it in action however before the scripting tutorials just type:
//echo -s you typed: $?="type something here" in the status window editbox and enter it. Notice that the double '//' slashes are used, to make mIRC evaluate the identifiers used in the command line.

/ECHO [-adetsl][channel OR nick] <text>
The /echo command was not covered in the commands section since it is far more related to scripting than common command line useage. The /echo command causes the <text> to be displayed in your window, but not sent to anyone else.

The switches select how to display the <text> specified. If a channel/nickname isn't specified, the -s switch echoes to the status window, the -d switch echoes to the dedicated message window (if you have one), and the -a switch echoes to the currently active window.

If you specify a channel or nick, the text will be displayed in the channel window (or query window) that matches the given name. The -etl switches can still be used with a named window.
Example:
/echo -tl #mIRC An echo to the #mIRC channel window

The e switch encloses the line in line separators. The t swich adds a timestamp (e.g. [11:23] ) to the echoed text. The l makes the echo highlighted.

$wavedir is the folder you specified in the options for your .wav sound files. $mididir is the folder you specified for .mid files.

$fulldate is the current date in the format: Tue Sep 07 23:51:23 1999 $date is the date in day/month/year format. To get the date in the American month/day/year format use $adate. The $time gives the time according to your system clock in Hours Minutes and Seconds. $day returns the current day e.g. Tuesday.

That is enough identifiers to give you the idea. You can find all of the mIRC Identifiers in the mIRC help files whenever you wish. Identifiers are not really all that 'techie' at all.

Even if you are not yet comfortable with identifiers in mIRC you will still be able to begin scripting. MIRC Identifiers will become crystal clear once you get to use them a little in your scripts.

Popups Popups Popups, Funny word isnt it :)
Well anyway I bet if your new to scripting you want to know what they are, so did I
When I started out I thought of website Popups.
Well if you get a copy of mIRC and right click in certain places it opens up a little menu.
like Nickname list and Channel Things. These are popups.

Now go to Tools and then Popups and you see all of the code that is the popups, pretty cool it is.Now you see the "View" tab, click it and you get to use

  *Nick List
  *Menu Bar
  *Channel
  *Status
  *Chat

now you can write your own : this is the syntax (layout)

Message For Command:/actual command

Like say I wanted to write click and say i was leaving and i would be back later i would add this:

Say Bye:/msg $chan Goodbye All  | /msg $chan I Will Be Back Later!!!  | /msg $chan I Promise, See ya !!!!!

now go to File >> Save now when you right click where you added it (normally in Channel Popups) Now you should see a thing saying "Say Bye" and if you click it, in the Room it was in you would see this...

  Script: Goodbye All
  Script: I Will Be Back Later!!!
  Script: I Promise, See ya !!!!!

Now you can edit it to do anything, add this to channel popups (mode changer)

Change Modes
.Spec
..On:/mode # +mv
..Off:/mode # -m
.Invite Only
..On:/mode # +i
..Off:/mode # -i

Now notice the layout, if you use dots it means it leads into something else like in Channel popups. I would right click and see "Change Modes" if I put my mouse over it I would see:

Spec
Invite Only

and if I put my mouse on them it would go out to the "on" and "off" messages and clicking them does the actual command, its a cool layout feature to prevent your script to look very crowded. Hopefully now you understand

*What Popups Are
*What They Are Used For
*Layouts To Write Them

here is my Modes popus for you to copy and paste into your own script.....

Modes
.Room Bans
..Bans On:/access # delete voice !*@*
..Bans Off:/access # add voice !*@*
.Spectator Mode
..Spec On:/mode # +m
..Spec Off:/mode # -m
.Hide Room
..Make Room Hidden:/mode # +h
..Make Room Visible:/mode # -h
.Invite Only
..Invite Only On:/mode # +i
..Invite Only Off:/mode # -i
.Outer Room Messages
..Allow:/mode # -n
..Do NOT Allow:/mode # +n
.Whispering
..No Whispers:/mode # +wW
..Whispers On:/mode # -wW
..Guest Whispers (off):/mode # +W
..Guest Whispers (on):/mode # -W
.Knocks
..Allow Knocks:/mode # +u
..Do NOT Allow Knocks:/mode # -u
.Password Protect
..Set:/set %kpass $$?="Password"  | /mode # +k %kpass  | /echo -a The Pass For the Room Is %kpass
..Unset:/mode # -k %kpass

Feel free to use that. and play with it. Now in remote files for kicks and bans etc you do kick # $2 or access # add deny $2 most of the time
!!!!!!! DO NOT MAKE THE SAME MISTAKE I DID WHEN I STARTED SCRIPTING !!!!!!!!
In Nick List popups use $1.
to kick someone it would be this

Goto Tools >> Poppups >> View >> Nick List

and add this line for example : *note when displaying the nickname use $$1, not for anything else*

Kick $$1:/kick # $1

That would kick them , however to spice up youre script, use something like this

Kicking
.Kick $$1:/kick # $1
.Kick $$1 With Message:/kick # $1 $$?="Message To Kick With"
.Ban $$1
..Silently:/access # add deny $1  | /access # add deny $address($1,1)
..With Kick:/access # add deny $1  | /access # add deny $address($1,1)  | /kick # $1 $$?="Message"
..Ban (choose time):/access # add deny $address($1,1) $$?="Amount Of The To Ban For"
..Ban With Kick (choose):/access # add deny $1 $$?="Time"  | /kick # $1

Now there is a lot of different commands in there,
$address($1,1) is banning by their @GateKeeperPassport (account)
and $1 is just the nickname ban
Play with it, see what it does and edit it.

 

Banlist/Kicklist/Ownerlist/Hostlist and Voicelist

Well no doubt you have heard of all these things but how much when it comes to understanding them, by the end of this I hope you will understand how they work and how to write them (from a file and the userlist) first of all there are a few commands we need to cover.

*To add to the userlist : auser <Level>
*To Remove from the userlist : ruser <Level>
*Write a file : /write <filename>


ok so you need two parts for this to work ...... the adding and the execution of the command
here is how we have it

 

on kicklist:JOIN:*: { kick # $nick (later in the tutorial ill give you a very cool trick for kickmessages) }
on ownerlist:JOIN:*: {mode # +q $nick }
on hostlist:JOIN:*: { mode # +o $nick }
on voicelist:JOIN:*:{ mode # +v $nick }


now we see the "kicklist" "ownerlist" etc.
these are the levels that you add to and remove from in the auser/ruser

Now how do we add things so people are in the Userlist under a specific level?
you can do it by
$nick or $address
(nickname or gatekeeper)

We will do it by nickname popups (for nickname) this should work :

OwnerList:
.Add:/auser ownerlist $nick
.Remove:/ruser ownerlist $nick

now if you open remote and see the userlist , you should see something like this :

ownerlist:Traditional_Witch
(if its my nickname ;) )

Now if I entered your room and your script was gold I would be ownered cos im on ownerlist level and as you saw before

on ownerlist:JOIN (when anyone in the list joins) { mode # +q $nick } (owner them!)

******* BUT ********
it is possible to clone nicknames :s so how do we do it by Gatekeeper (unique passport identification)
well we will have to change the popups.......


Ownerlist
.Add:/auser Ownerlist $address($1,1)
.Remove:/ruser Ownerlist $address($1,1)


and you dont need to change the on join bit .
[ Just incase your curious we dont do on JOIN:*: { mode = +q $address($1,1) } because it wont work ]
$nick basically represents anyone on that level in the on join, not in the popups

If you are feeling a bit confused please re read the previous text again.

Now the banlist and kicklist. I used to use this and still do ;'


on owner:TEXT:akick*:#:{ auser $2- kicklist | /kick # $nick $3- }

say I was to say : akick wondersie Hehehehah lol : and my script would do something like this.

Host Witch has kicked wondersie out of the chatroom : Hehehehah lol

i didnt use $2 as the nickname because I wanted to add the kick message to the the Userlist option ( I will show you how to retrive this in a minuite )
the $3- means kick with the message after the first two words *akick wondersie* I dont want to add them, "akick" would be $1 and "wondersie" would be $2, I wanted the message (if any) to kick with so I used anything after akick wondersie, by using $3-

all basically the "-" is is everything after. like everything after akick wondersie (the message)

now that he is on the akick to remove I use something like this


on owner:TEXT:dakick*:#: {
/ruser kicklist $nick
/access # delete deny $2
/invite # $2
}

now to kick on join with your message from akick Nickname Message
you need to use this


$ulist($nick,shitlist,1).info <<-- If its done by nickname
$ulist($address($1,1),shitlist,1).info << - Gatekeeper

$ulist opens the Userlist, and then $nick, it scans all the userlist for that nickname. and once it finds it it gets its "info".

now this is everything after a space in the Userlist (like the message)
lets recap a bit

akick wondersie HEheehehe lol
now "wondersie HEheehehe lol" is added to the kicklist as this:
kicklist:wondersie HEheehehe lol

now it kicks "wondersie" if he joins and the
$ulist($nick,shitlist,1).info command will get everything after the first space such as "HEheehehe lol" so when we put it together *:*

on kicktlist:JOIN:#: { kick # $nick $ulist($nick,shitlist,1).info }

or you can ban aswel :

on bantlist:JOIN:#: { kick # $nick $ulist($nick,shitlist,1).info | /access # add deny $nick | /access # add deny $address }

WHEW - now from a file, i will have to pinch Sysop_Docs thingy here :


on *:JOIN:#: {
set %ShitList $read(BlackList.txt,s, $nick $+ )
if ( %ShitList != $null ) {
kick $chan $nick [Autokick]
}


ok now on join here (anyone joining) it sets a Variable of a nickname if the nickname is on Blacklist.txt
say "wondersie" was on it and he joined.....

He Joins......
the script sets a variable
%ShitList and $reads blacklist.txt, it finds wondersie
so "wondersie" is now set on
%Shitlist.
if %Shitlist != (isnt) null (empty)
it means if someone joins and a variable isnt set (cos they arent on the kicklist) it wont do anything becuase this only carrys on and executes if %shitlist ISNT NULL.
then it kicks them with the message [AutoKick]

I hope you can now look at any file usage or user list entries and understand what they are doing and how to write on for yourself.......

to add to a file from popups you need to use /write filename

in this case I should add this code to Popups :


Add To Kicklist
.Add:/write BlackList.txt $1


* note * $1 in popups represents the nickname, so its writing to the file with their nickname

Well we all know what a variable is *I hope* :
if not I will explain, a variable is like an alias its a shorter code representing something bigger.
e.g say in a lot of commands I used


if ($nick isop $chan) halt | if ($nick isowner $chan) halt

and I got sick of writing that. well what I could do is save myself a lot of time by setting a variable. the word variable means it can vary. most variables change (e.g pass codes) but some dont have to, also it is a temporary storing place for data that is unset at the end of a command.

Anyway back to the problem, you could manually write a Variable (open "Remote" and 2 tabs along *after User List* you will see the tab Variables) now you can write this in:


%opownerhalt if ($nick isop $chan) halt | if ($nick isowner $chan) halt

What this is is everytime you use %opownerhalt it will acrtually be if ($nick isop $chan) halt | if ($nick isowner $chan) halt, time saver ... eh? its cool I know.

Thats basically what a variable is and how to use it.

with codes most scripts have something similar to this.....


raw prop:*ownerkey*: {
/set %pass $3-
}


This sets the Variable %pass with the room code, and every time it is changed %pass will know what it is.


SETTING AND UNSETTING VARIABLES :

ok simple as you have already seen

/set %variablename Data to be stored
/unset %variablename

cant be too hard to understand

Variables are very handy features in mIRC. some people might even want to replace %n and %r with $nick and $chan... ill talk you through a little bit more about variables and how they can be used.


on *:TEXT:.set*:#:/set %$2 $3-

if you have that and someone said:

.set Message The world has come to an end!

this will set a variable called %message representing "the world has come to an end"

*Note* if someone was to say .set Message again it would overwrite the previous variable called %Message


on *:TEXT:. retrieve *:#:/privmsg $chan %$2

if someone was to say .retrieve Message the script would say "the world has come to an end" i think you have got the picture of where i am going with this.

hehehe here is my MassKick stopper again :

 

on @!*:KICK:#: {
  if (%kic. [ $+ [ $nick ] $+ . $+ [ $chan ] ] == $null) {
    set -u8 %kic. [ $+ [ $nick ] $+ . $+ [ $chan ] ] 1
    return
  }
  else { inc %kic. [ $+ [ $nick ] $+ . $+ [ $chan ] ] }
  if (%kic. [ $+ [ $nick ] $+ . $+ [ $chan ] ] > 3 && %kic.check == $null) {
    acces # add deny $nick
    access # add deny $address
    kick # $nick Flood Detected
    set -u6 %kic.check 1
  }
}
 

Now before you read the rest please examine this code and try to make sense out of it.


It is referring to the variable %kic. and it checks if %kic. is $null (nothing in it) and if it is it sets a variable.
this variable will only set itself for 8 seconds, this is a timer. Please read my Timers tutorial for help on Timers and the -u Switch.

now a very popular thing besides making long commands shorter is to increment and decrement Variables. like you see here:


else { inc %kic. [ $+ [ $nick ] $+ . $+ [ $chan ] ] }

the inc %kic. means it is assigning it an added data value of one ( you can use inc 2 %kic. or whatever, it doesnt have to be one, if you are assigning it one value just write inc %kic. )

Next it is checking if %kic. is greater than 3 :


if (%kic. [ $+ [ $nick ] $+ . $+ [ $chan ] ] > 3 && %kic.check == $null) {

then it checks to see if is null.......( remember it was only written to last 8 seconds ) so basically in English, it means
*
if there have been 3 kicks from the same person in 8 seconds, it executes these commands :


access # add deny $nick
access # add deny $address
kick # $nick Flood Detected
set -u6 %kic.check 1
*


I hope I have increased your knowledge on what variables are used for and the sort of things you can do with them.

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.

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 procedure 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. 

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.

We are all familiar with what Timers are. They are a way to halt a process for a certain period of time and then execute a command.There are a few ways to start timers. Here is one:

-u(time)

The -u Switch is a command that can be used to set a variable that needs checking and where you enter (time) is the amount of time before it resets, here is an example of the -u Switch being used in a command. Here is a MassKick Stopper:
 

on @!*:KICK:#: {
  if (%kic. [ $+ [ $nick ] $+ . $+ [ $chan ] ] == $null) {
    set -u8 %kic. [ $+ [ $nick ] $+ . $+ [ $chan ] ] 1
    return
  }
  else { inc %kic. [ $+ [ $nick ] $+ . $+ [ $chan ] ] }
  if (%kic. [ $+ [ $nick ] $+ . $+ [ $chan ] ] > 3 && %kic.check == $null) {
    acces # add deny $nick
    access # add deny $address
    kick # $nick Flood Detected
    set -u6 %kic.check 1
   }
}


 

it sets the variable %kic. if it is null on a kick, it sets -u8, which means after 8 seconds %kic. will automatically reset / unset itself. Later on it checks again to see if it has been incremented within the 8 seconds and it has been reset.
I didnt go into much detail about this but I hope you begin to see the basics about timers.
I bet many of you have been wondering about other times as well, the other way to set one is this:

/timer (x) (y)

(x) stands for the number you want to ID it by, like in Dialogs you set a specific action with a number. so if you use a lot of timers make sure they are different numbers, so they will not clash together and give you some nasty errors.
(y) stands for the amount of seconds you want it to time, say i wanted it to time 2 minutes, I would use:


/timer 1 120

when laying out the basics of a timer command you need to make sure it is set out correctly, I prefer this way:

on *:TEXT:.start timer:#:/privmsg $chan Ok! | /privmsg $chan Timer Started (20 Seconds) |    /timer 1 20 { /privmsg $chan Timer Finished }

Thats how it SHOULD work, you need to base it out like that .
I want you to try that timer out and have a look at what happens before you move on..

Ok now did you get a message < Timer no such nick/channel >
yes, I didnt want to confuse you before with really how it is accomplished, i wanted you to get a brief understanding of how it works and executes itself,
timers dont allow the characrer %.
when you use # or $chan, it is a representative of %# and thats what gives you the error message!
there is a simple way to fix this replace:
"#" or "$chan"
With This Code:

$!chr(37) $!+ $right($chan,-1)
*Credit to eXonyte for this*

this lets you use $chan in your command. now I want you to try this code:

on *:TEXT:.start timer:#:/privmsg $chan Ok! | /privmsg $chan Timer Started (15 Seconds) | /timer 1 15 { /privmsg $!chr(37) $!+ $right($chan,-1) Timer Finished }

Here is what you should see now :

Traditional_Witch : .start timer
Test : Ok!
Test : Timer Started (15 Seconds)
* 15 Second Gap *
Test : Timer Finished

Lets go over what we learnt in this lesson
The -u(time) switch is used to set a variable and unset it after a certain amount of time
Timers as in /timer need different ID numbers so mIRC will not get confused which one to use
Timers will not accept the command $chan or #
To Implement $chan or # into your Timer command you need to use $!chr(37) $!+ $right($chan,-1)
And i will now leave you with a little more complicated timer to play with

on owner:TEXT:.start:#:{
  privmsg $chan Room Closed
  mode # +smi
  privmsg $chan Timer Activated (15)
  timer 1 15 { mode $!chr(37) $!+ $right($chan,-1) -smi }
}
















®2002 - Gat0[X] Script  -  All Rights Reserved.