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> | ||
− | |||
− | |||
=== 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 | + | 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]] | ||
− | |||
− | |||
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 | + | 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. | ||
− | |||
− | |||
− | |||
− | |||
=== Let's make it into an alias, shall we? === | === Let's make it into an alias, shall we? === | ||
Line 142: | Line 134: | ||
<source lang="mIRC">alias fun { if (1 == 1) { echo Scripting } | if (2 == 3) { echo Is } | echo = | echo Fun! }</source> | <source lang="mIRC">alias fun { if (1 == 1) { echo Scripting } | if (2 == 3) { echo Is } | echo = | echo Fun! }</source> | ||
− | This should help you understand | + | This should help you understand may be used brackets are used. They are others situations with if statements where not using bracket will be a problem for example, remember the bracket helps mIRC identifying the block of code, but also the condition, when using a if/elseif/while statement, Here is a final example: |
<source lang="mIRC">alias fun { | <source lang="mIRC">alias fun { | ||
Line 201: | Line 193: | ||
== Comments == | == Comments == | ||
Comments are normal, readable text that can be placed inside of your script, and they are a good practice to help better explain to other scripters what's going on in your code. Technically speaking, a comment can say whatever you want it to say, and they are ignored when the program is executed, meaning they have no effect on the actual behavior of the code. | Comments are normal, readable text that can be placed inside of your script, and they are a good practice to help better explain to other scripters what's going on in your code. Technically speaking, a comment can say whatever you want it to say, and they are ignored when the program is executed, meaning they have no effect on the actual behavior of the code. | ||
+ | |||
+ | All comments are preceded by the ''';''' character, which is the semi-colon. | ||
=== Single-line Comments === | === Single-line Comments === | ||
Line 220: | Line 214: | ||
[[File:Fun comment.png]] | [[File:Fun comment.png]] | ||
− | |||
− | |||
=== Multi-line Comments === | === Multi-line Comments === | ||
The second type of comment is the multi-line comment. A multi-line comment can, as its name suggests, span multiple lines. Multi-line comments are enclosed between the '''/*''' & '''*/''' characters. The syntax for a multi-line comment is: | The second type of comment is the multi-line comment. A multi-line comment can, as its name suggests, span multiple lines. Multi-line comments are enclosed between the '''/*''' & '''*/''' characters. The syntax for a multi-line comment is: | ||
− | <source lang="mIRC"> | + | <source lang="mIRC">/* This is |
− | |||
− | /* This is | ||
a multi-line | a multi-line | ||
comment! | comment! | ||
Line 237: | Line 227: | ||
# <span style="color: #DB0000;">Text may touch the opening '''/*''' on the right; however, '''/*''' must start the line</span> | # <span style="color: #DB0000;">Text may touch the opening '''/*''' on the right; however, '''/*''' must start the line</span> | ||
# <span style="color: #DB0000;">The closing '''*/''' must be on a line of its own</span> | # <span style="color: #DB0000;">The closing '''*/''' must be on a line of its own</span> | ||
− | |||
=== <span style="color: #256B22;">Right Examples</span> === | === <span style="color: #256B22;">Right Examples</span> === | ||
Line 255: | Line 244: | ||
the lines are spaced out and the closing parameters are by themselves. These are both | the lines are spaced out and the closing parameters are by themselves. These are both | ||
examples of proper multi-line comment blocks. | examples of proper multi-line comment blocks. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Line 286: | Line 255: | ||
The */ is not on a line of Its own. | The */ is not on a line of Its own. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Identifiers == | == Identifiers == | ||
Line 357: | Line 298: | ||
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 | + | 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. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== On your own: == | == On your own: == | ||
Line 399: | Line 322: | ||
<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 | + | <source lang="mIRC">//echo -a The number �42� is even.</source> |
− | |||
− | |||
Will produce the following result: | Will produce the following result: | ||
Line 407: | Line 328: | ||
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' | + | 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 335: | ||
The number <span style="color: #FF0000;">2</span> is even. | The number <span style="color: #FF0000;">2</span> is even. | ||
− | |||
− | |||
=== Actions === | === Actions === | ||
Line 451: | Line 370: | ||
Next up are the {{mirc|aliases}}. If you feel comfortable with aliases, feel free to move on to {{mirc|variables}}. | Next up are the {{mirc|aliases}}. If you feel comfortable with aliases, feel free to move on to {{mirc|variables}}. | ||
− | [[Category:mIRC | + | [[Category:mIRC]] |