This file is indexed.

/usr/share/doc/sludge/SLUDGEDevKitHelp/cancelSub.html is in sludge-doc 2.1.2-3build1.

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
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<TITLE>cancelSub</TITLE>
  <link rel="stylesheet" type="text/css" href="style.css" />
</head>
<BODY>
<HR>
<div align="center"><img id="headerGraphic" src="images/sludge300.png" alt="SLUDGE"/></div>
<h2>cancelSub</h2>
<HR>

<H3>Syntax:</H3>

<P>
<pre class="syntax">cancelSub (<i>thisFunction</i>);</pre>
</P>

<H3>Purpose:</H3>

<P>
Cancels any instances of <i>thisFunction</i> which are running.
</P>

<P>
This command will only cancel a function which has been paused by either the <a href="pause.html">pause</a> or one of the <a href="say_and_think.html">say and think</a> commands, and will not cancel a function which is temporarily inactive because of a call to another user-defined function. For example:
</P>

<P>
<pre>sub outer () {
   loop {
      say (a, &quot;Outer.&quot;);
      inner ();
   }
}

sub inner () {
   say (a, &quot;Inner.&quot;);
}

sub clicky () {
   cancelSub (outer);
}

sub init () {
   spawnSub (outer);
   onLeftMouse (clicky);
}</pre>
</P>

<P>
In the above example, pressing the left mouse button will only cancel the loop if the character a is saying &quot;Outer&quot; and not &quot;Inner&quot;; i.e. while the outer function is active.
</P>

<P>
The cancelSub command will also not cancel a function which is suspended because of a character which is currently moving (because of a call to either the <a href="moveCharacter.html">moveCharacter</a> or <a href="forceCharacter.html">forceCharacter</a> function). In these situations you can use <a href="stopCharacter.html">stopCharacter</a> to stop the character in its tracks, automatically cancelling the suspended function. Several other commands will also stop the movement of the character, thereby cancelling the function which was suspended because the character was moving.
</P>

<H3>Return value:</H3>

<P>
This function returns the number of instances of <i>thisFunction</i> which were cancelled.
</P>

<H3>Example:</H3>

<P>
<pre>sub speechFunction () {
   loop {
      say (someCharacter, &quot;And so I said to her...&quot;);
      say (someCharacter, &quot;Blah blah blah blah blah...&quot;);
      say (someCharacter, &quot;Pom-pa-pom-pa-pom...&quot;);
      say (someCharacter, &quot;And then she said...&quot;);
      say (someCharacter, &quot;Rhubarb rhubarb rhubarb...&quot;);
      say (someCharacter, &quot;Yada yada yada...&quot;);
   }
}

sub clicky () {
   cancelSub (speechFunction);
   say (ego, &quot;Oh, do shut up.&quot;);
   say (someCharacter, &quot;Pardon me for breathing.&quot;);
}

sub init () {
   spawnSub (speechFunction);
   onLeftMouse (clicky);
}</pre>
</P>

<P>
<H3>See also:</H3>

</P>

<P>
<a href="spawnSub.html">spawnSub</a>
</P>

<P class="copyright-notice">SLUDGE and this SLUDGE documentation are <A HREF="Copyright.html">copyright</A> Hungry Software and contributors 2000-2011
</P>

<HR>
</BODY>
</html>