mirror of
https://github.com/evennia/evennia.git
synced 2026-03-31 04:57:16 +02:00
169 lines
No EOL
9 KiB
HTML
169 lines
No EOL
9 KiB
HTML
|
||
<!DOCTYPE html>
|
||
|
||
<html>
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||
|
||
<title>evennia.contrib.health_bar — Evennia 0.9.5 documentation</title>
|
||
<link rel="stylesheet" href="../_static/nature.css" type="text/css" />
|
||
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
|
||
<script src="../_static/jquery.js"></script>
|
||
<script src="../_static/underscore.js"></script>
|
||
<script src="../_static/doctools.js"></script>
|
||
<script src="../_static/language_data.js"></script>
|
||
<script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
|
||
<script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"processClass": "tex2jax_process|mathjax_process|math|output_area"}})</script>
|
||
<link rel="shortcut icon" href="../_static/favicon.ico"/>
|
||
<link rel="index" title="Index" href="../genindex.html" />
|
||
<link rel="search" title="Search" href="../search.html" />
|
||
</head><body>
|
||
<div class="related" role="navigation" aria-label="related navigation">
|
||
<h3>Navigation</h3>
|
||
<ul>
|
||
<li class="right" style="margin-right: 10px">
|
||
<a href="../genindex.html" title="General Index"
|
||
accesskey="I">index</a></li>
|
||
<li class="right" >
|
||
<a href="../py-modindex.html" title="Python Module Index"
|
||
>modules</a> |</li>
|
||
<li class="nav-item nav-item-0"><a href="../index.html">Evennia 0.9.5</a> »</li>
|
||
<li class="nav-item nav-item-this"><a href="">evennia.contrib.health_bar</a></li>
|
||
</ul>
|
||
</div>
|
||
|
||
<div class="document">
|
||
<div class="documentwrapper">
|
||
<div class="bodywrapper">
|
||
<div class="body" role="main">
|
||
|
||
<section id="module-evennia.contrib.health_bar">
|
||
<span id="evennia-contrib-health-bar"></span><h1>evennia.contrib.health_bar<a class="headerlink" href="#module-evennia.contrib.health_bar" title="Permalink to this headline">¶</a></h1>
|
||
<p>Health Bar</p>
|
||
<p>Contrib - Tim Ashley Jenkins 2017</p>
|
||
<p>The function provided in this module lets you easily display visual
|
||
bars or meters - “health bar” is merely the most obvious use for this,
|
||
though these bars are highly customizable and can be used for any sort
|
||
of appropriate data besides player health.</p>
|
||
<p>Today’s players may be more used to seeing statistics like health,
|
||
stamina, magic, and etc. displayed as bars rather than bare numerical
|
||
values, so using this module to present this data this way may make it
|
||
more accessible. Keep in mind, however, that players may also be using
|
||
a screen reader to connect to your game, which will not be able to
|
||
represent the colors of the bar in any way. By default, the values
|
||
represented are rendered as text inside the bar which can be read by
|
||
screen readers.</p>
|
||
<p>The health bar will account for current values above the maximum or
|
||
below 0, rendering them as a completely full or empty bar with the
|
||
values displayed within.</p>
|
||
<dl class="py function">
|
||
<dt id="evennia.contrib.health_bar.display_meter">
|
||
<code class="sig-prename descclassname">evennia.contrib.health_bar.</code><code class="sig-name descname">display_meter</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">cur_value</span></em>, <em class="sig-param"><span class="n">max_value</span></em>, <em class="sig-param"><span class="n">length</span><span class="o">=</span><span class="default_value">30</span></em>, <em class="sig-param"><span class="n">fill_color</span><span class="o">=</span><span class="default_value">['R', 'Y', 'G']</span></em>, <em class="sig-param"><span class="n">empty_color</span><span class="o">=</span><span class="default_value">'B'</span></em>, <em class="sig-param"><span class="n">text_color</span><span class="o">=</span><span class="default_value">'w'</span></em>, <em class="sig-param"><span class="n">align</span><span class="o">=</span><span class="default_value">'left'</span></em>, <em class="sig-param"><span class="n">pre_text</span><span class="o">=</span><span class="default_value">''</span></em>, <em class="sig-param"><span class="n">post_text</span><span class="o">=</span><span class="default_value">''</span></em>, <em class="sig-param"><span class="n">show_values</span><span class="o">=</span><span class="default_value">True</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/health_bar.html#display_meter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.health_bar.display_meter" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Represents a current and maximum value given as a “bar” rendered with
|
||
ANSI or xterm256 background colors.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>cur_value</strong> (<em>int</em>) – Current value to display</p></li>
|
||
<li><p><strong>max_value</strong> (<em>int</em>) – Maximum value to display</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
<dl>
|
||
<dt>Options:</dt><dd><p>length (int): Length of meter returned, in characters
|
||
fill_color (list): List of color codes for the full portion</p>
|
||
<blockquote>
|
||
<div><p>of the bar, sans any sort of prefix - both ANSI and xterm256
|
||
colors are usable. When the bar is empty, colors toward the
|
||
start of the list will be chosen - when the bar is full, colors
|
||
towards the end are picked. You can adjust the ‘weights’ of
|
||
the changing colors by adding multiple entries of the same
|
||
color - for example, if you only want the bar to change when
|
||
it’s close to empty, you could supply [‘R’,’Y’,’G’,’G’,’G’]</p>
|
||
</div></blockquote>
|
||
<p>empty_color (str): Color code for the empty portion of the bar.
|
||
text_color (str): Color code for text inside the bar.
|
||
align (str): “left”, “right”, or “center” - alignment of text in the bar
|
||
pre_text (str): Text to put before the numbers in the bar
|
||
post_text (str): Text to put after the numbers in the bar
|
||
show_values (bool): If true, shows the numerical values represented by</p>
|
||
<blockquote>
|
||
<div><p>the bar. It’s highly recommended you keep this on, especially if
|
||
there’s no info given in pre_text or post_text, as players on screen
|
||
readers will be unable to read the graphical aspect of the bar.</p>
|
||
</div></blockquote>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</section>
|
||
|
||
|
||
<div class="clearer"></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
||
<div class="sphinxsidebarwrapper">
|
||
<p class="logo"><a href="../index.html">
|
||
<img class="logo" src="../_static/evennia_logo.png" alt="Logo"/>
|
||
</a></p>
|
||
<div id="searchbox" style="display: none" role="search">
|
||
<h3 id="searchlabel">Quick search</h3>
|
||
<div class="searchformwrapper">
|
||
<form class="search" action="../search.html" method="get">
|
||
<input type="text" name="q" aria-labelledby="searchlabel" />
|
||
<input type="submit" value="Go" />
|
||
</form>
|
||
</div>
|
||
</div>
|
||
<script>$('#searchbox').show(0);</script>
|
||
<div role="note" aria-label="source link">
|
||
<!--h3>This Page</h3-->
|
||
<ul class="this-page-menu">
|
||
<li><a href="../_sources/api/evennia.contrib.health_bar.md.txt"
|
||
rel="nofollow">Show Page Source</a></li>
|
||
</ul>
|
||
</div><h3>Links</h3>
|
||
<ul>
|
||
<li><a href="https://www.evennia.com">Home page</a> </li>
|
||
<li><a href="https://github.com/evennia/evennia">Evennia Github</a> </li>
|
||
<li><a href="http://games.evennia.com">Game Index</a> </li>
|
||
<li><a href="http://webchat.freenode.net/?channels=evennia&uio=MT1mYWxzZSY5PXRydWUmMTE9MTk1JjEyPXRydWUbb">IRC</a> -
|
||
<a href="https://discord.gg/NecFePw">Discord</a> -
|
||
<a href="https://groups.google.com/forum/#%21forum/evennia">Forums</a>
|
||
</li>
|
||
<li><a href="http://evennia.blogspot.com/">Evennia Dev blog</a> </li>
|
||
</ul>
|
||
<h3>Versions</h3>
|
||
<ul>
|
||
<li><a href="../../1.0-dev/index.html">1.0-dev (develop branch)</a></li>
|
||
<li><a href="evennia.contrib.health_bar.html">0.9.5 (v0.9.5 branch)</a></li>
|
||
</ul>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="clearer"></div>
|
||
</div>
|
||
<div class="related" role="navigation" aria-label="related navigation">
|
||
<h3>Navigation</h3>
|
||
<ul>
|
||
<li class="right" style="margin-right: 10px">
|
||
<a href="../genindex.html" title="General Index"
|
||
>index</a></li>
|
||
<li class="right" >
|
||
<a href="../py-modindex.html" title="Python Module Index"
|
||
>modules</a> |</li>
|
||
<li class="nav-item nav-item-0"><a href="../index.html">Evennia 0.9.5</a> »</li>
|
||
<li class="nav-item nav-item-this"><a href="">evennia.contrib.health_bar</a></li>
|
||
</ul>
|
||
</div>
|
||
<div class="footer" role="contentinfo">
|
||
© Copyright 2020, The Evennia developer community.
|
||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.2.1.
|
||
</div>
|
||
</body>
|
||
</html> |