Skip to content

mogrifier

A channel’s mogrifier is an object whose MOGRIFY`* attributes rewrite each line said on the channel. @channel/mogrifier <channel>=<object> sets it, to an object you control. A speaker who fails the object’s @lock/use is not mogrified. Every attribute is optional, and one that is absent or evaluates to nothing leaves its part of the line as it was. They run on the mogrifier, with the speaker as %#.

Each attribute gets its values by position and by the name shown (see named arguments), so %<message> reads the message whatever position it has in that attribute.

These three decide what happens to the line. Each gets %0 or %<type> (the line’s type, as in @chatformat), %1 or %<channel> (the channel’s name), %2 or %<message>, %3 or %<name> (the speaker’s name) and %4 or %<title>:

  • MOGRIFY`BLOCK: a result that is not empty refuses the line, and the speaker is shown the result.
  • MOGRIFY`OVERRIDE: a true result stops the members’ own @chatformat from running.
  • MOGRIFY`NOBUFFER: a true result keeps the line out of the channel’s recall buffer.

These rewrite one part of the line each, in this order: MOGRIFY`CHANNAME (the bracketed <Name>), MOGRIFY`TITLE, MOGRIFY`PLAYERNAME, MOGRIFY`SPEECHTEXT (the “says”, for a said line only) and MOGRIFY`MESSAGE. Each gets %0 or %<value> (its part as it stands), %1 or %<channel>, %2 or %<type>, %3 or %<message> (as the speaker sent it), %4 or %<title>, %5 or %<name>, %6 or %<says> and %7 or %<options> (as in @chatformat). The title, name and says hold what the parts before have made of them.

MOGRIFY`FORMAT, when it returns something, is the whole line every member is sent. It gets the values @chatformat gets, by the same names: %0 or %<type>, %1 or %<channel> (the bracketed name, as MOGRIFY`CHANNAME left it), %2 or %<message>, %3 or %<name>, %4 or %<title>, %5 or %<default> (the line as it would be sent), %6 or %<says> and %7 or %<options>.

&MOGRIFY`MESSAGE #123=[ucstr(%<value>)]
&MOGRIFY`FORMAT #123=%<channel> %<name>: %<message>

Output: when Walker says hello on Public, whose mogrifier is #123, every member sees <Public> Walker: HELLO.

Four attributes on the mogrifier speak to one member, the way TinyMUX’s channel object does. Each runs on the mogrifier with the member as %#, and the member is told what it returns:

  • COMJOIN: when the member joins, by @channel/on or addcom.
  • COMLEAVE: when the member leaves, by @channel/off, @cboot or the last delcom for the channel.
  • COMOFF: when the member gags the channel, by @channel/gag or allcom off.
  • COMON: when the member ungags it, by @channel/ungag or allcom on.

A TinyMUX import makes each channel object the channel’s mogrifier, so these come with it.

&COMJOIN #123=Welcome to the channel, %n. Be kind.

Output: when Walker joins Public, whose mogrifier is #123, Walker sees Welcome to the channel, Walker. Be kind.

::: seealso