Difference between revisions of "Manual:DIL Manual/sendtext()"
Jump to navigation
Jump to search
(XML import) |
(checked against the compiler and the interpreter; example compiles) |
||
| (One intermediate revision by one other user not shown) | |||
| Line 1: | Line 1: | ||
| + | = sendtext() = | ||
| + | '''Procedure.''' Sends a text to one character's screen, exactly as it is. | ||
| + | sendtext(text : string, u : unitptr) | ||
| − | < | + | The plain way to talk to one player. Nothing is added or filled in: end each line with |
| − | + | <code><br/></code> yourself, and put names in with <code>+</code>. Text in the game is | |
| − | + | HTML; the web client shows it as such, and a telnet player gets it turned into plain text with | |
| − | + | their colours. | |
| − | |||
| − | |||
| − | + | == Parameters == | |
| + | {| class="wikitable" | ||
| + | ! Name !! Type !! Meaning | ||
| + | |- | ||
| + | | text || string || The text, with <code><br/></code> where lines end. | ||
| + | |- | ||
| + | | u || unitptr || The character to send it to. | ||
| + | |} | ||
| + | |||
| + | == Notes == | ||
| + | * It reaches whoever is connected to <code>u</code>: a player, or the god switched into an | ||
| + | NPC. To an NPC with nobody in it, an object, a room or null it sends nothing, and an empty | ||
| + | text sends nothing. | ||
| + | * Unlike [[Manual:DIL Manual/act()|act()]] it ignores whether <code>u</code> is asleep or can | ||
| + | see anything; use act() for what happens in the room, so that each one sees names as they | ||
| + | should. | ||
| + | * For long text that should be shown a page at a time, use | ||
| + | [[Manual:DIL Manual/pagestring()|pagestring()]]. | ||
| + | |||
| + | == Example == | ||
| + | <pre> | ||
| + | dilbegin who_follows(pc : unitptr); | ||
| + | var | ||
| + | mast : unitptr; | ||
| + | code | ||
| + | { | ||
| + | mast := pc.master; | ||
| + | if (mast == null) | ||
| + | sendtext("You are not following anyone.<br/>", pc); | ||
| + | else | ||
| + | sendtext("You are following " + mast.name + ".<br/>", pc); | ||
| + | quit; | ||
| + | } | ||
| + | dilend | ||
| + | </pre> | ||
| + | Tells a player whom they follow, as the <code>follow</code> command in commands.zon does. | ||
| + | |||
| + | == See also == | ||
| + | * [[Manual:DIL Manual/act()|act()]] | ||
| + | * [[Manual:DIL Manual/pagestring()|pagestring()]] | ||
| + | * [[Manual:DIL Manual/send()|send()]] | ||
| + | * [[Manual:DIL Manual/sendtoall()|sendtoall()]] | ||
| + | * [[Manual:DIL Manual/textformat()|textformat()]] | ||
Latest revision as of 23:21, 14 November 2026
sendtext()
Procedure. Sends a text to one character's screen, exactly as it is.
sendtext(text : string, u : unitptr)
The plain way to talk to one player. Nothing is added or filled in: end each line with
<br/> yourself, and put names in with +. Text in the game is
HTML; the web client shows it as such, and a telnet player gets it turned into plain text with
their colours.
Parameters
| Name | Type | Meaning |
|---|---|---|
| text | string | The text, with <br/> where lines end.
|
| u | unitptr | The character to send it to. |
Notes
- It reaches whoever is connected to
u: a player, or the god switched into an
NPC. To an NPC with nobody in it, an object, a room or null it sends nothing, and an empty text sends nothing.
- Unlike act() it ignores whether
uis asleep or can
see anything; use act() for what happens in the room, so that each one sees names as they should.
- For long text that should be shown a page at a time, use
pagestring().
Example
dilbegin who_follows(pc : unitptr);
var
mast : unitptr;
code
{
mast := pc.master;
if (mast == null)
sendtext("You are not following anyone.<br/>", pc);
else
sendtext("You are following " + mast.name + ".<br/>", pc);
quit;
}
dilend
Tells a player whom they follow, as the follow command in commands.zon does.