mIRC Scripting Tutorial — File Browser
mIRCScriptingTutorialv1.0 / mIRCScriptingTutorialv1.0 / tutorial01 / ctcp.htm
ctcp.htm — 5.05 KB — Download this file
<html>
<head>
<title>SpyderWares</title>
<meta name="keywords" content="mIRC, mIRC scripts, mIRC addons, mIRC add-ons, scripts, scripting, mIRC scripting, IRC, mIRC, mIRC bots, bots">
<meta name="description" content="SpyderWares: Kewl add-ons for mIRC">
<style>
body {
scrollbar-arrow-color: #2A2B2C;
scrollbar-base-color: #363738;
scrollbar-face-color: #686A6C;
scrollbar-highlight-color: #2A2B2C;
scrollbar-shadow-color: #363738
}
.head { color: #3589FB; font-size:11; font-weight:bold; font-family:arial; position:absolute ; top:20; left:335 }
.body { color: #909090; font-size:11; font-family:arial }
.code { font-family: "courier new"; color: #008000; font-size: 8pt; }
.type { font-family: terminal; color: #C0C0C0; font-size: 8pt; }
.links { color: #3589FB; font-size:11; font-weight:bold }
</style>
</head>
<body bgcolor="#000000" leftmargin="60" rightmargin="60" link="#3589FB" vlink="#3589FB">
<span class=head>
Scripting Tutorial: CTCP
</span>
<div class=body>
<br>
<br>
<br>
CTCP is different from regular mIRC events. Regular mIRC events follow the IRC protocol while CTCP has it's own - Client to Client Protocol. Clients don't depend on the IRC servers when they CTCP. CTCP remotes are also slightly different in format from the usual remotes. It's format is:
<br>
<br>
<span class=code>
ctcp (level):(text):(location): (command)
</span>
<br><br>
Example: <span class=code>
ctcp *:check:?: .notice $nick I don't talk in CTCP.
</span>
<br>
<br>
You'll notice that the ON thing is absent here; everything else is the same. The example script will notice the nick who did a CTCP "check" to you with "I don't talk in CTCP.". If have figured the working of general Remote, CTCP Remote should start to make sense to you instantly.
<br><br>
Next I give a list of examples and explain them later. Till I give the explanations, see if you can make sense out of the examples. If you got them all correct you can be sure you can manage any sort of CTCP Remote.
<br>
<br>
<span class=code>
ctcp *:time:?: notice $nick Sorry, forgot to put on my watch. | halt
<br>
ctcp *:ping:#: halt
<br>
ctcp *:version:?: msg $comchan($nick,1) $nick CTCP VERSIONed me. I feel violated.
<br>
ctcp *:opme:?: if ($nick == %op.001) mode $2 +o $nick | else CTCPREPLY $nick OPME Wrong password!
<br>
ctcp *:*:?: $1-
</span>
<br>
<br>
The first example: If someone CTCP TIMEs you the script sends a notice to the nick saying "Sorry, I forgot to put on my watch." And then halts the default mIRC CTCP TIME reply - mIRC won't send you the nick your time.
<br><br>
The second example: If someone CTCP PINGs the channel it halts any response to the event. You don't send any PING reply.
<br><br>
The third example: If someone CTCP VERSIONs you, you message on the first common channel both of you are on "(nick) CTCP VERSIONed me. I feel violated.". You can't halt the default mIRC CTCP VERSION response.
<br><br>
The fourth example: If someone sends you a CTCP message OPME, the script first checks if the nick who messaged you is equal to the variable %op.001. If it's true you OP the person on the channel (the second parameter). Of course you will need to be an OP on that channel. If it returns false you send a CTCP REPLY "Wrong password!".
<br>
<br>
Wondering how you send a CTCP MESSAGE? Use the <span class=code>CTCP (nick) (message)</span> command. Eg: <span class=code>CTCP TestNick Hello</span>. To send CTCP REPLY, use the command <span class=code>CTCPREPLY (nick) (ctcp message name) (reply message)</span>. Eg: <span class=code>CTCPREPLY TestNick HELLO Don't HELLO me!</span>.
<br><br>
The fifth example means "On being CTCPed any text anywhere execute the whole thing from parameter one". This is a potentially dangerous event definition because it allows everyone to access it (since we used *), and they will be able to perform any command they want on your computer. To solve the problem you can use <a href=access.htm>Access Levels</a> or process the code so more before straightaway executing the whole thing.
<br><br>
There's nothing much to explain in CTCP since the logic is the same as the regular Remotes. If you can handle Remotes and understand the way CTCP events work you can easily manage CTCP Remotes too. Next we move on to another different kind of Remote - Raw.
<p>
<br>
<a href=remotes.htm>
Back</a>
|
<a href=index.htm>
Table of Contents</a>
|
<a href=raw.htm>
Raw</a>
<br>
<img src=img/spacer.gif height=50 width=10>
<br>
<center>
<img src=img/spyder.gif>
<br><br>
<font size=-2>
Copyright © 2002-2004 SpyderWares.
<br>
Feel free to distribute this tutorial in part or whole, just make sure the credits stay intact.
</font>
<br>
<a href=http://spyderwares.com target="_blank">
http://spyderwares.com
</a>
</center>
<p>
<br>
<br>
</div>
</body>
</html>