[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. For the most part it uses the ANSI =
formatter but=20
does some mods to exits, details and objects. When using zMUD, =
hovering=20
over an exit will of course tell 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> </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<$root>;manager =3D $zmud_format;<BR>;|as=20
$zmud_format<$root>;flags =3D ['variables, 'methods, =
'code];<BR>;|as=20
$zmud_format<$root>;created_on =3D 1008434622;<BR>;|as=20
$zmud_format<$root>;inited =3D 1;<BR>;|as=20
$zmud_format<$dmi_data>;descriptions =3D #[];<BR>@program=20
$zmud_format.do_mxpsound() +access=3Dpub<BR> arg vars, flags,=20
args;<BR> // One might be so inclined to change the U=3D URL =
to maybe=20
match the 'base_url that is created in Cold so that it matches =
the one=20
in the pueblo formatter.<BR> return ["\AZZ<SOUND " +=20
flags.getkey("src") + " U=3Dhttp://192.168.100.105/~tempest/sound/>", =
vars];<BR> <BR><BR> // $#Edited: 16 Dec 01 03:54=20
$user_shar<BR>.<BR>@program $zmud_format.format() =
+access=3Dpub<BR> arg=20
data, vars;<BR> var str, len, line;<BR> <BR> str =3D =
(>=20
(._eval_ctext(data, vars))[1] <);<BR> if (strlen(str) < 2 || =
substr(str, strlen(str) - 1) !=3D =
"\n")<BR> str +=3D=20
"\n";<BR> <BR> // ugly and inneficient--use a client=20
people<BR> // out =3D str_to_buf(str);<BR> // out =3D =
out.bufsub(`[92,=20
65], `[27, 91]);</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> // go in and change all the \AZZs =
to the=20
command code for MXP then also change all the ANSI stuff too. =
:)<BR> =20
return str_to_buf(str).bufsub(`[92, 65, 90, 90], `[27, 91, 49,=20
122]).bufsub(`[92, 65], `[27, 91]);<BR> <BR><BR>.<BR>@program=20
$zmud_format.do_obj() +access=3Dpub<BR> arg vars, flags, =
args;<BR> var=20
gateway, argname, output, context, object, name, options;<BR> =
<BR> =20
name =3D flags.getkey("name");<BR> [name, vars] =3D =
._eval_ctext([name],=20
vars);<BR> context =3D flags.getkey("context");<BR> options =
=3D (|=20
flags.getkey("options") |);<BR> object =3D args[1];<BR> if=20
(type(context) =3D=3D 'string)<BR> context =
=3D=20
tosym(context);<BR> if (options && type(options) =3D=3D=20
'string)<BR> options =3D =
tosym(options);<BR> =20
switch (context) {<BR> case=20
'look:<BR> if =
(options)=20
{<BR> &n=
bsp; =20
switch (options)=20
{<BR> &n=
bsp; =20
case=20
'exit:<BR> &nb=
sp; =20
output =3D ["\AZZ<SEND>" + flags.getkey("name") + "</SEND>", =
vars];<BR> &nb=
sp; =20
case=20
'contained:<BR> &nbs=
p; =20
output =3D ["\AZZ<SEND href=3D\"look " + flags.getkey("name") + =
"\">\A1;4m" +=20
flags.getkey("name") + "\A0m</SEND>",=20
vars];<BR> &nb=
sp; =20
}<BR> } else=20
{<BR> &n=
bsp; =20
output =3D ["\AZZ<SEND href=3D\"look " + object.name('noarticle) + =
"\">" +=20
name + "</SEND>",=20
vars];<BR> =20
}<BR> case=20
'display:<BR> =
[gateway,=20
argname] =3D ["display", "target"];<BR> =
case=20
'exit:<BR> output =
=3D=20
["<a xch_cmd=3D\"go " + object.name() + "\">" + name + =
"</a>",=20
vars];<BR> }<BR> if =
(output)<BR> =20
return output;<BR> return ["<a href=3D\"" + vars['base_url] + =
"/bin/" +=20
gateway + "?" + argname + "=3D" + tostr(object) + "\">" + name + =
"</a>",=20
vars];<BR> <BR>@program $zmud_format.do_detail() =
+access=3Dpub<BR> arg=20
vars, flags, args;<BR> <BR> return ["\AZZ<SEND =
href=3D\"look " +=20
flags.getkey("name") + "\">\A1;4m" + flags.getkey("name") +=20
"\A0m</SEND>", vars];<BR> <BR>.<BR>@program =
$zmud_format.do_image()=20
+access=3Dpub<BR> arg vars, flags, args;<BR> var src, html,=20
alt;<BR> <BR> src =3D flags.getkey("src");<BR> alt =3D =
(| "alt=3D\""=20
+ flags.getkey("alt") + "\"" |) || "";<BR> if (!match_regexp(src,=20
"^(http|ftp):"))<BR> src =3D =
vars['base_url] +=20
src;<BR> return ["\AZZ<IMAGE FName=3D\"" + FName + "\" =
align=3Dleft=20
hspace=3D10 " + alt + ">", vars];<BR> =
<BR></DIV></FONT></BODY></HTML>
------=_NextPart_000_000E_01C18959.08D3AFB0--