Etch-a-sketch
A MUSH Etch-a-sketch that uses a 75col-x-24row cartesian grid to allow you to build, character-by-character, any sort of display you desire.
Instructions
Copy and paste the below code into a compatible MUSH or MUX.
MUSHCode for Etch-a-sketch
@create Etch-a-sketch
@lock Etch-a-sketch==me
@set Etch-a-sketch = !NO_COMMAND
@set Etch-a-sketch=BAK.01:[space(75)]
@set Etch-a-sketch=BAK.02:[space(75)]
@set Etch-a-sketch=BAK.03:[space(75)]
@set Etch-a-sketch=BAK.04:[space(75)]
@set Etch-a-sketch=BAK.05:[space(75)]
@set Etch-a-sketch=BAK.06:[space(75)]
@set Etch-a-sketch=BAK.07:[space(75)]
@set Etch-a-sketch=BAK.08:[space(75)]
@set Etch-a-sketch=BAK.09:[space(75)]
@set Etch-a-sketch=BAK.10:[space(75)]
@set Etch-a-sketch=BAK.11:[space(75)]
@set Etch-a-sketch=BAK.12:[space(75)]
@set Etch-a-sketch=BAK.13:[space(75)]
@set Etch-a-sketch=BAK.14:[space(75)]
@set Etch-a-sketch=BAK.15:[space(75)]
@set Etch-a-sketch=BAK.16:[space(75)]
@set Etch-a-sketch=BAK.17:[space(75)]
@set Etch-a-sketch=BAK.18:[space(75)]
@set Etch-a-sketch=BAK.19:[space(75)]
@set Etch-a-sketch=BAK.20:[space(75)]
@set Etch-a-sketch=BAK.21:[space(75)]
@set Etch-a-sketch=BAK.22:[space(75)]
@set Etch-a-sketch=BAK.23:[space(75)]
@set Etch-a-sketch=BAK.24:[space(75)]
&CMD.EHELP Etch-a-sketch=$ehelp:@pemit %#=[u(u.ehelp)]
&CMD.EPEEK Etch-a-sketch=$epeek *,*:@pemit %#=[ifelse(lmath(and,[isnum(%0%1)] [gt(%0,0)] [gt(%1,0)] [lte(%0,75)] [lte(%1,24)]),Locaton \(%0\,%1\) contains: [mid(get(me/row.[rjust(%1,2,0)]),dec(%0),1)],Invalid input.)]
&CMD.EPOKE Etch-a-sketch=$epoke *\,*=?:@pemit %#=[ifelse(lmath(and,[isnum(%0%1)] [gt(%0,0)] [gt(%1,0)] [lte(%0,75)] [lte(%1,24)]),[u(u.poke.1,%0,%1,%2)]Poked \(%0\,%1\): %2,Invalid location.)]
&CMD.EPOKE_AT Etch-a-sketch=$epoke at *\,*=*:@pemit %#=[ifelse(lmath(and,[isnum(%0%1)] [gt(%0,0)] [gt(%1,0)] [lte(%0,75)] [lte(%1,24)]),[ifelse(gt(strlen(%2),sub(75,%0)),Cannot fit "%2".,[iter(lnum(strlen(%2)),ulocal(u.poke.1,add(%0,itext(0)),%1,mid(%2,itext(0),1)),%b,)]Poked \(%0\,%1\): %2)],Invalid location.)]
&CMD.ERESTORE Etch-a-sketch=$erestore:@pemit %#=You magically recover the last creation you ewiped.[iter(lnum(24),set(me,row.[setr(0,rjust(itext(0),2,0))]:[get(me/bak.%q0)]),%b,)]
&CMD.EVIEW Etch-a-sketch=$eview:@pemit %#=[iter(lnum(24,1),[setr(0,rjust(itext(0),2,0))]|[get(me/row.%q0)],%b,%r)]%r%b%b+[repeat(-,75)]%r%b%b%b[iter(lnum(1,75),[left(rjust(itext(0),2,0),1)],%b,)]%r%b%b%b[iter(lnum(1,75),[right(rjust(itext(0),2,0),1)],%b,)]
&CMD.EWIPE Etch-a-sketch=$ewipe:@pemit %#=You shake the Etch-a-sketch, wiping out your creation.[iter(lnum(1,24),[set(me,bak.[setr(0,rjust(itext(0),2,0))]:[get(me/row.%q0)])][set(me,row.%q0:[space(75)])],%b,)]
&DESCRIBE Etch-a-sketch=This is your MUSH Etch-a-sketch (sorta). It uses a 75col-x-24row cartesian grid to allow you to build, character-by-character, any sort of display you desire. Before using it you must 'ewipe' it once to activate it. See 'ehelp' for more commands.
@set Etch-a-sketch/DESCRIBE=no_command visual public nearby
&HLP.EHELP Etch-a-sketch=This file.
&HLP.EPEEK Etch-a-sketch=Shows the character located at %0,%1
&HLP.EPOKE Etch-a-sketch=Places the single character %2 at %0,%1
&HLP.EPOKE_AT Etch-a-sketch=Inserts the string %2, beginning at %0,%1
&HLP.ERESTORE Etch-a-sketch=Restores the last drawing wiped by 'ewipe'.
&HLP.EVIEW Etch-a-sketch=Displays your current drawing.
&HLP.EWIPE Etch-a-sketch=Erases all of your current drawing.
&ROW.00 Etch-a-sketch=
@set Etch-a-sketch=ROW.01:[space(75)]
@set Etch-a-sketch=ROW.02:[space(75)]
@set Etch-a-sketch=ROW.03:[space(75)]
@set Etch-a-sketch=ROW.04:[space(75)]
@set Etch-a-sketch=ROW.05:[space(75)]
@set Etch-a-sketch=ROW.06:[space(75)]
@set Etch-a-sketch=ROW.07:[space(75)]
@set Etch-a-sketch=ROW.08:[space(75)]
@set Etch-a-sketch=ROW.09:[space(75)]
@set Etch-a-sketch=ROW.10:[space(75)]
@set Etch-a-sketch=ROW.11:[space(75)]
@set Etch-a-sketch=ROW.12:[space(75)]
@set Etch-a-sketch=ROW.13:[space(75)]
@set Etch-a-sketch=ROW.14:[space(75)]
@set Etch-a-sketch=ROW.15:[space(75)]
@set Etch-a-sketch=ROW.16:[space(75)]
@set Etch-a-sketch=ROW.17:[space(75)]
@set Etch-a-sketch=ROW.18:[space(75)]
@set Etch-a-sketch=ROW.19:[space(75)]
@set Etch-a-sketch=ROW.20:[space(75)]
@set Etch-a-sketch=ROW.21:[space(75)]
@set Etch-a-sketch=ROW.22:[space(75)]
@set Etch-a-sketch=ROW.23:[space(75)]
@set Etch-a-sketch=ROW.24:[space(75)]
&U.EHELP Etch-a-sketch=Etch-a-sketch help.%r%r[iter(lattr([last(lparent(me))]/cmd.*),[ljust(first(get(me/[itext(0)]),:),20)][get(me/hlp.[after(itext(0),.)])],%b,%r)]
&U.POKE.1 Etch-a-sketch=[set(me,row.[setr(0,rjust(%1,2,0))]:[left(setr(1,get(me/row.%q0)),dec(%0))]%2[right(%q1,sub(75,%0))])]
look Etch-a-sketch
@lock Etch-a-sketch==me
@set Etch-a-sketch = !NO_COMMAND
@set Etch-a-sketch=BAK.01:[space(75)]
@set Etch-a-sketch=BAK.02:[space(75)]
@set Etch-a-sketch=BAK.03:[space(75)]
@set Etch-a-sketch=BAK.04:[space(75)]
@set Etch-a-sketch=BAK.05:[space(75)]
@set Etch-a-sketch=BAK.06:[space(75)]
@set Etch-a-sketch=BAK.07:[space(75)]
@set Etch-a-sketch=BAK.08:[space(75)]
@set Etch-a-sketch=BAK.09:[space(75)]
@set Etch-a-sketch=BAK.10:[space(75)]
@set Etch-a-sketch=BAK.11:[space(75)]
@set Etch-a-sketch=BAK.12:[space(75)]
@set Etch-a-sketch=BAK.13:[space(75)]
@set Etch-a-sketch=BAK.14:[space(75)]
@set Etch-a-sketch=BAK.15:[space(75)]
@set Etch-a-sketch=BAK.16:[space(75)]
@set Etch-a-sketch=BAK.17:[space(75)]
@set Etch-a-sketch=BAK.18:[space(75)]
@set Etch-a-sketch=BAK.19:[space(75)]
@set Etch-a-sketch=BAK.20:[space(75)]
@set Etch-a-sketch=BAK.21:[space(75)]
@set Etch-a-sketch=BAK.22:[space(75)]
@set Etch-a-sketch=BAK.23:[space(75)]
@set Etch-a-sketch=BAK.24:[space(75)]
&CMD.EHELP Etch-a-sketch=$ehelp:@pemit %#=[u(u.ehelp)]
&CMD.EPEEK Etch-a-sketch=$epeek *,*:@pemit %#=[ifelse(lmath(and,[isnum(%0%1)] [gt(%0,0)] [gt(%1,0)] [lte(%0,75)] [lte(%1,24)]),Locaton \(%0\,%1\) contains: [mid(get(me/row.[rjust(%1,2,0)]),dec(%0),1)],Invalid input.)]
&CMD.EPOKE Etch-a-sketch=$epoke *\,*=?:@pemit %#=[ifelse(lmath(and,[isnum(%0%1)] [gt(%0,0)] [gt(%1,0)] [lte(%0,75)] [lte(%1,24)]),[u(u.poke.1,%0,%1,%2)]Poked \(%0\,%1\): %2,Invalid location.)]
&CMD.EPOKE_AT Etch-a-sketch=$epoke at *\,*=*:@pemit %#=[ifelse(lmath(and,[isnum(%0%1)] [gt(%0,0)] [gt(%1,0)] [lte(%0,75)] [lte(%1,24)]),[ifelse(gt(strlen(%2),sub(75,%0)),Cannot fit "%2".,[iter(lnum(strlen(%2)),ulocal(u.poke.1,add(%0,itext(0)),%1,mid(%2,itext(0),1)),%b,)]Poked \(%0\,%1\): %2)],Invalid location.)]
&CMD.ERESTORE Etch-a-sketch=$erestore:@pemit %#=You magically recover the last creation you ewiped.[iter(lnum(24),set(me,row.[setr(0,rjust(itext(0),2,0))]:[get(me/bak.%q0)]),%b,)]
&CMD.EVIEW Etch-a-sketch=$eview:@pemit %#=[iter(lnum(24,1),[setr(0,rjust(itext(0),2,0))]|[get(me/row.%q0)],%b,%r)]%r%b%b+[repeat(-,75)]%r%b%b%b[iter(lnum(1,75),[left(rjust(itext(0),2,0),1)],%b,)]%r%b%b%b[iter(lnum(1,75),[right(rjust(itext(0),2,0),1)],%b,)]
&CMD.EWIPE Etch-a-sketch=$ewipe:@pemit %#=You shake the Etch-a-sketch, wiping out your creation.[iter(lnum(1,24),[set(me,bak.[setr(0,rjust(itext(0),2,0))]:[get(me/row.%q0)])][set(me,row.%q0:[space(75)])],%b,)]
&DESCRIBE Etch-a-sketch=This is your MUSH Etch-a-sketch (sorta). It uses a 75col-x-24row cartesian grid to allow you to build, character-by-character, any sort of display you desire. Before using it you must 'ewipe' it once to activate it. See 'ehelp' for more commands.
@set Etch-a-sketch/DESCRIBE=no_command visual public nearby
&HLP.EHELP Etch-a-sketch=This file.
&HLP.EPEEK Etch-a-sketch=Shows the character located at %0,%1
&HLP.EPOKE Etch-a-sketch=Places the single character %2 at %0,%1
&HLP.EPOKE_AT Etch-a-sketch=Inserts the string %2, beginning at %0,%1
&HLP.ERESTORE Etch-a-sketch=Restores the last drawing wiped by 'ewipe'.
&HLP.EVIEW Etch-a-sketch=Displays your current drawing.
&HLP.EWIPE Etch-a-sketch=Erases all of your current drawing.
&ROW.00 Etch-a-sketch=
@set Etch-a-sketch=ROW.01:[space(75)]
@set Etch-a-sketch=ROW.02:[space(75)]
@set Etch-a-sketch=ROW.03:[space(75)]
@set Etch-a-sketch=ROW.04:[space(75)]
@set Etch-a-sketch=ROW.05:[space(75)]
@set Etch-a-sketch=ROW.06:[space(75)]
@set Etch-a-sketch=ROW.07:[space(75)]
@set Etch-a-sketch=ROW.08:[space(75)]
@set Etch-a-sketch=ROW.09:[space(75)]
@set Etch-a-sketch=ROW.10:[space(75)]
@set Etch-a-sketch=ROW.11:[space(75)]
@set Etch-a-sketch=ROW.12:[space(75)]
@set Etch-a-sketch=ROW.13:[space(75)]
@set Etch-a-sketch=ROW.14:[space(75)]
@set Etch-a-sketch=ROW.15:[space(75)]
@set Etch-a-sketch=ROW.16:[space(75)]
@set Etch-a-sketch=ROW.17:[space(75)]
@set Etch-a-sketch=ROW.18:[space(75)]
@set Etch-a-sketch=ROW.19:[space(75)]
@set Etch-a-sketch=ROW.20:[space(75)]
@set Etch-a-sketch=ROW.21:[space(75)]
@set Etch-a-sketch=ROW.22:[space(75)]
@set Etch-a-sketch=ROW.23:[space(75)]
@set Etch-a-sketch=ROW.24:[space(75)]
&U.EHELP Etch-a-sketch=Etch-a-sketch help.%r%r[iter(lattr([last(lparent(me))]/cmd.*),[ljust(first(get(me/[itext(0)]),:),20)][get(me/hlp.[after(itext(0),.)])],%b,%r)]
&U.POKE.1 Etch-a-sketch=[set(me,row.[setr(0,rjust(%1,2,0))]:[left(setr(1,get(me/row.%q0)),dec(%0))]%2[right(%q1,sub(75,%0))])]
look Etch-a-sketch