From WikiChip
Editing mirc

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 10: Line 10:
 
== Language Constructs ==
 
== Language Constructs ==
 
{{main|mirc/conditional_statements|mirc/while_loops|mirc/operators|l1=mSL If Statements|l2=mSL Looping Statements|l3=mSL Operators}}
 
{{main|mirc/conditional_statements|mirc/while_loops|mirc/operators|l1=mSL If Statements|l2=mSL Looping Statements|l3=mSL Operators}}
mSL is a unique programming language that is coded with just plain text.  Other programming languages are coded in plain text but they all require special syntax which require declaring plain text by putting quotes around it and text code that gets executed is declared being VERY specific about its nature. What I mean is '2010' (quoted) and 2010 (unquoted) are not equal in programming languages other than mSL because each letter, number, symbol is referenced by a number in a range from 1-127 for simple text. So the number 2 is assigned character number 50 (i know its a big number) and the zero is mapped to character number 48.  The digital mappings only go from 1 to 9 as 10 would be a combination of character 49 (one) and 48 (zero) or ONE then ZERO but NOT one & zero.  Conclusion, in mSL there is no quoting of strings and unquoted numbers they just work as you would expect.  As you can guess mSL has another idea for this dilemma and that is {{mirc|identifiers}} of which you can make your own and they usually return some <code>plain text</code> or returns nothing or does a <code>/halt</code> which stops your script from processing code any further than the identifiers <code>/halt</code> commandIf it is an <code>on event</code> happening then mSL still processes all script.mrc files.
+
mSL is a unique programming language that is coded with just plain text.  Other programming languages are coded in plain text but they all require special syntax which require declaring plain text by putting quotes around it and text code that gets executed is declared being VERY specific about its nature. What I mean is '2010' (quoted) and 2010 (unquoted) are not equal in programming languages other than mSL because each letter, number, symbol is referenced by a number in a range from 1-127 for simple text. So the number 2 is assigned character number 50 (i know its a big number) and the zero is mapped to character number 48.  The digital mappings only go from 1 to 9 as 10 would be a combination of character 49 (one) and 48 (zero) or one THEN zero but NOT one & zero. So back to if '2010' is greater, equal, or less than 2010 (noquotes) then you would be comparing character mapping 50 (text '2') to the digital value 2 where 2 means 2 but 2010 means 2 then 0 then 1 then 0.  Compared to '2010' which is 50 then 48 then 49 then 48. Then you can see the quoted numbers are much larger and only one character is checked at a time, the maximum value a number can have is 9 compared to a colossal 57 (quoted text number 9).  Unquoted numbers get used at face value one at a time from left to right first of the two compared character map value and digit face value that is largest first wins the "greater-than is $true" test.  In some programming languages even 100 us considered smaller than only 5 because the 1 is a lower digit but not all programming languages work this way.  Conclusion, in mSL there is no quoting of strings and unquoted numbers they just work as you would expect so 5 is less-than 100 always this has an unnoticeable downside in that <code>5 + '100 worlds'</code> could make <code>'5100 worlds'</code> or maybe <code>'105 worlds'</code> and even compute to an error because you are adding a digit to text which you wouldn't do if you were as sane is say Python programmingAs plus is to math as it is to join together, in most cases.  But mSL has another idea for this dilemma and that is {{mirc|identifiers}}.
  
Code is embedded among plain text and is evaluated to plain text. For example <code>One $calc(1+1) Three</code> The result will be <code>One 2 Three</code>. The identifier is the $calc() code. On the surface this may seem like it could result in many ambiguities, however in practice it works fairly fluidly with just a handful of problematic cases - some of which can be avoided.
+
Code is embedded among plain text and is evaluated to plain text. For example <code>One $calc(1+1) Three</code> will correctly treat the <code>One</code> as plain text, {{mirc|evaluate}} the {{mirc|$calc}} {{mirc|identifier}} into <code>2</code> and finally treat <code>Three</code> as plain text. The number is mixed right in to the plain text you do not need to convert the number 2 to plain text any further than just however you have it already. The result will be <code>One 2 Three</code>. On the surface this may seem like it could result in many ambiguities, however in practice it works fairly fluidly with just a handful of problematic cases - many of which can be easily escaped.  Here number 2 is mapped as character ascii value 50 not as the digit 2 which would normally be kept separate from plain text or specially programmed as converted digit 2 into plain text '2'.  It may sound complicated but thats because we are not describing mSL we are describing most other programming languages. There is a difference between appearance and comparison value are different for characters for text strings (large numbers) and just straight up value for digits from left to right one at a time maximum comparison value of just 9 (numbers compare one digit at a time from left to right).
  
 
== Variables and text utilities ==
 
== Variables and text utilities ==
 
{{main|mirc/variables|mirc/string_manipulation|mirc/token_manipulation|l1=mSL Variables|l2=mSL String Manipulation|l3=mSL Token Manipulation}}
 
