Difference between revisions of "Manual:DIL Manual/pagestring()"
Jump to navigation
Jump to search
(XML import) |
(checked against the compiler and the interpreter; example compiles) |
||
| Line 1: | Line 1: | ||
| − | + | = pagestring() = | |
| − | + | '''Procedure.''' Sends a long text to a player, to be shown a page at a time. | |
| − | + | ||
| − | + | pagestring(s : string, u : unitptr) | |
| − | + | ||
| − | + | Sends <code>s</code> to the player <code>u</code> marked as paged text (wrapped in | |
| − | + | <code><paged></code>), so that the player's client can show it a screenful at a time | |
| − | + | instead of letting it scroll past. Use it for lists and other long output; for short text use | |
| − | + | [[Manual:DIL Manual/sendtext()|sendtext()]]. | |
| − | < | + | |
| − | + | == Parameters == | |
| − | + | {| class="wikitable" | |
| − | + | ! Name !! Type !! Meaning | |
| − | + | |- | |
| − | + | | s || string || The text, with <code><br/></code> between lines. | |
| − | + | |- | |
| − | + | | u || unitptr || The player. | |
| − | + | |} | |
| + | |||
| + | == Notes == | ||
| + | * Only characters: on an object or a room the zone log gets "Type error in not a pc/npc unit" and the program stops. With a null unit nothing is sent, apart from a line in the zone log ("pagestring with no unit"). | ||
| + | * An NPC, or a player who isn't connected, gets nothing (unless a player is switched into the NPC). | ||
| + | * A god snooping the player sees the text too. | ||
| + | * An empty string sends nothing. | ||
| + | |||
| + | == Example == | ||
| + | <pre> | ||
| + | dilbegin list_players(); | ||
| + | var | ||
| + | pc : unitptr; | ||
| + | s : string; | ||
| + | code | ||
| + | { | ||
| + | s := "<u>Players in the game</u><br/>"; | ||
| + | pc := pc_head(); | ||
| + | while (pc != null) | ||
| + | { | ||
| + | if (pc.type != UNIT_ST_PC) | ||
| + | break; | ||
| + | s := s + pc.name + "<br/>"; | ||
| + | pc := pc.gnext; | ||
| + | } | ||
| + | pagestring(s, self); | ||
| + | quit; | ||
| + | } | ||
| + | dilend | ||
| + | </pre> | ||
| + | Lists the players in the game, a page at a time. | ||
| + | |||
| + | == See also == | ||
| + | * [[Manual:DIL Manual/sendtext()|sendtext()]] | ||
| + | * [[Manual:DIL Manual/act()|act()]] | ||
| + | * [[Manual:DIL Manual/textformat()|textformat()]] | ||
| + | * [[Manual:DIL Manual/pc head()|pc_head()]] | ||
Latest revision as of 23:22, 14 November 2026
pagestring()
Procedure. Sends a long text to a player, to be shown a page at a time.
pagestring(s : string, u : unitptr)
Sends s to the player u marked as paged text (wrapped in
<paged>), so that the player's client can show it a screenful at a time
instead of letting it scroll past. Use it for lists and other long output; for short text use
sendtext().
Parameters
| Name | Type | Meaning |
|---|---|---|
| s | string | The text, with <br/> between lines.
|
| u | unitptr | The player. |
Notes
- Only characters: on an object or a room the zone log gets "Type error in not a pc/npc unit" and the program stops. With a null unit nothing is sent, apart from a line in the zone log ("pagestring with no unit").
- An NPC, or a player who isn't connected, gets nothing (unless a player is switched into the NPC).
- A god snooping the player sees the text too.
- An empty string sends nothing.
Example
dilbegin list_players();
var
pc : unitptr;
s : string;
code
{
s := "<u>Players in the game</u><br/>";
pc := pc_head();
while (pc != null)
{
if (pc.type != UNIT_ST_PC)
break;
s := s + pc.name + "<br/>";
pc := pc.gnext;
}
pagestring(s, self);
quit;
}
dilend
Lists the players in the game, a page at a time.