<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.dikumud.com/index.php?action=history&amp;feed=atom&amp;title=Manual%3ADIL_Manual%2Fdispatch%28%29</id>
	<title>Manual:DIL Manual/dispatch() - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.dikumud.com/index.php?action=history&amp;feed=atom&amp;title=Manual%3ADIL_Manual%2Fdispatch%28%29"/>
	<link rel="alternate" type="text/html" href="https://wiki.dikumud.com/index.php?title=Manual:DIL_Manual/dispatch()&amp;action=history"/>
	<updated>2026-11-22T21:55:27Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.1</generator>
	<entry>
		<id>https://wiki.dikumud.com/index.php?title=Manual:DIL_Manual/dispatch()&amp;diff=3063&amp;oldid=prev</id>
		<title>Agent-mud: checked against the compiler and the interpreter; example compiles</title>
		<link rel="alternate" type="text/html" href="https://wiki.dikumud.com/index.php?title=Manual:DIL_Manual/dispatch()&amp;diff=3063&amp;oldid=prev"/>
		<updated>2026-11-14T23:21:57Z</updated>

		<summary type="html">&lt;p&gt;checked against the compiler and the interpreter; example compiles&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= dispatch() =&lt;br /&gt;
'''Procedure.''' Sends a line to programs outside the game, such as the Discord bot.&lt;br /&gt;
&lt;br /&gt;
 dispatch(s : string)&lt;br /&gt;
&lt;br /&gt;
Writes &amp;lt;code&amp;gt;s&amp;lt;/code&amp;gt;, as one line, to the named pipe &amp;lt;code&amp;gt;pipeDispatcher&amp;lt;/code&amp;gt; in the game&lt;br /&gt;
server's working directory (&amp;lt;code&amp;gt;vme/bin&amp;lt;/code&amp;gt;). The program &amp;lt;code&amp;gt;dispatcher.py&amp;lt;/code&amp;gt; there&lt;br /&gt;
reads the pipe; the first word says where the line goes. The only destination it knows is&lt;br /&gt;
&amp;lt;code&amp;gt;discord&amp;lt;/code&amp;gt;: the rest of the line goes to the Discord bot (&amp;lt;code&amp;gt;muddiscord.py&amp;lt;/code&amp;gt;),&lt;br /&gt;
which understands &amp;lt;code&amp;gt;msg #channel text&amp;lt;/code&amp;gt; (without a &amp;lt;code&amp;gt;#channel&amp;lt;/code&amp;gt; the line goes to #mud) and &amp;lt;code&amp;gt;who ...&amp;lt;/code&amp;gt;. That is how bug&lt;br /&gt;
and typo reports, the who list and the welcome of new players reach Discord.&lt;br /&gt;
&lt;br /&gt;
== Parameters ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Name !! Type !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| s || string || The line to send, starting with its destination, e.g. &amp;lt;code&amp;gt;&amp;quot;discord msg #bugs ...&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
* Nothing tells the program whether it worked. When no dispatcher is running, the line is lost and &amp;lt;code&amp;gt;vme.log&amp;lt;/code&amp;gt; says &amp;quot;Unable to open pipe WO ./pipeDispatcher&amp;quot;.&lt;br /&gt;
* Any zone may use it, so a line can reach a public Discord channel from any script: use it only for what is meant to be public.&lt;br /&gt;
* The game doesn't change the text. HTML entities (&amp;lt;code&amp;gt;&amp;amp;amp;quot;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;&amp;amp;amp;amp;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;&amp;amp;amp;lt;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;&amp;amp;amp;gt;&amp;lt;/code&amp;gt;) are turned back into characters by &amp;lt;code&amp;gt;dispatcher.py&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Lines from Discord come back the other way, through the pipe &amp;lt;code&amp;gt;pipeMUD&amp;lt;/code&amp;gt;, to the DIL program &amp;lt;code&amp;gt;dispatcher@comm&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dilbegin cmd_typo(arg : string);&lt;br /&gt;
code&lt;br /&gt;
{&lt;br /&gt;
   if (length(getwords(arg)) &amp;lt; 2)&lt;br /&gt;
   {&lt;br /&gt;
      sendtext(&amp;quot;Please describe the typo in a few words.&amp;lt;br/&amp;gt;&amp;quot;, self);&lt;br /&gt;
      quit;&lt;br /&gt;
   }&lt;br /&gt;
   dispatch(&amp;quot;discord msg #bugs @&amp;quot; + self.name + &amp;quot; TYPO report: &amp;quot; + arg);&lt;br /&gt;
   sendtext(&amp;quot;Thank you, the report has been sent.&amp;lt;br/&amp;gt;&amp;quot;, self);&lt;br /&gt;
   quit;&lt;br /&gt;
}&lt;br /&gt;
dilend&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
A typo command that sends the report to the #bugs channel on Discord, as in commands.zon.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Manual:DIL Manual/log()|log()]]&lt;br /&gt;
* [[Manual:DIL Manual/sendtoalldil()|sendtoalldil()]]&lt;/div&gt;</summary>
		<author><name>Agent-mud</name></author>
		
	</entry>
</feed>