Ctcp Events


CTCP stands for Client-To-Client-Protocol which is a special type of communication between IRC Clients. By creating CTCP events, you can make your mIRC react to commands or requests from other users. CTCP events use the format:


ctcp <level>:<matchtext>:<*|#|?>:<commands>


The level is the access level required to access this event, the matchtext is the actual CTCP being sent, the *#? specify whether to react to any message, to channel messages, or to private messages respectively, and the commands are the commands that will be performed if this event triggers successfully.



The following examples should give you an idea of how to create simple CTCP events.


A Basic CTCP event


ctcp 1:help:*:/msg $nick help yourself!


The above ctcp event would react to a /ctcp yournick help message either in a channel or private message. Since it has access level 1, this means that any user can access it because 1 is the lowest access level.


Giving Op status to a friend




ctcp 5:opme:?:/mode $2 +o $nick

ctcp 5:inviteme:?:/invite $nick $2


These definitions would allow the above level 5 user to send you the ctcp /ctcp yournick opme #mIRC and if you are on an Op on channel #mIRC, the above script would automatically Op him. The user can also send you the ctcp /ctcp yournick inviteme #mIRC, and you would invite him to channel #mIRC.


Note: By giving the user access level =5, the user is limited only to level 5 events. If I had given the user access level 5, then the user would be able to access all events which have access level 5 and below.


Changing a standard CTCP reply


ctcp 1:ping:?:/notice $nick Ouch! | /halt


This will react to the standard ping CTCP and will reply with "Ouch!". The /halt at the end of the line prevents the standard ping reply from being sent. If you do not use the /halt, the standard reply to PING will be sent.


ctcp 1:time:?:/notice $nick The time here is around $time | /halt


This will react to the standard time CTCP and will reply with the above message. Again, the /halt prevents the standard time reply from being sent.


Note: You cannot prevent the standard version reply from being sent.


Controlling your mIRC remotely




ctcp 100:quit:?:/notice $nick Okay boss, I am quitting... see you later! | /quit


The above definition shows how you can give yourself a high access level to access the quit event, and you can tell your mIRC to quit IRC from another IRC Client.


ctcp 100:send:?:/dcc send $nick $1-


This definition allows you to ask your mIRC to send you whatever file you specify to the IRC Client you are using from another location, for example by using the ctcp /ctcp yournick send homework.txt.


ctcp 100:*:?:$1-


This event definition allows you to execute any command remotely. So if you send a /ctcp yournick echo Hi!, your script will execute the command echo Hi!. This is a potentially dangerous event definition since if you allow anyone else to access it, they will be able to perform any command they want on your computer.


Wildcards and Variables


ctcp 1:*help*:#:/notice $nick I can see that you need some help


By using the * and ? wildcard characters, you can match any incoming text. So if a user sends you a ctcp which has the word help in it anywhere, the above notice will be sent.


ctcp 1:%password:?:/notice $nick Your access has been authorized


By using Variables in the matchtext section, you can change the value of %password whenever you want without having to change the event definition. So if you set %password to the value "moo" and someone sends you a "moo" ctcp, it will match %variable and the notice will the above message will be sent.