From WikiChip
Editing mirc/introduction

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

This page supports semantic in-text annotations (e.g. "[[Is specified as::World Heritage Site]]") to build structured and queryable content provided by Semantic MediaWiki. For a comprehensive description on how to use annotations or the #ask parser function, please have a look at the getting started, in-text annotation, or inline queries help pages.

Latest revision Your text
Line 11: Line 11:
 
You will notice that there are five selectable tabs: '''Aliases''', '''Popups''', '''Remotes''', '''Users''', and '''Variables'''. Let's try and get you familiar with each one. Before we dive into what these little (or rather big) guys do, let's get to know some basics first.
 
You will notice that there are five selectable tabs: '''Aliases''', '''Popups''', '''Remotes''', '''Users''', and '''Variables'''. Let's try and get you familiar with each one. Before we dive into what these little (or rather big) guys do, let's get to know some basics first.
  
== The very basics ==
+
== The %?basics?% ==
 
Let's take a few moments to help familiarize you with the following key components:
 
Let's take a few moments to help familiarize you with the following key components:
  
Line 33: Line 33:
  
 
=== What's with the slashes? ===
 
=== What's with the slashes? ===
If you asked any script related question in a help channel, you were probably told to type some code that begin with a forward slash. That's because you can execute code which is saved in the editor, but you can also execute anything from the editbox.
+
If you asked any script related question in a help channel, you were probably told to type some code that begin with a forward slash. That's because you can execute code which is saved in the editor, but
 
 
In order to execute any code from the mIRC editbox (the box where you normally type all of your text), you must prefix the code with at least one forward slash.
 
 
 
You may use two forward slash, the difference between using one or two forward slash is that with one, the rest of the line is not interpreted, we will discuss this difference later.
 
 
 
We usually refer to commands by prefixing them with a slash.
 
 
 
=== /echo command ===
 
The most common type of statements are {{mirc|commands}}. Commands are a way to tell mIRC to perform a basic operation. By far the most common command you will be using is the {{mirc|/echo}} command. The /echo command simply prints text to the screen. Every echo command prints on a line of its own. Even if the /echo command is typed into the editbox of a #channel, nobody in channel sees the message unless you do not begin the text with the "/" symbol.
 
 
 
Let's dive right into an example! Type the following code into your editbox:
 
 
 
<source lang="mIRC">//echo Hello World!</source>
 
 
 
When you are finished typing this echo command, hit your Return or Enter key on your keyboard. You should see the following result ('''Note:''' Your editbox will not have anything in it, it will be cleared once you press the Enter or Return key):
 
 
 
<pre>Hello World!</pre>
 
[[File:Hello edit.png]]
 
 
 
The command will be in your editbox history, and you can use the UP ARROW key 1 or more times to bring previous commands into the editbox. You can press the <enter> key immediately to repeat the message or /command, or you can edit the text before pressing <enter>.
 
 
 
Recall we said earlier that multiple statements can be combined by using the pipe '|'? Let's print 3 lines to the screen using the echo command and some pipes. Type the following code into your editbox (''Remember to hit the Return or Enter keys from now on''):
 
 
 
<source lang="mIRC">//echo Scripting | echo Is | echo Fun!</source>
 
 
 
You should hopefully see the following results:
 
 
 
<pre>Scripting
 
Is
 
Fun!</pre>
 
[[File:Fun edit.png]]
 
 
 
'''Note''': As you may have noticed, from the editbox, you can only pipe statements, you can't use newlines.
 
 
 
You will notice that after the first ''//echo'' command, once we've piped, we do not need to type any more slashes; this is because mIRC interprets the rest of the statements via the first initial two slashes.
 
If you use one slash here, "Scripting | echo Is | echo Fun!" will be echoed, because the pipes have not been interpreted as statements seperator, we usually refer to something that can be interpreted that is not interpreted as 'plain text'. We also refer to the processing of anything special (we've only seen the pipe character for now, but they are others) as 'evaluation', we will discuss it later.
 
 
 
When you begin an editbox command with a double "//", it does not execute the 1st command if the // is immediately followed by a space character, so be sure to not have an unnecessary space at the beginning. This example echoes only the "test2" message:
 
 
 
<pre>// echo test1 | echo test2</pre>
 
 
 
=== Let's make it into an alias, shall we? ===
 
Aliases are used to describe any piece of scripting code that can be reused. Aliases have a name by which we can refer to them, and they also have a body. The body of an alias contains a statement, or a list of statements, that execute(s) when we call that alias. You can think of aliases as commands, much like the ''echo'' command is. All aliases can be called from your edit box by preceding them with one or two forward-slashes, just like commands.
 
 
 
==== Basic Alias ====
 
A basic alias will look something like this:
 
 
 
<pre>alias name <statement></pre>
 
 
 
We can tweak the statement of this alias just a little in order to perform multiple statements through the use of piping:
 
 
 
<pre>alias name statement 1 | statement 2 | statement 3</pre>
 
 
 
Notice that with the piping, this alias now performs multiple actions.
 
 
 
Let's make the code we used above to print "Scripting Is Fun!", all on separate lines, and call this new alias "fun":
 
 
 
<source lang="mIRC">alias fun echo Scripting | echo Is | echo Fun!</source>
 
Before we continue, let us note a few things regarding the above code:
 
 
 
# The two // were removed; we only really need one or two forward-slashes when we want to execute code directly from the editbox. Using slashes in your script editor adds nothing but clutter.
 
# The statements in the editor are always executed as though two forward slashes were used, you cannot force a statement not to be evaluated.
 
# Because we used the '''alias''' keyword, the code must go in the '''Remote Tab''' of the script editor. In order to use that code from the aliases tab, you must remove the "alias" keyword. The rest of the code stays the same.
 
 
 
=== Remote tab ===
 
[[File:Fun alias 1.png]]
 
 
 
=== Aliases tab ===
 
[[File:Fun alias 2.png]]
 
 
 
'''Note:''' When you want to execute an alias, you would refer to it as wanting to ''call the alias''.
 
 
 
To call on our alias ''fun'', all we have to do is use its name, preceded by a forward-slash in any mIRC editbox:
 
 
 
<pre>/fun</pre>
 
'''Note:''' Two forward-slashes will also call it of course, but there are nothing to be evaluated so it would be the same.
 
 
 
That should print our text again:
 
 
 
<pre>Scripting
 
Is
 
Fun!</pre>
 
  
 
== A block of code: ==
 
== A block of code: ==

Please note that all contributions to WikiChip may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see WikiChip:Copyrights for details). Do not submit copyrighted work without permission!

Cancel | Editing help (opens in new window)