mIRC Scripting Tutorial — File Browser
mIRCScriptingTutorialv1.0 / mIRCScriptingTutorialv1.0 / tutorial01 / popups.htm
popups.htm — 9.8 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:332 }
.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: Popups</span>
<div class=body>
<br><br><br>
Popups are the little boxes that 'pop up' when you right click on an mIRC window. They also serve as short-cuts to mIRC functions like Aliases. The difference between Aliases and Popups are: for Aliases you need to type the alias name into the window and for Popups, you right click, look at the short-cut customized name for a task you want mIRC to perform and click it to perform the task. <img src=img/pop.png align=left> One is text based and the other is click based.
<br><br>
Look at the picture shown at the left, that's how a Popup looks like. You get that one when you right click in the nickname list (the column at the right corner of the channel window, where you see the nicknames). Try clicking there. Depending on whether you are using a script or not you should see something similar to the picture shown here; it's the default mIRC nickname list Popup.
<br><br>
Once again, to write useful and interesting Popups you need to know mIRC commands and should have at least a fair knowledge about how Aliases, Variables and Identifiers work. Read them up from the mIRC Help File. Better get the whole file printed out and take it along with you and read it whenever and wherever you can find a place to. It's not just about reading, you need to try out things and see for yourself how they come out too. The mantra for becoming a good scripter is - "Keep writing scripts"
<br><br>
Now let's start with creating your first Popup. First take a look at the Popup files for the Popups in mIRC. Press ALT+P (this takes you directly to the Editor in Popups mode). See the codes? Most probably the Popups file for the Status window will be put in the Edit mode. Right click in the Status window and analyze the codes and the corresponding Popup. If you want to see the Popup file for NickList, click on View and choose Nick List. Now take a look at the codes and compare with what you see in the Nick List Popup when you right click. Making sense?
<br><br>
Let's get going with what we were upto. First you have to decide which window you want to write the Popup for. If it's for the Channel window, click on View and select Channel, similarly, the same for other windows. Now copy and paste the following codes into the Popup editbox in the Editor. We are going to make a Popup for the channel window. Make sure you have chosen Channel from the View Menu.
<br>
<span class=code><pre>-
My First Popup: /
-
Hello: say Hello everybody!
Bye: say Good bye everybody!
-
Greetings
.B-Day: say Happy Birthday to $snicks $+ !
.Christmas: say A merry Christmas to each and everyone of u!
.New Year: say New Year Wishes to all!
Action
.Kick: {
me kicks $snicks in the ass *HUH!*
say you liked it $snicks ?
}
.Bonk: {
me bonks $snicks $+ 's head with a viking club*BONK!*
me wonders if $snicks is still alive
say $snicks are you alive?
}
.Flirt: {
me flirts with $snicks
say $snicks I love you
.timer 1 5 say $snicks $+ , it's been 5 secs that I started flirting with you
.timer 1 6 say $snicks don't you think I type quite fast?
.timer 1 7 say Look at the way I'm typin so fast... YOooHOoo!
}
-
Quit: quit 0wn3d by a Popup!
Close mIRC: exit</pre>
</span>The above code will create the Popup show below in the pic. Using the above code as an example, I will cover the topic on Popups for beginners. <img src=img/pop1.png hspace=2 vspace=2 style=" float: left "> Let me explain you the code. The <span class=code>-</span> is to create a line separator between the menus. I used it in the first line to separate the new Popup menu from the already existing Channel Modes menu of the channel Popup. The menu 'My First Popup' is a functionless menu, I used it to give a name to the Popup we just created.
<br><br>
Popups menu definitions follow this pattern <span class=code>Menu name: mIRC-command</span>. For eg: <span class=code>Hello: /say Hello everybody</span> will perform the command <span class=code> /say Hello everybody</span> when you click on <span class=code>Hello</span> in the Popup menu. <span class=code>Hello</span> is the menu name and <span class=code>/say Hello everybody</span> is the command executed by mIRC. Similarly <span class=code>Bye</span> is the menu name and <span class=code>/say Good bye everybody! </span>is the command.
<br><br>
In the next menu we have Greetings as the main menu and B-Day, Christmas and New Year as submenus. Submenus are created by putting a <span class=code>.</span> (dot) infront of the submenu name following the menu name. And if you want to create submenus under a submenu, you need to put <span class=code>..</span> (two dots) in front of the sub-submenu name following the submenu name.
<br><br>
Now we will change the submenu for <span class=code>Bonk</span> under the menu <span class=code>Action</span> and put submenus under it (Bonk). Change the code for <span class=code>Bonk</span> in the last example code to the following.
<br><br>
<span class=code>.Bonk
<br>..Gaul: me bonks $snicks with a Gaulish club *4BONK!*
<br>..Viking: me bonks $snicks with a Viking club *4BONK!*
<br>..American: me bonks $snicks with an American baseball bat*4BONK!*</span>
<br><br>
<img src=img/pop2.png hspace=2 vspace=2 style=" float: left "> The modification in the code for <span class=code>Bonk</span> will result in a Popup which looks like the one in the pic at the left. Here we saw how submenus were added to a submenu of a menu. If you'd like to add submenus to <span class=code>Gaul</span>,<span class=code> Viking</span> and<span class=code> American</span> you will need to put <span class=code>...</span> (three dots) in front of the submenu name under them.
<br><br>
In the Greetings menu code you must have noticed the <span class=code>$snicks</span>, it is another identifier; used to denote the selected Nick from the Nick List - another instance which proves you need to know about identifiers and other aspects of mIRC scripting. And the <span class=code>$+</span> is yet another identifier that's used to join two pieces of the parts of a code, which are otherwise illegal. <span class=code>$snicks!</span> will prevent ur code from performing the task u want to, so we use <span class=code>$snicks $+ !</span>; which adds ! immediately after the selected nick. Note how <span class=code>$+</span> is used in the other parts of the code.
<br><br>
In the action menu, we have 3 submenus. The first one is kick. Let's assume your nick is Johnny-Bravo and say, you selected a nick called The-Joker and clicked on Kick. You get...
<br><pre>
* Johnny-Bravo kicks The-Joker in the ass *HUH!*
<Johnny-Bravo> you liked it The-Joker ?</pre>
<br>
That Popup performed two actions. First it 'kicked' the selected nick and then asked him something. To include more than one command in the Popup (also in remotes), we enclose the commands within <span class=code>{ }</span> (curley brackets). Look at the Kick Popup code...
<br><br>
<span class=code>.Kick:<b> { </b>
<br> me kicks $snicks in the ass *HUH!*
<br> say you liked it $snicks ?
<br><b>
}
</b></span>
<br><br>
Notice how the command lines are enclose by an opening curly bracket and then closed by another. You can observe the same in the other submenu - Flirt. It contains 5 commands, all of them enclosed within <span class=code>{ }</span>. In the the submenu Flirt you can see <span class=code>.timer 1 5</span>. It's an mIRC command which starts a timer and executes the mIRC command(s) according to the specification. <span class=code>timer 1 5</span> will execute the command following it, once after 5 secs (1 5). I included this example to stress the importance of knowing the IRC commands in writing useful and interesting scripts. Try removing the . (dot) before the timer command and see what happens.
<br><br>
You can also create Popups from a Remote file; it's discussed in the chapter on <a href=remotes.htm#popups>Remotes</a>.
<br><br>
If you already know the mIRC Commands and Variables, you can very well write many useful and impressive scripts right at this stage too. I won't be including a detail chapter on Commands and Variables. You will have to learn them yourself. They are already in the Help File.
<br><br>
Before we move on to Remote, it would be best if we learnt about Identifiers, common mIRC Commands, Variables, Operators and program structure and flow. Let's start with Identifiers.
<p><br>
<a href=aliases.htm>Back</a> |
<a href=index.htm>Table of Contents</a> |
<a href=identifiers.htm>Identifiers</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>