Games-Axmud

 view release on metacpan or  search on metacpan

share/docs/tutorial/ch14.html  view on Meta::CPAN

</code></pre>
<p>Once again, the X and U characters can be typed in lower case if you prefer.</p>
<h2><a name="14.6">14.6 Style tags</a></h2>
<p>Style tags are used to change the way text is displayed, without changing its colour. For example, we can display some text in italics.</p>
<pre><code>    WRITEWIN "Hello world!", "italics"
</code></pre>
<p>We can also display text with an underline (underscore) or a strike-through effect.</p>
<pre><code>    WRITEWIN "Hello", "underline"
    WRITEWIN "world!", "strike"
</code></pre>
<p>Colour and style tags can be combined in a single WRITEWIN statement. However, the effect only applies to the specified text. The next WRITEWIN statement will use the default colour and style.</p>
<pre><code>    ! Display red text on a white underlay, using italics
    WRITEWIN "Hello world!", "#FF0000", "U#FFFFFF", "italics"
</code></pre>
<p>Blinking text is popular at some older MUDs. There are two blinking speeds - fast and slow.</p>
<pre><code>    WRITEWIN "Hello", "blink_fast"
    WRITEWIN "world!", "blink_slow"
</code></pre>
<h2><a name="14.7">14.7 Formatting lines</a></h2>
<p>Each WRITEWIN writes text on a new line, by default. You can change this behaviour, temporarily, by adding an <strong>"echo"</strong> tag. The tag adds text to the beginning of the previous line, rather than starting a new one.</p>
<pre><code>    WRITEWIN "Hello "
    WRITEWIN "world!", "echo"
</code></pre>
<p>It's possible (though rather unlikely) that the window's default behaviour might be something different, in which case you can force a newline by adding the <strong>"nl"</strong> tag.</p>
<pre><code>    WRITEWIN "Hello "
    WRITEWIN "world!", "nl"
</code></pre>
<h2><a name="14.8">14.8 Emptying the window</a></h2>
<p>There are two ways to empty the window. The first is to use the EMPTYWIN statement.</p>
<pre><code>    WRITEWIN "Hello"
    PAUSE 3
    EMPTYWIN
    WRITEWIN "world!"
</code></pre>
<p>Many dialects of BASIC use a CLS statement to do the same thing. You can use either EMPTYWIN or CLS; their behaviour is identical.</p>
<p>The second, and perhaps more conveient, way is to add an <strong>"empty"</strong> tag. The tag empties the window before displaying the text.</p>
<pre><code>    WRITEWIN "Hello world!", "empty"
</code></pre>
<h2><a name="14.9">14.9 Changing the background colour</a></h2>
<p>Some tasks (such as the Status task and the Divert task) change the window's background colour to communicate something to the user. These windows only use two colours - a single background colour and a single text colour. When you change the back...
<p>If this is the way you want your window to behave, you can use a PAINTWIN statement.</p>
<pre><code>    PAINTWIN "red"
</code></pre>
<p>You can use bold colour tags like <strong>"RED"</strong>, but in this case you can't use RGB or xterm colour tags.</p>
<p>If you don't specify a colour at all, the window reverts back to the default background colour.</p>
<pre><code>    PAINTWIN
</code></pre>
<h2><a name="14.10">14.10 Flashing windows</a></h2>
<p>Another way to grab the user's attention is to set the window's so-called <em>urgency hint</em>. The way this is implemented varies from system to system, but often it causes something to flash in the taskbar at the bottom of the screen.</p>
<pre><code>    FLASHWIN
</code></pre>
<p>The flashing usually stops after a few seconds, but you can use an UNFLASHWIN statement at any time.</p>
<h2><a name="14.11">14.11 Changing the window's title</a></h2>
<p>You can change the window's title using a TITLEWIN statement.</p>
<pre><code>    TITLEWIN "I'm in control now!"
</code></pre>
<p>To restore the window's original title - which will be something like <strong>Script (test)</strong> - just use an empty string.</p>
<pre><code>    TITLEWIN ""
</code></pre>
<h2><a name="14.12">14.12 Dialogue windows</a></h2>
<p>Besides task windows, Axbasic scripts can create their own dialogue (popup) windows using the <strong>Popup$ ()</strong> function. The window asks the user to make a choice, and the function returns that choice.</p>
<pre><code>    ! Ask a question
    LET choice$ = POPUP$ ("question", "Are you ready?", "yes-no")
    ! Display "yes" or "no"
    PRINT choice$
    END
</code></pre>
<p>The <strong>Popup$</strong> always takes three arguments. For a full list of the arguments that can be used, see the function's help file.</p>
<pre><code>    ;axbasichelp popup
</code></pre>
<hr>
<p><a href="ch13.html">Previous</a> <a href="index.html">Index</a> <a href="ch15.html">Next</a></p>

</body>
</html>



( run in 0.759 second using v1.01-cache-2.11-cpan-364913b4093 )