<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."/>
{"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"/enigma-bbs/assets/images/enigma-logo.png"}},"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.","url":"/enigma-bbs/art/mci.html","headline":"MCI Codes","@type":"BlogPosting","dateModified":"2022-05-08T17:38:55+00:00","datePublished":"2022-05-08T17:38:55+00:00","mainEntityOfPage":{"@type":"WebPage","@id":"/enigma-bbs/art/mci.html"},"@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>MCI codes are composed of two characters and are prefixed with a percent (%) symbol.</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>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>
</tr>
</tbody>
</table>
<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>
<h2id="views">Views</h2>
<p>A <strong>View</strong> is a control placed on a <strong>form</strong> that can display variable data or collect input. One example of a View is
a Vertical Menu (<codeclass="language-plaintext highlighter-rouge">%VM</code>): Old-school BBSers may recognize this as a lightbar menu.</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>
<h3id="mask-edits">Mask Edits</h3>
<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>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>
<td>Sets the format for a focused list entry. See <strong>Entry Formatting</strong> below</td>
</tr>
</tbody>
</table>
<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>
<h3id="custom-properties">Custom Properties</h3>
<p>Often a module will provide custom properties that receive format objects (See <strong>Entry Formatting</strong> 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>
<h3id="text-styles">Text Styles</h3>
<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>
<h3id="additional-text-styles">Additional Text Styles</h3>
<p>Some of the text styles mentioned above are also available in the mini format language:</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>