[ColdStuff] $Formatters

K Anderson K Anderson" <vanish1024@onebox.com
Thu, 20 Dec 2001 13:20:03 -0800


This is a multi-part message in MIME format.

------=_NextPart_000_000E_01C18959.08D3AFB0
Content-Type: text/plain;
	charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

Here is some preliminary code for handling MXP, it is still under =
revision.  For the most part it uses the ANSI formatter but does some =
mods to exits, details and objects.  When using zMUD, hovering over an =
exit will of course tell  you what's up, then clicking it will send off =
the command back to the server.

;var p, new; if(!(| valid($zmud_format) |)) { new =3D =
$ansi_format.spawn(); new.set_objname('zmud_format);}
;|as $zmud_format<$root>;manager =3D $zmud_format;
;|as $zmud_format<$root>;flags =3D ['variables, 'methods, 'code];
;|as $zmud_format<$root>;created_on =3D 1008434622;
;|as $zmud_format<$root>;inited =3D 1;
;|as $zmud_format<$dmi_data>;descriptions =3D #[];
@program $zmud_format.do_mxpsound() +access=3Dpub
  arg vars, flags, args;
  // One might be so inclined to change the U=3D URL to maybe match the =
'base_url that is created in Cold so that it matches the one in the =
pueblo formatter.
  return ["\AZZ<SOUND " + flags.getkey("src") + " =
U=3Dhttp://192.168.100.105/~tempest/sound/>", vars];
 =20

  // $#Edited: 16 Dec 01 03:54 $user_shar
.
@program $zmud_format.format() +access=3Dpub
  arg data, vars;
  var str, len, line;
 =20
  str =3D (> (._eval_ctext(data, vars))[1] <);
  if (strlen(str) < 2 || substr(str, strlen(str) - 1) !=3D "\n")
      str +=3D "\n";
 =20
  // ugly and inneficient--use a client people
  // out =3D str_to_buf(str);
  // out =3D out.bufsub(`[92, 65], `[27, 91]);
 // go in and change all the \AZZs to the command code for MXP then also =
change all the ANSI stuff too. :)
  return str_to_buf(str).bufsub(`[92, 65, 90, 90], `[27, 91, 49, =
122]).bufsub(`[92, 65], `[27, 91]);
 =20

.
@program $zmud_format.do_obj() +access=3Dpub
  arg vars, flags, args;
  var gateway, argname, output, context, object, name, options;
 =20
  name =3D flags.getkey("name");
  [name, vars] =3D ._eval_ctext([name], vars);
  context =3D flags.getkey("context");
  options =3D (| flags.getkey("options") |);
  object =3D args[1];
  if (type(context) =3D=3D 'string)
      context =3D tosym(context);
  if (options && type(options) =3D=3D 'string)
      options =3D tosym(options);
  switch (context) {
      case 'look:
          if (options) {
              switch (options) {
                  case 'exit:
                      output =3D ["\AZZ<SEND>" + flags.getkey("name") + =
"</SEND>", vars];
                  case 'contained:
                      output =3D ["\AZZ<SEND href=3D\"look " + =
flags.getkey("name") + "\">\A1;4m" + flags.getkey("name") + =
"\A0m</SEND>", vars];
              }
          } else {
              output =3D ["\AZZ<SEND href=3D\"look " + =
object.name('noarticle) + "\">" + name + "</SEND>", vars];
          }
      case 'display:
          [gateway, argname] =3D ["display", "target"];
      case 'exit:
          output =3D ["<a xch_cmd=3D\"go " + object.name() + "\">" + =
name + "</a>", vars];
  }
  if (output)
      return output;
  return ["<a href=3D\"" + vars['base_url] + "/bin/" + gateway + "?" + =
argname + "=3D" + tostr(object) + "\">" + name + "</a>", vars];
 =20
@program $zmud_format.do_detail() +access=3Dpub
  arg vars, flags, args;
 =20
  return ["\AZZ<SEND href=3D\"look " + flags.getkey("name") + =
"\">\A1;4m" + flags.getkey("name") + "\A0m</SEND>", vars];
 =20
.
@program $zmud_format.do_image() +access=3Dpub
  arg vars, flags, args;
  var src, html, alt;
 =20
  src =3D flags.getkey("src");
  alt =3D (| "alt=3D\"" + flags.getkey("alt") + "\"" |) || "";
  if (!match_regexp(src, "^(http|ftp):"))
      src =3D vars['base_url] + src;
  return ["\AZZ<IMAGE FName=3D\"" + FName + "\" align=3Dleft hspace=3D10 =
" + alt + ">", vars];
 =20


------=_NextPart_000_000E_01C18959.08D3AFB0
Content-Type: text/html;
	charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dwindows-1252">
<META content=3D"MSHTML 5.50.4807.2300" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Here is some preliminary code for =
handling MXP, it=20
is still under revision.&nbsp; For the most part it uses the ANSI =
formatter but=20
does some mods to exits, details and objects.&nbsp; When using zMUD, =
hovering=20
over an exit will of course tell&nbsp; you what's up, then clicking it =
will send=20
off the command back to the server.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>;var p, new; if(!(| valid($zmud_format) =
|)) { new =3D=20
$ansi_format.spawn(); new.set_objname('zmud_format);}<BR>;|as=20
$zmud_format&lt;$root&gt;;manager =3D $zmud_format;<BR>;|as=20
$zmud_format&lt;$root&gt;;flags =3D ['variables, 'methods, =
'code];<BR>;|as=20
$zmud_format&lt;$root&gt;;created_on =3D 1008434622;<BR>;|as=20
$zmud_format&lt;$root&gt;;inited =3D 1;<BR>;|as=20
$zmud_format&lt;$dmi_data&gt;;descriptions =3D #[];<BR>@program=20
$zmud_format.do_mxpsound() +access=3Dpub<BR>&nbsp; arg vars, flags,=20
args;<BR>&nbsp;&nbsp;// One might be so inclined to change the U=3D URL =
to maybe=20
match the 'base_url&nbsp;that is created in&nbsp;Cold so that it matches =
the one=20
in the pueblo formatter.<BR>&nbsp; return ["\AZZ&lt;SOUND " +=20
flags.getkey("src") + " U=3Dhttp://192.168.100.105/~tempest/sound/&gt;", =

vars];<BR>&nbsp;&nbsp;<BR><BR>&nbsp; // $#Edited: 16 Dec 01 03:54=20
$user_shar<BR>.<BR>@program $zmud_format.format() =
+access=3Dpub<BR>&nbsp; arg=20
data, vars;<BR>&nbsp; var str, len, line;<BR>&nbsp; <BR>&nbsp; str =3D =
(&gt;=20
(._eval_ctext(data, vars))[1] &lt;);<BR>&nbsp; if (strlen(str) &lt; 2 || =

substr(str, strlen(str) - 1) !=3D =
"\n")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; str +=3D=20
"\n";<BR>&nbsp; <BR>&nbsp; // ugly and inneficient--use a client=20
people<BR>&nbsp; // out =3D str_to_buf(str);<BR>&nbsp; // out =3D =
out.bufsub(`[92,=20
65], `[27, 91]);</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;// go in and change all the \AZZs =
to the=20
command&nbsp;code for MXP then also change all the ANSI stuff too. =
:)<BR>&nbsp;=20
return str_to_buf(str).bufsub(`[92, 65, 90, 90], `[27, 91, 49,=20
122]).bufsub(`[92, 65], `[27, 91]);<BR>&nbsp; <BR><BR>.<BR>@program=20
$zmud_format.do_obj() +access=3Dpub<BR>&nbsp; arg vars, flags, =
args;<BR>&nbsp; var=20
gateway, argname, output, context, object, name, options;<BR>&nbsp; =
<BR>&nbsp;=20
name =3D flags.getkey("name");<BR>&nbsp; [name, vars] =3D =
._eval_ctext([name],=20
vars);<BR>&nbsp; context =3D flags.getkey("context");<BR>&nbsp; options =
=3D (|=20
flags.getkey("options") |);<BR>&nbsp; object =3D args[1];<BR>&nbsp; if=20
(type(context) =3D=3D 'string)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; context =
=3D=20
tosym(context);<BR>&nbsp; if (options &amp;&amp; type(options) =3D=3D=20
'string)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; options =3D =
tosym(options);<BR>&nbsp;=20
switch (context) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case=20
'look:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if =
(options)=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;=20
switch (options)=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
case=20
'exit:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
output =3D ["\AZZ&lt;SEND&gt;" + flags.getkey("name") + "&lt;/SEND&gt;", =

vars];<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
case=20
'contained:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
output =3D ["\AZZ&lt;SEND href=3D\"look " + flags.getkey("name") + =
"\"&gt;\A1;4m" +=20
flags.getkey("name") + "\A0m&lt;/SEND&gt;",=20
vars];<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;=20
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;=20
output =3D ["\AZZ&lt;SEND href=3D\"look " + object.name('noarticle) + =
"\"&gt;" +=20
name + "&lt;/SEND&gt;",=20
vars];<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case=20
'display:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
[gateway,=20
argname] =3D ["display", "target"];<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
case=20
'exit:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; output =
=3D=20
["&lt;a xch_cmd=3D\"go " + object.name() + "\"&gt;" + name + =
"&lt;/a&gt;",=20
vars];<BR>&nbsp; }<BR>&nbsp; if =
(output)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
return output;<BR>&nbsp; return ["&lt;a href=3D\"" + vars['base_url] + =
"/bin/" +=20
gateway + "?" + argname + "=3D" + tostr(object) + "\"&gt;" + name + =
"&lt;/a&gt;",=20
vars];<BR>&nbsp; <BR>@program $zmud_format.do_detail() =
+access=3Dpub<BR>&nbsp; arg=20
vars, flags, args;<BR>&nbsp; <BR>&nbsp; return ["\AZZ&lt;SEND =
href=3D\"look " +=20
flags.getkey("name") + "\"&gt;\A1;4m" + flags.getkey("name") +=20
"\A0m&lt;/SEND&gt;", vars];<BR>&nbsp; <BR>.<BR>@program =
$zmud_format.do_image()=20
+access=3Dpub<BR>&nbsp; arg vars, flags, args;<BR>&nbsp; var src, html,=20
alt;<BR>&nbsp; <BR>&nbsp; src =3D flags.getkey("src");<BR>&nbsp; alt =3D =
(| "alt=3D\""=20
+ flags.getkey("alt") + "\"" |) || "";<BR>&nbsp; if (!match_regexp(src,=20
"^(http|ftp):"))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; src =3D =
vars['base_url] +=20
src;<BR>&nbsp; return ["\AZZ&lt;IMAGE FName=3D\"" + FName + "\" =
align=3Dleft=20
hspace=3D10 " + alt + "&gt;", vars];<BR>&nbsp; =
<BR></DIV></FONT></BODY></HTML>

------=_NextPart_000_000E_01C18959.08D3AFB0--