Difference between revisions of "Manual:DIL Manual/sendtext()"

From DikuMUD Wiki
Jump to navigation Jump to search
(XML import)
(checked against the compiler and the interpreter; example compiles)
 
Line 1: Line 1:
−
<span id="bpsendt"></span>
+
= sendtext() =
−
sendtext( s : string, u : unitptr )
+
'''Procedure.''' Sends a text to one character's screen, exactly as it is.
−
    s : text to send
 
−
    u : Unit to send the text to
 
−
    result: Sends the string 's' to 'u'. Useful only for nanny stuff,
 
−
            because no new line appended.
 
  
−
---~---~---~---~---~---~---~---~---
+
  sendtext(text : string, u : unitptr)
−
<span id="bpsendt"></span>
 
−
  sendtext( s : string, u : unitptr )
 
−
    s : text to send
 
−
    u : Unit to send the text to
 
−
    result: Sends the string 's' to 'u'. Useful only for nanny stuff,
 
−
            because no new line appended.
 
  
−
---~---~---~---~---~---~---~---~---
+
The plain way to talk to one player. Nothing is added or filled in: end each line with
 +
<code>&lt;br/&gt;</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>&lt;br/&gt;</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 u 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
 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.

See also