{{main|mirc/variables|mirc/string_manipulation|mirc/token_manipulation|l1=mSL Variables|l2=mSL String Manipulation|l3=mSL Token Manipulation}}
mSL offers a plethora of facilities that provide an extensive set of ways to work with text and manipulate it. {{mirc|Variables}} can be global, in which case they persist forever until manually removed, or local - which are automatically forgotten after returning from an {{mirc|on events|event}} or an {{mirc|alias|alias call}}.  Local variables are defined using the {{mirc|/var}} command and global variables with the {{mirc|/set}} command. And as we discussed above have no fixed data type in other words they are not forced to contain a specific type of data other than plain text.  In fact everything is more or less treated as plain text with the exception of a handful of {{mirc|identifiers}} that operate on numbers and the {{mirc|/if}} command does NOT work well with non-number and number mixed text data; aside from a direct <code>==</code> and <code>isin</code> (equals-evaluation and contains-text test) but not greater-than or less-than comparison test (with mixed data types it is prone to coding error).
+
mSL offers a plethora of facilities that provide an extensive set of ways to work with text and manipulate it. {{mirc|Variables}} can be global, in which case they persist forever until manually removed, or local - which are automatically forgotten after returning from an {{mirc|on events|event}} or an {{mirc|alias|alias call}}.  Local variables are defined using the {{mirc|/var}} command and global variables with the {{mirc|/set}} command. And as we discussed above have no fixed data type in other words they are not forced to contain a specific type of data other than plain text.  In fact everything is more or less treated as plain text with the exception of a handful of {{mirc|identifiers}} that operate on numbers and the {{mirc|/if}} command does NOT work well with non-number and number mixed text data; aside from a direct <code>==</code> and <code>!=</code> (equals and not-equals) comparison but not greater-than or less-than comparison (with mixed data types it is prone to coding error).
  
 
<source lang=mirc>/var %variable = this is some text value, %2ndbar this is more text value</source>
 
<source lang=mirc>/var %variable = this is some text value, %2ndbar this is more text value</source>
Line 22: Line 22:
 
There are a large number of {{mirc|string manipulation|identifiers that can operate on strings}} - anything from {{mirc|$len|determining the length}}, to obtaining a portion of the string from the beginning or end to case transformation and pattern matching. For example, the simple {{mirc|$left}} identifier can be used to obtain a portion from the left side of the string - e.g., <code>$left(Hello!!, 4)</code> will yield result <code>Hell</code>.
 
There are a large number of {{mirc|string manipulation|identifiers that can operate on strings}} - anything from {{mirc|$len|determining the length}}, to obtaining a portion of the string from the beginning or end to case transformation and pattern matching. For example, the simple {{mirc|$left}} identifier can be used to obtain a portion from the left side of the string - e.g., <code>$left(Hello!!, 4)</code> will yield result <code>Hell</code>.
  
In addition to be treated as plain text, values can also be treated as a list of tokens and operated on using the various {{mirc|token manipulation}} identifiers. One can treat spaces as a [[delimiter]] and thus have a list and use {{mirc|$gettok}} to obtain the 3rd word using <code>$gettok(hello world IMAGiNE, 3, 32)</code>.  This is 3rd word separated by a space (32) opposed to a comma (44), hyphen (45), period (46), or in the case of filenames backslash (92).  And can be any character you choose to separate your list of words with. Space is mapped to character number 32 since you cannot put a space in to code and expect mSL to find something there to evaluate; you must use the number 32 (its character map).
+
In addition to be treated as plain text, values can also be treated as a list of tokens and operated on using the various {{mirc|token manipulation}} identifiers. One can treat spaces as a [[delimiter]] and thus have a list and use {{mirc|$gettok}} to obtain the 3rd word using <code>$gettok(hello world IMAGiNE, 3, 32)</code>.  This is 3rd word separated by a space (32) opposed to a comma (44), hyphen (45), period (46), or in the case of filenames backslash (92).  And can be any character you choose to separate your list of words with. Space is mapped to character number 32 since you cannot put a space in to code and expect mSL to find something there to evaluate with you must use the number 32 (its character map).
  
 
== Data Storage ==
 
== Data Storage ==
Line 35: Line 35:
 
The most functional and highest performance storage method is {{mirc|hash tables}}, which are suitable for large volumes of data and for frequent read and write access. However whilst you can save and restore hash tables from files, you can only save the entire table which has a significant overhead and any changes made since the last save will be lost when mIRC terminates.
 
The most functional and highest performance storage method is {{mirc|hash tables}}, which are suitable for large volumes of data and for frequent read and write access. However whilst you can save and restore hash tables from files, you can only save the entire table which has a significant overhead and any changes made since the last save will be lost when mIRC terminates.
  
The simplest and easiest to use is {{mirc|variables}}, particularly suitable for simple low-volume data such as script settings.
+
The simplest and easiest to use is {{mirc|variables}}, particularly suitable for simple low-volume data like script settings.
  
 
{{mirc|variables}}, {{mirc|ini files}} and {{mirc|text files}} all write data to flat files, and are suitable for moderate volumes of data and write activity. For hard coded storage of values you can shorten your plain text to an {{mirc|custom identifier}}.
 
{{mirc|variables}}, {{mirc|ini files}} and {{mirc|text files}} all write data to flat files, and are suitable for moderate volumes of data and write activity. For hard coded storage of values you can shorten your plain text to an {{mirc|custom identifier}}.

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)