Difference between revisions of "Manual:DIL Manual/getcolor()"
Jump to navigation
Jump to search
(XML import) |
(checked against the compiler and the interpreter; example compiles) |
||
| Line 1: | Line 1: | ||
| − | + | = getcolor() = | |
| + | '''Function''' (string). Returns the HTML tag that starts text in a named colour. | ||
| − | + | getcolor(key : string) | |
| − | + | Returns <code><div class='key'></code>, nothing more: it is a short way to write the tag. | |
| − | + | Text inside it is shown in the reader's colour for <code>key</code>. For a telnet player that | |
| − | + | is the colour they chose with the <code>color</code> command, or one a DIL gave them with | |
| − | + | [[Manual:DIL Manual/addcolor()|addcolor()]], and otherwise the game's default from | |
| − | + | <code>vme/etc/color.def</code> (<code>default</code>, <code>say_self</code>, <code>clan</code>, | |
| − | + | ...). The web client gets the class as it is and colours it with its own style sheet. | |
| − | + | == Parameters == | |
| − | + | {| class="wikitable" | |
| − | < | + | ! Name !! Type !! Meaning |
| + | |- | ||
| + | | key || string || The colour's name, the class of the <code>div</code>. | ||
| + | |} | ||
| − | + | == Returns == | |
| + | String: <code><div class='key'></code>. A string variable that was never set gives | ||
| + | <code><div class=''></code>. | ||
| − | + | == Notes == | |
| − | + | * It does not read a player's colours, and it takes no unit: the old manual's | |
| − | + | <code>getcolor(ch, key)</code> doesn't compile. | |
| − | + | * Close the colour with <code></div></code>. | |
| − | |||
| − | |||
| − | + | == Example == | |
| − | + | <pre> | |
| + | dilbegin clan_tell(pc : unitptr, msg : string); | ||
| + | code | ||
| + | { | ||
| + | sendtext(getcolor("clan") + msg + "</div><br/>", pc); | ||
| + | quit; | ||
| + | } | ||
| + | dilend | ||
| + | </pre> | ||
| + | Sends a line in the reader's clan colour, the same as writing | ||
| + | <code><div class='clan'></code> as clans.zon does. | ||
| + | |||
| + | == See also == | ||
| + | * [[Manual:DIL Manual/addcolor()|addcolor()]] | ||
| + | * [[Manual:DIL Manual/changecolor()|changecolor()]] | ||
| + | * [[Manual:DIL Manual/delcolor()|delcolor()]] | ||
| + | * [[Manual:DIL Manual/sendtext()|sendtext()]] | ||
| + | * [[Manual:DIL Manual/act()|act()]] | ||
Latest revision as of 23:03, 14 November 2026
getcolor()
Function (string). Returns the HTML tag that starts text in a named colour.
getcolor(key : string)
Returns <div class='key'>, nothing more: it is a short way to write the tag.
Text inside it is shown in the reader's colour for key. For a telnet player that
is the colour they chose with the color command, or one a DIL gave them with
addcolor(), and otherwise the game's default from
vme/etc/color.def (default, say_self, clan,
...). The web client gets the class as it is and colours it with its own style sheet.
Parameters
| Name | Type | Meaning |
|---|---|---|
| key | string | The colour's name, the class of the div.
|
Returns
String: <div class='key'>. A string variable that was never set gives
<div class=>.
Notes
- It does not read a player's colours, and it takes no unit: the old manual's
getcolor(ch, key) doesn't compile.
- Close the colour with
</div>.
Example
dilbegin clan_tell(pc : unitptr, msg : string);
code
{
sendtext(getcolor("clan") + msg + "</div><br/>", pc);
quit;
}
dilend
Sends a line in the reader's clan colour, the same as writing
<div class='clan'> as clans.zon does.