Skip to content

Instantly share code, notes, and snippets.

@lashtear
Created January 4, 2019 04:02
Show Gist options
  • Save lashtear/831300b5fcfbc8e093d0a6bb26cd38c5 to your computer and use it in GitHub Desktop.
Save lashtear/831300b5fcfbc8e093d0a6bb26cd38c5 to your computer and use it in GitHub Desktop.
// assumptions
// va - dbref of the hook object
// vb - dbref of the command object
// _posebreak - per-user attr for posebreak on/off before/after
// defaults to 00 (off/off)
// posebreak - per-user function for posebreak content
// defaults to %r (a blank line)
// posebreak - before
// +posebreak STYLE, where style is
// on - 10
// off - 00
// before - 10
// after - 01
// both - 11
// neither - 00
// prevent people from accidently pasting the expanded form
QUIT
@va me=<DBREF OF HOOK OBJECT>
-
@vb me=<DBREF OF COMMAND OBJECT>
-
&B_@EMIT %va=u( fn_posebreak, before )
-
&B_@REMIT %va=u( fn_posebreak, before )
-
&B_NPOSE %va=u( fn_posebreak, before )
-
&B_NSAY %va=u( fn_posebreak, before )
-
&B_POSE %va=u( fn_posebreak, before )
-
&B_POSE/NOSPACE %va=u( fn_posebreak, before )
-
&B_SAY %va=u( fn_posebreak, before )
-
&A_@EMIT %va=u( fn_posebreak, after )
-
&A_@REMIT %va=u( fn_posebreak, after )
-
&A_NPOSE %va=u( fn_posebreak, after )
-
&A_NSAY %va=u( fn_posebreak, after )
-
&A_POSE %va=u( fn_posebreak, after )
-
&A_POSE/NOSPACE %va=u( fn_posebreak, after )
-
&A_SAY %va=u( fn_posebreak, after )
-
&FN_POSEBREAK %va=
iter( filter( fil_posebreak-%0, lcon( loc( %# ), connect )),
strcat(
setq( 0,
objeval( %i0,
udefault( %i0/posebreak-%0,
udefault( %i0/posebreak, %b )))),
objeval( %i0, pemit( %i0, %q0 ))))
-
&FIL_POSEBREAK-BEFORE %va=
and(
strmatch(get(%0/_posebreak), 1*),
udefault(loc(%0)/_ic, 0))
-
&FIL_POSEBREAK-AFTER %va=
and(
strmatch(get(%0/_posebreak), ?1),
udefault(loc(%0)/_ic, 0))
-
&CMD_POSEBREAK %vb=$+posebreak*:
@switch [setr(0,trim(%0))]=
on, {@set/quiet %#=_posebreak:1},
off, {@set/quiet %#=_posebreak:},
clear, {
@set/quiet %#=posebreak:;
@pemit %#=%xh<+posebreak>%xn Posebreak text cleared.},
{
@if [words(%q0)]={
@set/quiet %#=_posebreak:1;
@set/quiet %#=posebreak:%q0}
};
@if 1={
@if 1={
@pemit %#=%xh<+posebreak>%xn Posebreak is %xh[if(get(%#/_posebreak),On,Off)]%xn.
}
}
-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment