Graphing Paper
Generic graphing paper.
Functions:
add(),
after(),
align(),
cand(),
chr(),
dec(),
edit(),
eq(),
first(),
firstof(),
fold(),
fullname(),
get(),
hasattr(),
if(),
inc(),
iter(),
lexits(),
lmath(),
loc(),
localize(),
lt(),
map(),
mul(),
null(),
regedit(),
regeditall(),
regmatch(),
regraball(),
repeat(),
reswitch(),
rjust(),
setq(),
setr(),
sortkey(),
strcat(),
strlen(),
strmatch(),
strreplace(),
sub(),
u(),
ulocal(),
unique(),
words(),
wrap().
Features:
#lambda.
Instructions
Copy and paste the below code into a compatible MUSH or MUX.
MUSHCode for Graphing Paper
@create Graphing Paper
@lock Graphing Paper==me
@set Graphing Paper = !NO_COMMAND
&AUTHOR Graphing Paper=Walker@M*U*S*H. Use however you want. Public domain.
&DESCRIBE Graphing Paper=Generic graphing paper (or a child of it). Use u(draw,x.y:text x2.y2:text x3.y3:text[,<width>[,<height>]])
@set Graphing Paper/DESCRIBE=no_command visual prefixmatch public nearby
&DRAW Graphing Paper=localize(strcat(setq(w,firstof(%1,22),h,firstof(%2,11),d,firstof(%3,%b)),u(draw`frame,%0))
&DRAW`FRAME Graphing Paper=strcat(.,repeat(_,%qw),.%r,edit(align(1. %qw 1.,|,edit(ulocal(draw`graph,%0),%b,chr(169)),|,%b,),chr(169),%b),%r',repeat(-,%qw),')
&DRAW`GRAPH Graphing Paper=fold(draw`point,%0,repeat(chr(169),mul(%qw,%qh)),%qd)
&DRAW`POINT Graphing Paper=if(cand(regmatch(%1,^(\\d+)\\.(\\d+):(.*)$,- x y t),lt(%qx,%qw),lt(%qy,%qh)),strreplace(%0,add(mul(sub(dec(%qh),%qy),%qw),%qx),strlen(%qt),%qt),%0)
&DRAWPLAIN Graphing Paper=strcat(setq(w,firstof(%1,22),h,firstof(%2,11),d,firstof(%3,%b)),edit(wrap(edit(ulocal(draw`graph,%0),%b,chr(169)),%qw),chr(169),%b,-%r,%r))
&FRAME Graphing Paper=u(draw,%0,%1,%2,%3
&MAP_EXITS Graphing Paper=localize(edit(regeditall(sortkey(#lambda/u(map_exits`verthoriz,\%0),regraball(map(#lambda/u(map_exits`plot,\%0,1),iter(lexits(%l),5.5:##),%b,|),\\d.\\d-\\d\\.\\d:.*,|),i,|),(\\d+)\\.\\d+-\\1\\.\\d+:(\[^\\|\]*)(\\|\\1\\.\\d+-\\1\\.\\d+:(\\2|ZZZZStreet))*,u(map_exits`squish,$0),\\d+\\.(\\d+)-\\d+\\.\\1:(\[^\\|\]*)(\\|\\d+\\.\\1-\\d+\\.\\1:(\\2|ZZZZStreet))*,u(map_exits`squish,$0)),|,%r))
&MAP_EXITS`PLOT Graphing Paper=if(cand(strmatch(%0,*.*:*,w h d),regmatch(fullname(%qd),\\b(east|west|south|north)\\b)),%qw.%qh-[setr(p,reswitch(fullname(%qd),\\beast\\b,inc(%qw).%qh,\\bwest\\b,dec(%qw).%qh,\\bnorth\\b,%qw.[inc(%qh)],\\bsouth\\b,%qw.[dec(%qh)]))]:[if(hasattr(%qd,streetname),get(%qd/streetname),ZZZZStreet)][if(%1,|[map(#lambda/u(map_exits`plot,\%0,[dec(%1)]),iter(lexits(loc(%qd)),%qp:##),%b,|)])])
&MAP_EXITS`SQUISH Graphing Paper=[if(regmatch(%0,\\d+\\.\\d+-\\d+\\.\\d+:(.*?)(\\||$),- n),[null(setq(0,regeditall(%0,-,%b,\\|,%b,\[^\\d\\.\\s],)),setq(x,regeditall(%q0,(\\d+)\\.(\\d+),$1),y,regeditall(%q0,(\\d+)\\.(\\d+),$2)))][if(eq(words(unique(%qx,n)),1),Vertical: %qn at X: [first(%qx)] from [lmath(min,%qy)]-[lmath(max,%qy)],Horizontal: %qn at Y: [first(%qy)] from [lmath(min,%qx)]-[lmath(max,%qx)])],Buggy regmatch.)]
&MAP_EXITS`VERTHORIZ Graphing Paper=regedit(%0,(\\d+)\\.(\\d+)-\\1\\.(\\d+):,V[rjust($1,3,0)].,(\\d+)\\.(\\d+)-(\\d+)\\.\\2:,H[rjust($2,3,0)].)[after(%0,:)]
look Graphing Paper
@lock Graphing Paper==me
@set Graphing Paper = !NO_COMMAND
&AUTHOR Graphing Paper=Walker@M*U*S*H. Use however you want. Public domain.
&DESCRIBE Graphing Paper=Generic graphing paper (or a child of it). Use u(draw,x.y:text x2.y2:text x3.y3:text[,<width>[,<height>]])
@set Graphing Paper/DESCRIBE=no_command visual prefixmatch public nearby
&DRAW Graphing Paper=localize(strcat(setq(w,firstof(%1,22),h,firstof(%2,11),d,firstof(%3,%b)),u(draw`frame,%0))
&DRAW`FRAME Graphing Paper=strcat(.,repeat(_,%qw),.%r,edit(align(1. %qw 1.,|,edit(ulocal(draw`graph,%0),%b,chr(169)),|,%b,),chr(169),%b),%r',repeat(-,%qw),')
&DRAW`GRAPH Graphing Paper=fold(draw`point,%0,repeat(chr(169),mul(%qw,%qh)),%qd)
&DRAW`POINT Graphing Paper=if(cand(regmatch(%1,^(\\d+)\\.(\\d+):(.*)$,- x y t),lt(%qx,%qw),lt(%qy,%qh)),strreplace(%0,add(mul(sub(dec(%qh),%qy),%qw),%qx),strlen(%qt),%qt),%0)
&DRAWPLAIN Graphing Paper=strcat(setq(w,firstof(%1,22),h,firstof(%2,11),d,firstof(%3,%b)),edit(wrap(edit(ulocal(draw`graph,%0),%b,chr(169)),%qw),chr(169),%b,-%r,%r))
&FRAME Graphing Paper=u(draw,%0,%1,%2,%3
&MAP_EXITS Graphing Paper=localize(edit(regeditall(sortkey(#lambda/u(map_exits`verthoriz,\%0),regraball(map(#lambda/u(map_exits`plot,\%0,1),iter(lexits(%l),5.5:##),%b,|),\\d.\\d-\\d\\.\\d:.*,|),i,|),(\\d+)\\.\\d+-\\1\\.\\d+:(\[^\\|\]*)(\\|\\1\\.\\d+-\\1\\.\\d+:(\\2|ZZZZStreet))*,u(map_exits`squish,$0),\\d+\\.(\\d+)-\\d+\\.\\1:(\[^\\|\]*)(\\|\\d+\\.\\1-\\d+\\.\\1:(\\2|ZZZZStreet))*,u(map_exits`squish,$0)),|,%r))
&MAP_EXITS`PLOT Graphing Paper=if(cand(strmatch(%0,*.*:*,w h d),regmatch(fullname(%qd),\\b(east|west|south|north)\\b)),%qw.%qh-[setr(p,reswitch(fullname(%qd),\\beast\\b,inc(%qw).%qh,\\bwest\\b,dec(%qw).%qh,\\bnorth\\b,%qw.[inc(%qh)],\\bsouth\\b,%qw.[dec(%qh)]))]:[if(hasattr(%qd,streetname),get(%qd/streetname),ZZZZStreet)][if(%1,|[map(#lambda/u(map_exits`plot,\%0,[dec(%1)]),iter(lexits(loc(%qd)),%qp:##),%b,|)])])
&MAP_EXITS`SQUISH Graphing Paper=[if(regmatch(%0,\\d+\\.\\d+-\\d+\\.\\d+:(.*?)(\\||$),- n),[null(setq(0,regeditall(%0,-,%b,\\|,%b,\[^\\d\\.\\s],)),setq(x,regeditall(%q0,(\\d+)\\.(\\d+),$1),y,regeditall(%q0,(\\d+)\\.(\\d+),$2)))][if(eq(words(unique(%qx,n)),1),Vertical: %qn at X: [first(%qx)] from [lmath(min,%qy)]-[lmath(max,%qy)],Horizontal: %qn at Y: [first(%qy)] from [lmath(min,%qx)]-[lmath(max,%qx)])],Buggy regmatch.)]
&MAP_EXITS`VERTHORIZ Graphing Paper=regedit(%0,(\\d+)\\.(\\d+)-\\1\\.(\\d+):,V[rjust($1,3,0)].,(\\d+)\\.(\\d+)-(\\d+)\\.\\2:,H[rjust($2,3,0)].)[after(%0,:)]
look Graphing Paper