This file is indexed.

/usr/share/doc/kildclient/html/ch07s02.xhtml is in kildclient-doc 3.2.0-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head><title>7.2. Echoing and Sending Text</title><link rel="stylesheet" type="text/css" href="docbook.css"/><link rel="stylesheet" type="text/css" href="kildclient.css"/><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"/><link rel="prev" href="sec_perl_basics.xhtml" title="7.1. The Basics"/><link rel="next" href="sec_sounds.xhtml" title="7.3. Playing Sounds"/></head><body><header><div class="navheader"><table style="width: 100%; "><tr><th style="text-align: center; " colspan="3">7.2. Echoing and Sending Text</th></tr><tr><td style="width: 20%; text-align: left; "><a accesskey="p" href="sec_perl_basics.xhtml">Prev</a> </td><th style="width: 60%; text-align: center; ">Chapter 7. Using Perl in KildClient</th><td style="width: 20%; text-align: right; "> <a accesskey="n" href="sec_sounds.xhtml">Next</a></td></tr></table><hr/></div></header><section class="sect1" id="idm852"><div class="titlepage"><div><div><h2 class="title" style="clear: both">7.2. Echoing and Sending Text</h2></div></div></div><p>As mentioned in the previous section, the
<code class="function">$world-&gt;echo</code> function is used to print (or
<span class="emphasis"><em>echo</em></span>) text to the MUD window, without sending it
to the World. It works like the <code class="function">print</code> built-in
function: it accepts any number of arguments, and echoes all of them,
sequentially.</p><p>For example, <strong class="userinput"><code>$world-&gt;echo("Variable var contains ",
$var, ".\n")</code></strong> would print the first string, followed by the
contents of <code class="varname">$var</code>, followed by a period and a new
line. Of course, you could do all that in a single string using
variable interpolation.</p><p>A variant of <code class="function">$world-&gt;echo</code> is
<code class="function">$world-&gt;echonl</code>. The difference is that
<code class="function">$world-&gt;echonl</code> always prints automatically a
newline after each argument. This is just a shorthand to make some
things simpler and possibly more readable.</p><p>Similar to <code class="function">$world-&gt;echo</code> is the
<code class="function">$world-&gt;send</code> function. This function sends
something to the MUD. For example,
<strong class="userinput"><code>$world-&gt;send("who")</code></strong> will have the same effect
as if you had typed <strong class="userinput"><code>who</code></strong> in the command entry
box and pressed <span class="keysym">ENTER</span>. Note that you do not have to
add a newline to the end of the line to send, because
<code class="function">send</code> automatically sends a newline after each
argument (since commands must be terminated by a newline for the MUD
to recognize them).</p><p>It is possible to pass several arguments to
<code class="function">send</code>. If you do so, each argument will be sent as
a separate command. For example, <strong class="userinput"><code>$world-&gt;send("who",
"look")</code></strong> will first send a <code class="literal">who</code> to the
MUD, and then a <code class="literal">look</code>, just as if you had typed each
of these commands in order.</p><p>All the examples given above did nothing that could not be done
without Perl, and using <code class="function">send</code> for that was
actually less efficient that typing the commands directly. However,
when combined with variables and/or control flow structures,
<code class="function">send</code> can actually be quite useful.</p><section class="sect2" id="sec_paths"><div class="titlepage"><div><div><h3 class="title">7.2.1. Paths and Speed-Walking</h3></div></div></div><p>A useful feature of some MUD clients, which KildClient
implements, is the support for <span class="emphasis"><em>speed-walking</em></span>.
This feature allows you to define paths to go directly from one place
to another without having to type a lot of movement commands.</p><p>For example, suppose that to go to some place from a fixed point
(such as the center of a town) you need to take the following
directions: <code class="literal">s s s e e s e e e e n nw n</code>. This is
often written in a more compact way as <code class="literal">3s 2e s 4e n nw
n</code>. KildClient allows you to send to the MUD all the 13
required commands in a single command. To do that, use the
<code class="function">$world-&gt;path</code> function. For example, if you enter
<strong class="userinput"><code>/$world-&gt;path("3s2es4en{nw}n")</code></strong> in the command
line, 13 commands will be sent to the MUD: exactly the 13 that form
the path defined above.</p><p>Note the syntax: the movement commands are defined one after
another, optionally prefixed by a number, which determines how many
times that command will be sent. So <code class="literal">3s</code> means send
<code class="literal">s</code> three times. If there is no number, the command
is sent only once.</p><p>Note also that the command to move to the north-west is enclosed
in braces: <code class="literal">{nw}</code>. This is because if the
<code class="function">$world-&gt;path</code> function sees <code class="literal">nw</code>,
it will think you want to move to the north than to the west.
Enclosing it in braces causes <code class="function">$world-&gt;path</code> to see
that as a single command. Should you need to move several times to the
northwest, you can add a number before: <code class="literal">4{nw}</code> will
send <code class="literal">nw</code> four times.</p><p>Naturally, you can include any command that is not a single
letter in braces to force <code class="function">$world-&gt;path</code> to see it
as a command. It is likely that some paths will need something like
<code class="literal">{open door}</code> in the middle.</p><p>Of course, simply entering paths in the command line is not that
useful. But you can store the path in a variable, and then just call
<strong class="userinput"><code>$world-&gt;path($stored_path)</code></strong>. Just add a line
that defines the variable to you script file (see <a class="xref" href="sec_perl_basics.xhtml" title="7.1. The Basics">Section 7.1, “The Basics”</a>), and you will be able to use the
variabled anywhere.</p><p>Alternatively, you can define an alias (see <a class="xref" href="chap_aliases.xhtml" title="Chapter 9. Aliases">Chapter 9, <em>Aliases</em></a>) or a macro (see <a class="xref" href="chap_macros.xhtml" title="Chapter 10. Macros">Chapter 10, <em>Macros</em></a>) to execute your path even faster. The
<code class="literal">easypath</code> plugin does that, see section <a class="xref" href="ch13s03.xhtml#sec_plugin_easypath" title="13.3.1. easypath">Section 13.3.1, “easypath”</a>.</p></section></section><footer><div class="navfooter"><hr/><table style="width: 100%; "><tr><td style="width: 40%; text-align: left; "><a accesskey="p" href="sec_perl_basics.xhtml">Prev</a> </td><td style="width: 20%; text-align: center; "><a accesskey="u" href="chap_perl.xhtml">Up</a></td><td style="width: 40%; text-align: right; "> <a accesskey="n" href="sec_sounds.xhtml">Next</a></td></tr><tr><td style="width: 40%; text-align: left; vertical-align: top; ">7.1. The Basics </td><td style="width: 20%; text-align: center; "><a accesskey="h" href="index.xhtml">Home</a></td><td style="width: 40%; text-align: right; vertical-align: top; "> 7.3. Playing Sounds</td></tr></table></div></footer></body></html>