mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
140 lines
39 KiB
HTML
140 lines
39 KiB
HTML
<!DOCTYPE html> <html lang="en-US"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=Edge"> <link rel="stylesheet" href="/sfall/assets/css/just-the-docs-default.css"> <link rel="stylesheet" href="/sfall/assets/css/just-the-docs-head-nav.css" id="jtd-head-nav-stylesheet"> <style id="jtd-nav-activation"> .site-nav > ul.nav-list:first-child > li:not(:nth-child(7)) > a, .site-nav > ul.nav-list:first-child > li > ul > li > a, .site-nav > ul.nav-list:first-child > li > ul > li > ul > li > a { background-image: none; } .site-nav > ul.nav-list:not(:first-child) a, .site-nav li.external a { background-image: none; } .site-nav > ul.nav-list:first-child > li:nth-child(7) > a { font-weight: 600; text-decoration: none; }.site-nav > ul.nav-list:first-child > li:nth-child(7) > button svg { transform: rotate(-90deg); }.site-nav > ul.nav-list:first-child > li.nav-list-item:nth-child(7) > ul.nav-list { display: block; } </style> <script src="/sfall/assets/js/vendor/lunr.min.js"></script> <script src="/sfall/assets/js/just-the-docs.js"></script> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="icon" href="/sfall/favicon.ico" type="image/x-icon"> <!-- Begin Jekyll SEO tag v2.8.0 --> <title>SSLC | sfall</title> <meta name="generator" content="Jekyll v3.9.0" /> <meta property="og:title" content="SSLC" /> <meta property="og:locale" content="en_US" /> <meta name="description" content="Sfall documentation" /> <meta property="og:description" content="Sfall documentation" /> <link rel="canonical" href="/sfall/sslc/" /> <meta property="og:url" content="/sfall/sslc/" /> <meta property="og:site_name" content="sfall" /> <meta property="og:type" content="website" /> <meta name="twitter:card" content="summary" /> <meta property="twitter:title" content="SSLC" /> <script type="application/ld+json"> {"@context":"https://schema.org","@type":"WebPage","description":"Sfall documentation","headline":"SSLC","url":"/sfall/sslc/"}</script> <!-- End Jekyll SEO tag --> <link rel="apple-touch-icon" sizes="180x180" href="/assets/favicon/apple-touch-icon.png"> <link rel="icon" type="image/png" sizes="32x32" href="/assets/favicon/favicon-32x32.png"> <link rel="icon" type="image/png" sizes="16x16" href="/assets/favicon/favicon-16x16.png"> <link rel="manifest" href="/assets/favicon/site.webmanifest"> <link rel="mask-icon" href="/assets/favicon/safari-pinned-tab.svg" color="#5bbad5"> <meta name="msapplication-TileColor" content="#da532c"> <meta name="msapplication-config" content="/assets/favicon/browserconfig.xml"> <meta name="theme-color" content="#ffffff"> </head> <body> <a class="skip-to-main" href="#main-content">Skip to main content</a> <svg xmlns="http://www.w3.org/2000/svg" class="d-none"> <symbol id="svg-link" viewBox="0 0 24 24"> <title>Link</title> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"> <path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path> </svg> </symbol> <symbol id="svg-menu" viewBox="0 0 24 24"> <title>Menu</title> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-menu"> <line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="18" x2="21" y2="18"></line> </svg> </symbol> <symbol id="svg-arrow-right" viewBox="0 0 24 24"> <title>Expand</title> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-right"> <polyline points="9 18 15 12 9 6"></polyline> </svg> </symbol> <!-- Feather. MIT License: https://github.com/feathericons/feather/blob/master/LICENSE --> <symbol id="svg-external-link" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-external-link"> <title id="svg-external-link-title">(external link)</title> <path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path><polyline points="15 3 21 3 21 9"></polyline><line x1="10" y1="14" x2="21" y2="3"></line> </symbol> <symbol id="svg-doc" viewBox="0 0 24 24"> <title>Document</title> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file"> <path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"></path><polyline points="13 2 13 9 20 9"></polyline> </svg> </symbol> <symbol id="svg-search" viewBox="0 0 24 24"> <title>Search</title> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"> <circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line> </svg> </symbol> <!-- Bootstrap Icons. MIT License: https://github.com/twbs/icons/blob/main/LICENSE.md --> <symbol id="svg-copy" viewBox="0 0 16 16"> <title>Copy</title> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-clipboard" viewBox="0 0 16 16"> <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z"/> <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z"/> </svg> </symbol> <symbol id="svg-copied" viewBox="0 0 16 16"> <title>Copied</title> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-clipboard-check-fill" viewBox="0 0 16 16"> <path d="M6.5 0A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3Zm3 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3Z"/> <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1A2.5 2.5 0 0 1 9.5 5h-3A2.5 2.5 0 0 1 4 2.5v-1Zm6.854 7.354-3 3a.5.5 0 0 1-.708 0l-1.5-1.5a.5.5 0 0 1 .708-.708L7.5 10.793l2.646-2.647a.5.5 0 0 1 .708.708Z"/> </svg> </symbol> </svg> <div class="side-bar"> <div class="site-header" role="banner"> <a href="/sfall/" class="site-title lh-tight"> sfall </a> <button id="menu-button" class="site-button btn-reset" aria-label="Toggle menu" aria-pressed="false"> <svg viewBox="0 0 24 24" class="icon" aria-hidden="true"><use xlink:href="#svg-menu"></use></svg> </button> </div> <nav aria-label="Main" id="site-nav" class="site-nav"> <ul class="nav-list"><li class="nav-list-item"><a href="/sfall/" class="nav-list-link">Home</a></li><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in Arrays category" aria-pressed="false"> <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg> </button><a href="/sfall/arrays/" class="nav-list-link">Arrays</a><ul class="nav-list"><li class="nav-list-item"><a href="/sfall/array-functions/" class="nav-list-link">Array functions</a></li><li class="nav-list-item"><a href="/sfall/lists/" class="nav-list-link">Lists</a></li></ul></li><li class="nav-list-item"><a href="/sfall/best-practices/" class="nav-list-link">Best practices</a></li><li class="nav-list-item"><a href="/sfall/data-types/" class="nav-list-link">Data types</a></li><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in Global scripts category" aria-pressed="false"> <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg> </button><a href="/sfall/global-scripts/" class="nav-list-link">Global scripts</a><ul class="nav-list"><li class="nav-list-item"><a href="/sfall/global-script-functions/" class="nav-list-link">Global script functions</a></li></ul></li><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in Hooks category" aria-pressed="false"> <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg> </button><a href="/sfall/hooks/" class="nav-list-link">Hooks</a><ul class="nav-list"><li class="nav-list-item"><a href="/sfall/hook-functions/" class="nav-list-link">Hook functions</a></li><li class="nav-list-item"><a href="/sfall/hook-types/" class="nav-list-link">Hook types</a></li></ul></li><li class="nav-list-item"><a href="/sfall/sslc/" class="nav-list-link">SSLC</a></li><li class="nav-list-item"><a href="/sfall/optimization/" class="nav-list-link">Optimization</a></li><li class="nav-list-item"><a href="/sfall/animations/" class="nav-list-link">Animations</a></li><li class="nav-list-item"><a href="/sfall/art-and-appearance/" class="nav-list-link">Art and appearance</a></li><li class="nav-list-item"><a href="/sfall/audio/" class="nav-list-link">Audio</a></li><li class="nav-list-item"><a href="/sfall/car/" class="nav-list-link">Car</a></li><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in Combat category" aria-pressed="false"> <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg> </button><a href="/sfall/combat/" class="nav-list-link">Combat</a><ul class="nav-list"><li class="nav-list-item"><a href="/sfall/knockback/" class="nav-list-link">Knockback</a></li><li class="nav-list-item"><a href="/sfall/weapons-and-ammo/" class="nav-list-link">Weapons and ammo</a></li></ul></li><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in Direct memory access category" aria-pressed="false"> <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg> </button><a href="/sfall/direct-memory-access/" class="nav-list-link">Direct memory access</a><ul class="nav-list"><li class="nav-list-item"><a href="/sfall/call_offset_vx/" class="nav-list-link">call_offset_vX</a></li><li class="nav-list-item"><a href="/sfall/read_xxx/" class="nav-list-link">read_xxx</a></li><li class="nav-list-item"><a href="/sfall/write_xxx/" class="nav-list-link">write_xxx</a></li></ul></li><li class="nav-list-item"><a href="/sfall/explosions/" class="nav-list-link">Explosions</a></li><li class="nav-list-item"><a href="/sfall/global-variables/" class="nav-list-link">Global variables</a></li><li class="nav-list-item"><a href="/sfall/graphics/" class="nav-list-link">Graphics</a></li><li class="nav-list-item"><a href="/sfall/ini-settings/" class="nav-list-link">INI settings</a></li><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in Interface category" aria-pressed="false"> <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg> </button><a href="/sfall/interface/" class="nav-list-link">Interface</a><ul class="nav-list"><li class="nav-list-item"><a href="/sfall/cursor/" class="nav-list-link">Cursor</a></li><li class="nav-list-item"><a href="/sfall/inventory/" class="nav-list-link">Inventory</a></li><li class="nav-list-item"><a href="/sfall/main-interface/" class="nav-list-link">Main interface</a></li><li class="nav-list-item"><a href="/sfall/outline/" class="nav-list-link">Outline</a></li><li class="nav-list-item"><a href="/sfall/pip-boy/" class="nav-list-link">Pip-Boy</a></li><li class="nav-list-item"><a href="/sfall/tags/" class="nav-list-link">Tags</a></li><li class="nav-list-item"><a href="/sfall/windows-and-images/" class="nav-list-link">Windows and images</a></li></ul></li><li class="nav-list-item"><a href="/sfall/keyboard-and-mouse/" class="nav-list-link">Keyboard and mouse</a></li><li class="nav-list-item"><a href="/sfall/locks/" class="nav-list-link">Locks</a></li><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in Maps and encounters category" aria-pressed="false"> <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg> </button><a href="/sfall/maps-and-encounters/" class="nav-list-link">Maps and encounters</a><ul class="nav-list"><li class="nav-list-item"><a href="/sfall/rest/" class="nav-list-link">Rest</a></li><li class="nav-list-item"><a href="/sfall/worldmap/" class="nav-list-link">Worldmap</a></li></ul></li><li class="nav-list-item"><a href="/sfall/objects-and-scripts/" class="nav-list-link">Objects and scripts</a></li><li class="nav-list-item"><a href="/sfall/other/" class="nav-list-link">Other</a></li><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in Perks and traits category" aria-pressed="false"> <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg> </button><a href="/sfall/perks-and-traits/" class="nav-list-link">Perks and traits</a><ul class="nav-list"><li class="nav-list-item"><a href="/sfall/npc-perks/" class="nav-list-link">NPC perks</a></li></ul></li><li class="nav-list-item"><a href="/sfall/sfall-funcx-macros/" class="nav-list-link">Sfall funcX macros</a></li><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in Sfall category" aria-pressed="false"> <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg> </button><a href="/sfall/sfall/" class="nav-list-link">Sfall</a><ul class="nav-list"><li class="nav-list-item"><a href="/sfall/funcx/" class="nav-list-link">funcX</a></li><li class="nav-list-item"><a href="/sfall/version/" class="nav-list-link">Version</a></li></ul></li><li class="nav-list-item"><a href="/sfall/skills/" class="nav-list-link">Skills</a></li><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in Stats category" aria-pressed="false"> <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg> </button><a href="/sfall/stats/" class="nav-list-link">Stats</a><ul class="nav-list"><li class="nav-list-item"><a href="/sfall/alter-min-max/" class="nav-list-link">Alter min/max</a></li></ul></li><li class="nav-list-item"><a href="/sfall/tiles-and-paths/" class="nav-list-link">Tiles and paths</a></li><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in Utility category" aria-pressed="false"> <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg> </button><a href="/sfall/utility/" class="nav-list-link">Utility</a><ul class="nav-list"><li class="nav-list-item"><a href="/sfall/math/" class="nav-list-link">Math</a></li><li class="nav-list-item"><a href="/sfall/strings/" class="nav-list-link">Strings</a></li></ul></li><li class="nav-list-item"><a href="/sfall/virtual-file-system/" class="nav-list-link">Virtual file system</a></li></ul> </nav> <footer class="site-footer"> This site uses <a href="https://github.com/just-the-docs/just-the-docs">Just the Docs</a>, a documentation theme for Jekyll. </footer> </div> <div class="main" id="top"> <div id="main-header" class="main-header"> <div class="search" role="search"> <div class="search-input-wrap"> <input type="text" id="search-input" class="search-input" tabindex="0" placeholder="Search sfall" aria-label="Search sfall" autocomplete="off"> <label for="search-input" class="search-label"><svg viewBox="0 0 24 24" class="search-icon"><use xlink:href="#svg-search"></use></svg></label> </div> <div id="search-results" class="search-results"></div> </div> <nav aria-label="Auxiliary" class="aux-nav"> <ul class="aux-nav-list"> <li class="aux-nav-list-item"> <a href="https://nma-fallout.com/threads/fo2-engine-tweaks-sfall.178390/" class="site-button" > Forum </a> </li> <li class="aux-nav-list-item"> <a href="https://github.com/phobos2077/sfall/" class="site-button" > GitHub </a> </li> </ul> </nav> </div> <div class="main-content-wrap"> <div id="main-content" class="main-content"> <main> <h1 class="no_toc" id="sslc"> <a href="#sslc" class="anchor-heading" aria-labelledby="sslc"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> SSLC </h1> <ul id="markdown-toc"> <li><a href="#command-line-options" id="markdown-toc-command-line-options">Command line options</a></li> <li><a href="#additional-supported-syntax" id="markdown-toc-additional-supported-syntax">Additional supported syntax</a></li> <li><a href="#fixes" id="markdown-toc-fixes">Fixes</a></li> <li><a href="#backward-compatibility" id="markdown-toc-backward-compatibility">Backward compatibility</a></li> <li><a href="#int2ssl-note" id="markdown-toc-int2ssl-note">int2ssl note</a></li> </ul> <p>This is a modified copy of sslc, that has a few bugfixes from the original, that will recognise and compile the additional script functions provided by sfall, that can also understand some additional syntax, and that has an integrated preprocessor and optimizer.</p> <p>Unlike the original script compiler, this has not been compiled as a DOS program. When using this in place of the original <code class="language-plaintext highlighter-rouge">compile.exe</code> but still using <code class="language-plaintext highlighter-rouge">p.bat</code>, you need to get rid of the <code class="language-plaintext highlighter-rouge">dos4gw.exe</code> reference from <code class="language-plaintext highlighter-rouge">p.bat</code>.</p> <p>When compiling global or hook scripts for sfall 3.4 or below, you <em>must</em> include the line <code class="language-plaintext highlighter-rouge">procedure start;</code> before any <code class="language-plaintext highlighter-rouge">#include</code> files that define procedures to avoid a few weird problems. This is no longer required starting from 3.5.</p> <p>This version of compiler was designed primarily for new sfall functions, but it can be safely used (and is recommended) with non-sfall scripts as well.</p> <p>The original unmodified sslc source is over here: <a href="https://teamx.ru/site_arc/utils/index.html">https://teamx.ru/site_arc/utils/index.html</a></p> <h2 id="command-line-options"> <a href="#command-line-options" class="anchor-heading" aria-labelledby="command-line-options"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Command line options </h2> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>-q don't wait for input on error
|
||
-n no warnings
|
||
-b use backward compatibility mode
|
||
-l no logo
|
||
-p preprocess source
|
||
-P preprocess only (don't generate .int)
|
||
-F write full file paths in "#line" directives
|
||
-O optimize code (full optimization, see "Optimization" page)
|
||
-O<N> set specific level of optimization (0 - none, 1 - basic, 2 - full, 3 - experimental)
|
||
-d print debug messages
|
||
-D output an abstract syntax tree of the program
|
||
-o set output path (follows the input file name)
|
||
-s enable short-circuit evaluation for all AND, OR operators
|
||
-m<macro>[=<val>] define a macro named "macro" for conditional compilation
|
||
-I<path> specify an additional directory to search for include files
|
||
</code></pre></div></div> <p>The original command line option <code class="language-plaintext highlighter-rouge">-w</code> to turn on warnings no longer has an effect, since warnings are now on by default</p> <h2 id="additional-supported-syntax"> <a href="#additional-supported-syntax" class="anchor-heading" aria-labelledby="additional-supported-syntax"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Additional supported syntax </h2> <p>Syntax which requires sfall for compiled scripts to be interpreted is marked by asterisk (*).</p> <ul> <li> <p>Optional arguments in user-defined procedures. You can only use constants for default values. It basically puts those constants in place of omitted arguments.</p> <ul> <li>new: <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>procedure test(variable x, variable y := 0, variable z := -1) begin
|
||
...
|
||
end
|
||
...
|
||
call test("value");
|
||
</code></pre></div> </div> </li> <li>old: <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>procedure test(variable x, variable y, variable z) begin
|
||
...
|
||
end
|
||
...
|
||
call test("value", 0, -1);
|
||
</code></pre></div> </div> </li> </ul> </li> <li> <p>New logical operators <code class="language-plaintext highlighter-rouge">AndAlso</code>, <code class="language-plaintext highlighter-rouge">OrElse</code> for short-circuit evaluation of logical expressions. Using these operators allow the right part of logical expressions not to be evaluated (executed, computed) if the result is already known. This can improve the performance of running scripts.</p> <p>Example: <code class="language-plaintext highlighter-rouge">if (obj andAlso obj_pid(obj) == PID_STIMPAK) then ...</code></p> <p>If <code class="language-plaintext highlighter-rouge">obj</code> is <code class="language-plaintext highlighter-rouge">null</code>, the second condition will not be checked and your script won’t fail with “obj is null” error in debug.log</p> <p>This also has an effect that a value of last computed argument is returned as a result of whole expressions, instead of always <code class="language-plaintext highlighter-rouge">false</code> (0) or <code class="language-plaintext highlighter-rouge">true</code> (1):</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>obj := false;
|
||
display_msg(obj orElse "something"); // will print "something"
|
||
</code></pre></div> </div> <p>You can also use the <code class="language-plaintext highlighter-rouge">-s</code> option to enable short-circuit evaluation for all the <code class="language-plaintext highlighter-rouge">AND</code>, <code class="language-plaintext highlighter-rouge">OR</code> operators in the script.</p> <p><strong>NOTE:</strong> Be aware that it may break some old scripts because operators behavior is changed slightly.</p> </li> <li>Conditional expressions (Python-inspired), also known as ternary operator: <ul> <li>new: <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>X := value1 if (condition) else value2
|
||
</code></pre></div> </div> </li> <li>old: <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>if (condition) then
|
||
X := value1;
|
||
else
|
||
X := value2;
|
||
</code></pre></div> </div> </li> </ul> </li> <li>To assign values, you can use the alternative assignment operator from <strong>C/Java</strong> instead of <strong>Pascal</strong> syntax. <ul> <li>new: <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>x = 5;
|
||
</code></pre></div> </div> </li> <li>old: <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>x := 5;
|
||
</code></pre></div> </div> </li> </ul> </li> <li>Multiple variable declaration: Multiple variables can be declared on one line, separated by commas. This is an alternative to the ugly begin/end block, or the bulky single variable per line style. <ul> <li>new: <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>variable a, b, c;
|
||
</code></pre></div> </div> </li> <li>old: <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>variable begin a; b; c; end
|
||
</code></pre></div> </div> </li> </ul> </li> <li>Variable initialization with expressions: You can now initialize local variables with complex expressions instead of constants. <ul> <li>new: <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>variable tile := tile_num(dude_obj);
|
||
</code></pre></div> </div> </li> <li>old: <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>variable tile;
|
||
tile := tile_num(dude_obj);
|
||
</code></pre></div> </div> <p><strong>NOTE:</strong> If your expression starts with a constant (eg. <code class="language-plaintext highlighter-rouge">2 + 2</code>), enclose it in parentheses, otherwise compiler will be confused and give you errors.</p> </li> </ul> </li> <li>Hexadecimal numerical constants: Simply prefix a number with <code class="language-plaintext highlighter-rouge">0x</code> to create a hexadecimal. The numbers 0 to 9 and letters A to F are allowed in the number. The number may not have a decimal point. <ul> <li>new: <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>a := 0x1000;
|
||
</code></pre></div> </div> </li> <li>old: <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>a := 4096;
|
||
</code></pre></div> </div> </li> </ul> </li> <li>Increment/decrement operators: <code class="language-plaintext highlighter-rouge">++</code> and <code class="language-plaintext highlighter-rouge">--</code> can be used as shorthand for <code class="language-plaintext highlighter-rouge">+= 1</code> and <code class="language-plaintext highlighter-rouge">-= 1</code> respectively. They are merely a syntactic shorthand to improve readability, and so their use is only allowed where <code class="language-plaintext highlighter-rouge">+= 1</code> would normally be allowed. <ul> <li>new: <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>a++;
|
||
</code></pre></div> </div> </li> <li>old: <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>a += 1;
|
||
</code></pre></div> </div> </li> </ul> </li> <li><code class="language-plaintext highlighter-rouge">break</code> & <code class="language-plaintext highlighter-rouge">continue</code> statements: They work just like in most high-level languages. <code class="language-plaintext highlighter-rouge">break</code> jumps out of the loop. <code class="language-plaintext highlighter-rouge">continue</code> jumps right to the beginning of the next iteration (see <code class="language-plaintext highlighter-rouge">for</code> and <code class="language-plaintext highlighter-rouge">foreach</code> sections for additional details). <ul> <li>new: <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>while (i < N) begin
|
||
// ...
|
||
if (/* some condition */) then break;
|
||
// ...
|
||
end
|
||
</code></pre></div> </div> </li> <li>old: <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>while (i < N and not(breakFlag)) begin
|
||
// ...
|
||
if (/* condition */) then breakFlag := true;
|
||
// ...
|
||
end
|
||
</code></pre></div> </div> </li> <li>new: <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>for (i := 0; i < N; i++) begin
|
||
// ...
|
||
if (/* condition */) then begin
|
||
// action
|
||
continue;
|
||
end
|
||
// else actions
|
||
end
|
||
</code></pre></div> </div> </li> <li>old: <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>for (i := 0; i < N; i++) begin
|
||
// ...
|
||
if (/* condition */) then begin
|
||
// action
|
||
end else begin
|
||
// else actions
|
||
end
|
||
end
|
||
</code></pre></div> </div> </li> </ul> </li> <li><code class="language-plaintext highlighter-rouge">for</code> loops: Another piece of syntactic shorthand, to shorten <code class="language-plaintext highlighter-rouge">while</code> loops in many cases. Parentheses around the loop statements are recommended but not required (when not using parentheses, a semicolon is required after the 3rd loop statement). <ul> <li>new: <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>for (i := 0; i < 5; i++) begin
|
||
display_msg("i = " + i);
|
||
end
|
||
</code></pre></div> </div> </li> <li>old: <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>i := 0;
|
||
while (i < 5) do begin
|
||
display_msg("i = " + i);
|
||
i++;
|
||
end
|
||
</code></pre></div> </div> <p><strong>NOTE:</strong> <code class="language-plaintext highlighter-rouge">continue</code> statement in a <code class="language-plaintext highlighter-rouge">for</code> loop will recognize increment statement (third statement in parentheses) and will execute it before jumping back to the beginning of loop. This way you will not get an endless loop.</p> </li> </ul> </li> <li><code class="language-plaintext highlighter-rouge">switch</code> statements: A shorthand way of writing big <code class="language-plaintext highlighter-rouge">if then else if...</code> blocks <ul> <li>new: <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>switch get_attack_type begin
|
||
case ATKTYPE_PUNCH: display_msg("punch");
|
||
case ATKTYPE_KICK: display_msg("kick");
|
||
default: display_msg("something else");
|
||
end
|
||
</code></pre></div> </div> </li> <li>old: <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>variable tmp;
|
||
tmp := get_attack_type;
|
||
if tmp == ATKTYPE_PUNCH then begin
|
||
display_msg("punch");
|
||
end else if tmp == ATKTYPE_KICK then begin
|
||
display_msg("kick");
|
||
end else begin
|
||
display_msg("something else");
|
||
end
|
||
</code></pre></div> </div> </li> </ul> </li> <li>Procedure stringify operator <code class="language-plaintext highlighter-rouge">@</code>: Designed to make callback-procedures a better option and allow for basic functional programming. Basically it replaces procedure names preceded by <code class="language-plaintext highlighter-rouge">@</code> by a string constant. <ul> <li>old: <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>callbackVar := "Node000";
|
||
call callbackVar;
|
||
</code></pre></div> </div> </li> <li>new: <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>callbackVar := @Node000;
|
||
call callbackVar;
|
||
</code></pre></div> </div> <p>Not many people know that since vanilla Fallout you can call procedures by “calling a variable” containing it’s name as a string value. There was a couple of problems using this:</p> </li> <li>optimizer wasn’t aware that you are referencing a procedure, and could remove it, if you don’t call it explicitly (can be solved by adding making procedure <code class="language-plaintext highlighter-rouge">critical</code>)</li> <li>you couldn’t see all references of a procedure from a Script Editor</li> <li>it was completely not obvious that you could do such a thing, it was a confusing syntax</li> </ul> </li> <li>(*) <strong>Arrays</strong>: In vanilla Fallout, arrays had to be constructed by reserving a block of global/map variables. Since sfall 2.7, specific array targeted functions have been available, but they are fairly messy and long winded to use. The compiler provides additional syntactic shorthand for accessing and setting array variables, as well as for array creation. When declaring an array variable, put a constant integer in <code class="language-plaintext highlighter-rouge">[]</code>` to give the number of elements in the array. (before sfall 3.4 you had to specify size in bytes for array elements, now it’s not required, see “Arrays” page for more information) <ul> <li>new: <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>procedure bingle begin
|
||
variable a[2];
|
||
a[0] := 5;
|
||
a[a[0] - 4] := a[0] + 4;
|
||
display_msg("a[0]=" + a[0] + ", a[1]=" + a[1]);
|
||
end
|
||
</code></pre></div> </div> </li> <li>old: <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>procedure bingle begin
|
||
variable a;
|
||
a := temp_array(2, 4);
|
||
set_array(a, 0, 5);
|
||
set_array(a, get_array(a, 0) - 4, get_array(a, 0) + 4);
|
||
display_msg("a[0]=" + get_array(a, 0) + ", a[1]=" + get_array(a, 1));
|
||
end
|
||
</code></pre></div> </div> </li> </ul> </li> <li>(*) <strong>Array expressions</strong>: Sometimes you need to construct an array of elements and you will probably want to do it in just one expression. This is now possible: <ul> <li>new: <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>list := ["A", "B", "C", "D"];
|
||
</code></pre></div> </div> </li> <li>old: <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>list := temp_array(4, 2);
|
||
list[0] := "A";
|
||
list[1] := "B";
|
||
list[2] := "C";
|
||
list[3] := "D";
|
||
</code></pre></div> </div> <p>Syntax specific for associative arrays is also available. (see “Arrays” page for full introduction to this type of arrays).</p> </li> </ul> </li> <li>(*) <strong>Map array expressions</strong>: <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>map := {5: "five", 10: "ten", 15: "fifteen", 20: "twelve"};
|
||
</code></pre></div> </div> </li> <li>(*) The dot <code class="language-plaintext highlighter-rouge">.</code> syntax to access elements of associative arrays and allow to work with arrays like objects: <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>trap.radius := 3;
|
||
trap.tile := tile_num(dude_obj);
|
||
</code></pre></div> </div> <p>You can chain dot and bracket syntax to access elements of multi-dimensional arrays:</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>collectionList[5].objectList[5].name += " foo";
|
||
</code></pre></div> </div> <p><strong>NOTE:</strong> When using incremental operators like <code class="language-plaintext highlighter-rouge">+=</code>, <code class="language-plaintext highlighter-rouge">*=</code>, <code class="language-plaintext highlighter-rouge">++</code>, <code class="language-plaintext highlighter-rouge">--</code> compiler will use additional temp variable to get an array at penultimate level in order to avoid making the same chain of <code class="language-plaintext highlighter-rouge">get_array</code> calls twice.</p> </li> <li>(*) <code class="language-plaintext highlighter-rouge">foreach</code> loops: A shorthand method of looping over all elements in an array. Syntax is <code class="language-plaintext highlighter-rouge">foreach (<symbol> in <expression>)</code>. <ul> <li>new: <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>procedure bingle begin
|
||
variable critter;
|
||
foreach (critter in list_as_array(LIST_CRITTERS)) begin
|
||
display_msg("" + critter);
|
||
end
|
||
end
|
||
</code></pre></div> </div> </li> <li>old: <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>procedure bingle begin
|
||
variable begin critter; array; len; count; end
|
||
array := list_as_array(LIST_CRITTERS);
|
||
len := len_array(array);
|
||
count := 0;
|
||
while count < len do begin
|
||
critter := array[count];
|
||
display_msg("" + critter);
|
||
end
|
||
end
|
||
</code></pre></div> </div> </li> </ul> <p>If you want an index array element (or key for “maps”) at each iteration, use syntax: <code class="language-plaintext highlighter-rouge">foreach (<symbol>: <symbol> in <expression>)</code></p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>foreach (pid: price in itemPriceMap) begin
|
||
if (itemPid == pid) then
|
||
itemPrice := price;
|
||
end
|
||
</code></pre></div> </div> <p>If you want to add additional condition for continuing the loop, use syntax: <code class="language-plaintext highlighter-rouge">foreach (<symbol> in <expression> while <expression>)</code>. In this case loop will iterate over elements of an array until last element or until “while” expression is true (whatever comes first).</p> <p><strong>NOTE:</strong> Just like <code class="language-plaintext highlighter-rouge">for</code> loop, <code class="language-plaintext highlighter-rouge">continue</code> statement will respect increments of a hidden counter variable, so you can safely use it inside <code class="language-plaintext highlighter-rouge">foreach</code>.</p> </li> </ul> <h2 id="fixes"> <a href="#fixes" class="anchor-heading" aria-labelledby="fixes"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Fixes </h2> <ul> <li><code class="language-plaintext highlighter-rouge">playmoviealpharect</code> was using the token for <code class="language-plaintext highlighter-rouge">playmoviealpha</code>, breaking both functions in the process.</li> <li><code class="language-plaintext highlighter-rouge">addbuttonflag</code> had an entry in the token table, and could be parsed, but was missing an entry in the emit list. This resulted in the compiler accepting it as a valid function, but not outputting any code for it into the compiled script.</li> <li>The function <code class="language-plaintext highlighter-rouge">tokenize</code> was missing an entry in the token table, and so would not be recognised by the compiler.</li> <li>Fixed the check for the <code class="language-plaintext highlighter-rouge">call "foo"</code> syntax so that non-string constants will no longer be accepted.</li> </ul> <h2 id="backward-compatibility"> <a href="#backward-compatibility" class="anchor-heading" aria-labelledby="backward-compatibility"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Backward compatibility </h2> <p>There are several changes in this version of sslc which may result in problems for previously working scripts. A new command line option <code class="language-plaintext highlighter-rouge">-b</code> is available, which will turn off all new fixes and features which have the possibility of causing a previously compiling script to change its behaviour. (And only those features; anything which would not compile under the old sslc is not affected.) This includes the following:</p> <ul> <li>Since <code class="language-plaintext highlighter-rouge">for</code>, <code class="language-plaintext highlighter-rouge">foreach</code>, <code class="language-plaintext highlighter-rouge">break</code>, <code class="language-plaintext highlighter-rouge">continue</code>, <code class="language-plaintext highlighter-rouge">in</code> and <code class="language-plaintext highlighter-rouge">tokenize</code> are now hardcoded names, existing scripts that use any of them as a variable or procedure name will no longer compile.</li> <li>Missing a semicolon after a variable declaration is now a hard error. (Originally sslc would check for the semicolon, but would not complain if it was missing.)</li> <li>The function <code class="language-plaintext highlighter-rouge">addbuttonflag</code> used to be recognised by the compiler, but would not emit any code into the int file.</li> <li>The function <code class="language-plaintext highlighter-rouge">playmoviealpharect</code> compiled as <code class="language-plaintext highlighter-rouge">playmoviealpha</code>.</li> </ul> <h2 id="int2ssl-note"> <a href="#int2ssl-note" class="anchor-heading" aria-labelledby="int2ssl-note"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> int2ssl note </h2> <p><strong>int2ssl</strong> by Anchorite (TeamX) is included in sfall modderspack package. It was updated to support all additional opcodes of sfall, along with some syntax features. You can use it to decompile any sfall or non-sfall script.</p> </main> </div> </div> <div class="search-overlay"></div> </div> </body> </html>
|