<metaname="description"content="MCI Codes ENiGMA½ supports a variety of MCI codes. Some predefined codes produce information about the current user, system, or other statistics while others are used to instantiate a View."/>
<metaproperty="og:description"content="MCI Codes ENiGMA½ supports a variety of MCI codes. Some predefined codes produce information about the current user, system, or other statistics while others are used to instantiate a View."/>
{"description":"MCI Codes ENiGMA½ supports a variety of MCI codes. Some predefined codes produce information about the current user, system, or other statistics while others are used to instantiate a View.","headline":"MCI Codes","url":"/enigma-bbs/art/mci.html","dateModified":"2023-06-19T17:59:31+00:00","@type":"BlogPosting","datePublished":"2023-06-19T17:59:31+00:00","mainEntityOfPage":{"@type":"WebPage","@id":"/enigma-bbs/art/mci.html"},"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"/enigma-bbs/assets/images/enigma-logo.png"}},"@context":"https://schema.org"}</script>
<p>ENiGMA½ supports a variety of MCI codes. Some <strong>predefined</strong> codes produce information about the current user, system, or other statistics while others are used to instantiate a <strong>View</strong>.</p>
<p><imgclass="emoji"title=":information_source:"alt=":information_source:"src="https://github.githubassets.com/images/icons/emoji/unicode/2139.png"height="20"width="20"> To explicitly tie a MCI to a specific View ID, suffix the MCI code with a number. For example: <codeclass="language-plaintext highlighter-rouge">%BN1</code>.</p>
<p><imgclass="emoji"title=":information_source:"alt=":information_source:"src="https://github.githubassets.com/images/icons/emoji/unicode/2139.png"height="20"width="20"> Standard (non-focus) and focus colors are set by placing duplicate codes back to back in art files:</p>
<p>Some MCI codes have additional options that may be set directly from the code itself while others – and more advanced options – are controlled via the current theme.</p>
<h2id="relationship-with-menus-art-and-themes">Relationship with Menus, Art, and Themes</h2>
<p>A MCI code that appears in a <codeclass="language-plaintext highlighter-rouge">menu.hjson</code> entry corresponds to that found in it’s associated art file. This same MCI code can be referenced in the <codeclass="language-plaintext highlighter-rouge">theme.hjson</code> in order to apply a theme.</p>
<p>See <ahref="../docs/configuration/menu-hjson.md">Menus</a> and <ahref="/enigma-bbs/art/themes.html">Themes</a> for more information.</p>
<h2id="predefined-codes">Predefined Codes</h2>
<p>There are many predefined MCI codes that can be used anywhere on the system (placed in any art file).</p>
<td>Indicator as to rather the current user is <strong>available</strong> or not. See also <codeclass="language-plaintext highlighter-rouge">getStatusAvailIndicators()</code> in <ahref="/enigma-bbs/art/themes.html">Themes</a>
<td>Indicator as to rather the current user is <strong>visible</strong> or not. See also <codeclass="language-plaintext highlighter-rouge">getStatusVisibleIndicators()</code> in <ahref="/enigma-bbs/art/themes.html">Themes</a>
<td>A special code that may be utilized for placement identification when creating menus or to extend an otherwise empty space in an art file down the screen.</td>
<p><imgclass="emoji"title=":information_source:"alt=":information_source:"src="https://github.githubassets.com/images/icons/emoji/unicode/2139.png"height="20"width="20"> More are added all the time so also check out <ahref="https://github.com/NuSkooler/enigma-bbs/blob/master/core/mci_view_factory.js">core/predefined_mci.js</a> for a full listing.</p>
<p><imgclass="emoji"title=":memo:"alt=":memo:"src="https://github.githubassets.com/images/icons/emoji/unicode/1f4dd.png"height="20"width="20"> Many codes attempt to pay homage to Oblivion/2, iNiQUiTY, etc.</p>
<p><imgclass="emoji"title=":information_source:"alt=":information_source:"src="https://github.githubassets.com/images/icons/emoji/unicode/2139.png"height="20"width="20"> Peek at <ahref="https://github.com/NuSkooler/enigma-bbs/blob/master/core/mci_view_factory.js">/core/mci_view_factory.js</a> to see additional information.</p>
<p>Mask Edits (<codeclass="language-plaintext highlighter-rouge">%ME</code>) use the special <codeclass="language-plaintext highlighter-rouge">maskPattern</code> property to control a <em>mask</em>. This can be useful for gathering dates, phone numbers, so on.</p>
<p><codeclass="language-plaintext highlighter-rouge">maskPattern</code>’s can be composed of the following characters:</p>
<codeclass="language-plaintext highlighter-rouge">@</code>: Alphanumeric (combination of the previous patterns)</li>
<li>
<codeclass="language-plaintext highlighter-rouge">&</code>: Any “printable” character</li>
</ul>
<p>Any other characters are literals.</p>
<p>An example of a mask for a date may look like this: <codeclass="language-plaintext highlighter-rouge">##/##/####</code>.</p>
<p>Additionally, the following theme stylers can be applied:</p>
<ul>
<li>
<codeclass="language-plaintext highlighter-rouge">styleSGR1</code>: Controls literal character colors for non-focused controls</li>
<li>
<codeclass="language-plaintext highlighter-rouge">styleSGR2</code>: Controls literal character colors for focused controls</li>
<li>
<codeclass="language-plaintext highlighter-rouge">styleSGR3</code>: Controls fill colors (characters that have not yet received input).</li>
</ul>
<p>All of the style properties can take pipe codes such as <codeclass="language-plaintext highlighter-rouge">|00|08</code>.</p>
<h3id="view-identifiers">View Identifiers</h3>
<p>As mentioned above, MCI codes can (and often should) be explicitly tied to a <em>View Identifier</em>. Simply speaking this is a number representing the particular view. These can be useful to reference in code, apply themes, etc.</p>
<p>A view ID is tied to a MCI code by specifying it after the code. For example: <codeclass="language-plaintext highlighter-rouge">%VM1</code> or <codeclass="language-plaintext highlighter-rouge">%SM10</code>.</p>
<h2id="properties--theming">Properties & Theming</h2>
<p>Predefined MCI codes and other Views can have properties set via <codeclass="language-plaintext highlighter-rouge">menu.hjson</code> and further <em>themed</em> via <codeclass="language-plaintext highlighter-rouge">theme.hjson</code>. See <ahref="/enigma-bbs/art/themes.html">Themes</a> for more information on this subject.</p>
<td>Set’s the view’s text if applicable, such as a <ahref="/enigma-bbs/art/views/text_view.html">TextView</a> or <ahref="/enigma-bbs/art/views/edit_text_view.html">EditTextView</a> amongst others. See <ahref="#mci-formatting">MCI Formatting</a> below for advanced formatting options using the</td>
<td>If set to <codeclass="language-plaintext highlighter-rouge">true</code> any <codeclass="language-plaintext highlighter-rouge">accept</code> action upon this view will submit the encompassing <strong>form</strong>
<p>These are just a few of the properties set on various views. <em>Use the source Luke</em>, as well as taking a look at the default <codeclass="language-plaintext highlighter-rouge">menu.hjson</code> and <codeclass="language-plaintext highlighter-rouge">theme.hjson</code> files!</p>
<p>Often a module will provide custom properties that receive format objects (See <ahref="#entry-formatting">Entry Formatting</a> below). Custom property formatting can be declared in the <codeclass="language-plaintext highlighter-rouge">config</code> block. For example, <codeclass="language-plaintext highlighter-rouge">browseInfoFormat10</code>…<em>N</em> (where <em>N</em> is up to 99) in the <codeclass="language-plaintext highlighter-rouge">file_area_list</code> module received a fairly extensive format object that contains <codeclass="language-plaintext highlighter-rouge">{fileName}</code>, <codeclass="language-plaintext highlighter-rouge">{estReleaseYear}</code>, etc.</p>
<p>Standard style types available for <codeclass="language-plaintext highlighter-rouge">textStyle</code> and <codeclass="language-plaintext highlighter-rouge">focusTextStyle</code>:</p>
<p>Various strings can be formatted using a syntax that allows width & precision specifiers, text styling, etc. Depending on the context, various elements can be referenced by <codeclass="language-plaintext highlighter-rouge">{name}</code>. Additional text styles can be supplied as well. The syntax is largely modeled after Python’s <ahref="https://docs.python.org/3/library/string.html#format-specification-mini-language">string format mini language</a>.</p>
<p>For more advanced layouts, you may want to apply formatting to MCI codes. In this case, an alternative syntax is supported similar to standard <ahref="#entry-formatting">Entry Formatting</a>.</p>
<p>MCI codes can be surrounded by <codeclass="language-plaintext highlighter-rouge">{</code> and <codeclass="language-plaintext highlighter-rouge">}</code> in the <codeclass="language-plaintext highlighter-rouge">text</code> field in your <codeclass="language-plaintext highlighter-rouge">theme.hjson</code> for a Text Label (<codeclass="language-plaintext highlighter-rouge">%TL</code> aka <ahref="/enigma-bbs/art/views/text_view.html">Text View</a>). Some examples:</p>
<pre><codeclass="language-hjson">text: "|00|07{BN!stylel33t}" // render board name in "l33t" text
// MCI codes that produce a number can use appropriate stylers as well
text: "|00|07{SD:,}"
// ...or perhaps
text: "|00:07{SD!countWithAbbr}"
</code></pre>
<blockquote>
<p><imgclass="emoji"title=":bulb:"alt=":bulb:"src="https://github.githubassets.com/images/icons/emoji/unicode/1f4a1.png"height="20"width="20"> MCI formatting also applies when programmatically calling <ahref="https://github.com/NuSkooler/enigma-bbs/blob/6710bf8c084487be2ee1d46d72a05d17a7b166f4/core/text_view.js#L148">setText()</a> of <ahref="/enigma-bbs/art/views/text_view.html">TextView’s</a> and derived views.</p>
<td>File size (converted from bytes) with abbreviation such as <codeclass="language-plaintext highlighter-rouge">1 MB</code>, <codeclass="language-plaintext highlighter-rouge">2.2 GB</code>, <codeclass="language-plaintext highlighter-rouge">34 KB</code>, etc.</td>
<td>Just the abbreviation given a file size (converted from bytes) such as <codeclass="language-plaintext highlighter-rouge">MB</code> or <codeclass="language-plaintext highlighter-rouge">GB</code>.</td>
<td>Count with abbreviation such as <codeclass="language-plaintext highlighter-rouge">100 K</code>, <codeclass="language-plaintext highlighter-rouge">4.3 B</code>, etc.</td>
<td>Converts the provided <em>hours</em> value to something friendly such as <codeclass="language-plaintext highlighter-rouge">4 hours</code>, or <codeclass="language-plaintext highlighter-rouge">4 days</code>.</td>
<td>Converts the provided <em>minutes</em> to something friendly such as <codeclass="language-plaintext highlighter-rouge">10 minutes</code> or <codeclass="language-plaintext highlighter-rouge">2 hours</code>
<td>Converts the provided <em>seconds</em> to something friendly such as <codeclass="language-plaintext highlighter-rouge">23 seconds</code> or <codeclass="language-plaintext highlighter-rouge">2 minutes</code>
</td>
</tr>
</tbody>
</table>
<h4id="examples">Examples</h4>
<p>Suppose a format object contains the following elements: <codeclass="language-plaintext highlighter-rouge">userName</code> and <codeclass="language-plaintext highlighter-rouge">affils</code>. We could create a <codeclass="language-plaintext highlighter-rouge">itemFormat</code> entry that builds a item to our specifications: <codeclass="language-plaintext highlighter-rouge">|04{userName!styleFirstLower} |08- |13{affils}</code>. This may produce a string such as this:</p>
<p><imgclass="emoji"title=":bulb:"alt=":bulb:"src="https://github.githubassets.com/images/icons/emoji/unicode/1f4a1.png"height="20"width="20"> Remember that a Python <ahref="https://docs.python.org/3/library/string.html#format-specification-mini-language">string format mini language</a> style syntax is available for widths, alignment, number prevision, etc. as well. A number can be made to be more human readable for example: <codeclass="language-plaintext highlighter-rouge">{byteSize:,}</code> may yield “1,123,456”.</p>