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 29: Line 29:
 
statement 3
 
statement 3
 
statement 4</pre>
 
statement 4</pre>
 
<pre>echo -a statement 1 | statement 2 | statement 3 | statement 4</pre>
 
  
 
=== What's with the slashes? ===
 
=== What's with the slashes? ===
Line 42: Line 40:
  
 
=== /echo command ===
 
=== /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.
+
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.
  
 
Let's dive right into an example! Type the following code into your editbox:
 
Let's dive right into an example! Type the following code into your editbox:
Line 52: Line 50:
 
<pre>Hello World!</pre>
 
<pre>Hello World!</pre>
 
[[File:Hello edit.png]]
 
[[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''):
 
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''):
Line 68: Line 64:
 
'''Note''': As you may have noticed, from the editbox, you can only pipe statements, you can't use newlines.
 
'''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.
+
You will notice that after the first ''//echo'' command, once we've piped, we do not need to type anymore 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.
 
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? ===
 
=== Let's make it into an alias, shall we? ===
Line 357: Line 349:
 
The ''//'' indicates the the line should be evaluated. ''$me'' is replaced with the corresponding value twice because the spaced out pipe '|' is interpreted as the delimiter of commands.
 
The ''//'' indicates the the line should be evaluated. ''$me'' is replaced with the corresponding value twice because the spaced out pipe '|' is interpreted as the delimiter of commands.
 
<source lang="mIRC">/echo -a $me | echo -a $me</source>
 
<source lang="mIRC">/echo -a $me | echo -a $me</source>
The ''/'' indicates that the line should not be evaluated. ''$me'' is returned literally, as plain text as we saw earlier, and therefore is not replaced. The pipe is also not interpreted.
+
The ''/'' indicates that the line should not be evaluated. ''$me' is returned literally, as plain text as we saw earlier, and therefore is not replaced. The pipe is also not interpreted.
  
 
{{mIRC|variables}} are also special, in that they need to be evaluated the same way as identifiers. Evaluating variables is the only way to extract the value that they hold.
 
{{mIRC|variables}} are also special, in that they need to be evaluated the same way as identifiers. Evaluating variables is the only way to extract the value that they hold.
 
There is 1 small area where a //command typed in an editbox is interpreted differently than when the same command is placed inside an alias within a remote script. mIRC assumes that a command typed into the editbox which begins with the name of a variable or identifier is an error, so it halts execution at that point, and won't execute any remaining commands separated by the pipe symbol.
 
 
<pre>//var %temp echo | echo -a message 1 | %temp echo -a test $me | echo -a message 2</pre>
 
 
If this line were in a remote script (where it doesn't matter whether or not the line begins with //), the %temp variable would be evaluated into its contents before executing that command, so it behaves as if the command begins with "echo echo" instead of "%temp echo", and it would display into the active window "echo -a test" followed by your current nick. However if you pasted the 4 commands into the editbox, it displays only "message 1", because it halts as soon as it encounters a command beginning with a $ or % symbol. You can force the editbox to evaluate a %variable or $identifier at the beginning of the command by wrapping it inside [ square braces ]. The square braces must not touch any other character except a SPACE, or else they will not be treated as the special symbol forcing evaluation in a situation where it would not normally evaluate.
 
 
<pre>//var %temp echo | echo -a message 1 | [ %temp ] echo -a test $me | echo -a message 2</pre>
 
 
Adding the [ square braces ] forces the editbox to evaluate %temp, and it will then behave the same way it behaves in the remote script. If the %temp contents were $null (empty), the command in the remote script is executed as if "%temp echo -a test $me" changes to "echo -a test $me", and the displayed message changes from "echo -a test YourNick" to "test YourNick".
 
 
The same thing happens when the editbox command begins with a dollar sign:
 
 
<pre>//echo -a message 1 | $lower(echo) -a test | message 2</pre>
 
 
This line inside a remote script displays both "test" and "message 2", but in the editbox it halts after displaying "message 1". By using the [ square braces ] you can force it to evaluate the identifier, and uses the returned value of the identifier as part of the command:
 
 
<pre>//echo -a message 1 | [ $lower(echo) ] -a test | message 2</pre>
 
  
 
== On your own: ==
 
== On your own: ==
Line 399: Line 373:
 
  <span style="color: #009300;">This</span> <span style="color: #FF0000;">is</span> <span style="color: #9C009C;">a</span> <span style="color: #009393;">cool</span> <span style="color: #D2D2D2;">example</span><span style="color: #009300;">.</span>
 
  <span style="color: #009300;">This</span> <span style="color: #FF0000;">is</span> <span style="color: #9C009C;">a</span> <span style="color: #009393;">cool</span> <span style="color: #D2D2D2;">example</span><span style="color: #009300;">.</span>
  
<source lang="mIRC">//echo -a The number �042� is even.</source>
+
<source lang="mIRC">//echo -a The number �42� is even.</source>
 
 
(This website does not correctly handle the color-code, so the above symbols containing the "?" should be edited in your editbox before pressing enter. Replace those symbols by the character returned from pressing Ctrl+K, holding down the CONTROL button while pressing the "K" button once. You can close the popup color box because the script already contains the color number.)
 
  
 
Will produce the following result:
 
Will produce the following result:
Line 407: Line 379:
 
  The number  is even.
 
  The number  is even.
  
Notice that the number is not showing. That's because it was considered part of the color number '42'. Color index 42 is a shade of yellow, so if the 2nd color code had not been used to reset the colors, the remainder of the line would show in the index 42's shade of yellow instead of showing in red. Prefixing the color value with a zero will fix this issue:
+
Notice that the number is not showing. That's because it was considered part of the color number '42'. Prefixing the color value with a zero will fix this issue:
  
 
<source lang="mIRC">//echo -a The number �042� is even.</source>
 
<source lang="mIRC">//echo -a The number �042� is even.</source>
Line 414: Line 386:
  
 
  The number <span style="color: #FF0000;">2</span> is even.
 
  The number <span style="color: #FF0000;">2</span> is even.
 
'''Note:''' Most fonts display strange symbols when you press the keys for formatting codes, such as Ctrl+B bold and Ctrl+K color and Ctrl+O. If you want to see these symbols differently in your script editor, search for the font "Fixedsys Excelsior", because it shows these symbols with a small b/c/o inside a black square, though it won't show special symbols for other format codes like Ctrl+R Ctrl+I Ctrl+U. You can change the Font of your scripts editor to be different than the fonts of your channels, and it's usually easier to read code if you choose a non-proportional (fixed) font for the script editor. The "No Liga" version can be downloaded here: http://www.xise.nl/mirc/fsex2p00se3.ttf
 
  
 
=== Actions ===
 
=== Actions ===

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)