Amulet of Memory

An amulet that allows you to store a list of dbrefs and recall them later, with various related features.

Author: Walker@M*U*S*H
Category: Other
Compatibility: CobraMUSH, PennMUSH.

Instructions

Copy and paste the below code into a compatible MUSH or MUX.

MUSHCode for Amulet of Memory

@create Amulet of Memory
@link Amulet of Memory = #0
@lock/Basic Amulet of Memory==me
@lset Amulet of Memory/Basic=no_inherit
@set Amulet of Memory = !NO_COMMAND
&AUTHOR Amulet of Memory=Walker@M*U*S*H
&CMD.FIND Amulet of Memory=$find *:think u(find,%0)
&CMD.FORGET Amulet of Memory=$forget *:think u(forget,%0)
&CMD.LOCATE Amulet of Memory=$locate *:think u(locate,%0)
&CMD.MATCH Amulet of Memory=$match *:think u(match,%0)[pemit(%#,%?
&CMD.ORGANIZE Amulet of Memory=$organize:think u(organize)
&CMD.REMEMBER Amulet of Memory=$remember:think u(remember)
&CMD.REMEMBERALL Amulet of Memory=$rememberall *:think u(rememberall,%0)
&CMD.REMEMBERED Amulet of Memory=$remembered:think u(remembered)
&CMD.REMEMBERER Amulet of Memory=$remember *:think u(rememberer,%0)
&CMD.SEND Amulet of Memory=$send * to *:think u(send,%0,%1)
&CMD.SUMMON Amulet of Memory=$summon *:think u(summon,%0)
&CMD.TRACK Amulet of Memory=$track *:think u(track,%0)
&CMD.VISUALIZE Amulet of Memory=$visualize *:think u(visualize,%0)
&CMD.WALK Amulet of Memory=$walk to *:think u(walk,%0)
&DESCRIBE Amulet of Memory=Remember: Shows you the @stats of your memory list.%rRemember <Object>: Memorize an object%rRememberall <dbref list>: Memorize a list of objects (good for %[search%(me,none,none%)%])%rRemembered: Lists what you have remembered.%rOrganize: Re-organizes anything. if an item is incorrect (garbage, room remembered as player, etc) it'll be forgotten.%rForget <object>: Forget an object%rTrack <person>: Catch up with your friend.%rWalk to <place>: Walk there.%rFind <thing>: Search around to find a thing.%rSummon <thing>: Summon <thing> to your hands.%rSend <thing> to <place or thing>: transport things somewhere else.%rMatch <string>: Match things to a string to narrow down your search or find the dbref%rVisualize <anything>:See the @desc of <anything>.%r%ru([name(me)]/search,who,class,restriction[, lower bound, upper bound])%r%rworks exactly like search(), only the search is performed on the objects the [name(me)] remembers. type help search() - a great ducat-saving function
@set Amulet of Memory/DESCRIBE=no_command visual public nearby
&FIND Amulet of Memory=pemit(%#,if(u(get_one,v(thing),%0),switch(loc(%q0),%#,You are carrying it.,%L,You're in the same room as it.,[tel(%#,loc(%q0))][if(not(comp(loc(%#),loc(%q0))),You track down the [u(fname,%q0)] in [name(loc(%#))].,You are unable to find the [u(fname,%q0)]
&FNAME Amulet of Memory=ansi(g,name(%0))%(%0[flags(%0)]%)[if(abs(comp(owner(%0),%#)),%b%[Owner: [ansi(g,name(owner(%0)))]%([owner(%0)]%)%])]
&FNAMER Amulet of Memory=[ansi(g,name(%0))]%(%0[flags(%0)]%)]%b%[owner: [name(owner(%0))]%([owner(%0)]%)%]
&FORGET Amulet of Memory=if(u(get_one,v(thing) [v(player)] [v(exit)] [v(room)],%0),[pemit(%#,[u(fname,%q0)] forgotten)][iter(room exit player thing,[set(me,%i0:[setdiff(v(%i0),%q0)])])])
&GET_LIST_LOCATION Amulet of Memory=if(not(comp(%1,setinter(%0,%1))),match(%0,%1),[setq(8,u(get_name_list,%0))][setq(7,edit(%1,%b,~))][if(gt(match(%q8,%q7),0),match(%q8,%q7),[squish(iter(%q8,if(u(get_matched,%i0,%q7),#@)))])])
&GET_MATCHED Amulet of Memory=[setq(9,iter(%1,match(%0,%i0*,~),~))][cand(abs(comp(grab(%q9,0),0)),eq(strlen(%q9),strlen(setunion(%q9,%q9))))]
&GET_NAME_LIST Amulet of Memory=[iter(%0,edit(name(%i0),%b,~))]
&GET_NUMS Amulet of Memory=iter(u(get_list_location,%0,%1),extract(%0,%i0,1))
&GET_ONE Amulet of Memory=[setq(0,u(get_nums,%0,%1))][if(eq(words(%q0),1),1,0[pemit(%#,if(gt(words(%q0),1),Multiple matches:%r[iter(%q0,space(5)[u(fname,%i0)],%b,%r)],No match for %1))]
&GET_OWNER Amulet of Memory=[switch(%0,all,v(%1),me,iter(v(%1),if(not(comp(%#,owner(%i0))),%i0%b),%b,),iter(v(%1),if(not(comp(pmatch(*%0),owner(%i0))),%i0%b),%b,))]
&GET_TWO Amulet of Memory=[setq(0,u(get_nums,%0,%1))][setq(1,u(get_nums,%2,%3))][if(cand(eq(words(%q0),1),eq(words(%q1),1)),1,0[pemit(%#,switch(1,eq(words(%q0),0),There are no matches for %1,eq(words(%q1),0),There are no matches for %3,gt(words(%q0),1),Multiple matches for %1:%r[iter(%q0,u(fname,%i0),%b,%,%b)],gt(words(%q1),1),Multiple matches for %3:%r[iter(%q1,u(fname,%i0),%b,%,%b)],Unknown Error))
&LOCATE Amulet of Memory=pemit(%#,if(u(get_one,v(thing),%0),switch(loc(%q0),%#,You are carrying it.,%L,You're in the same room as it.,The [u(fname,%q0)] is in [u(fname,loc(%q0))]
&MATCH Amulet of Memory=iter(player exit room thing,if(gt(strlen(setq(4,u(matcher,%i0,%0))%q4),0),pemit(%#,%q4)[setq(6,%q6 1)])))[if(eq(strlen(%q6),0),pemit(%#,No Match))]
&MATCHER Amulet of Memory=[setq(5,u(get_nums,v(%0),%1))][switch(words(%q5),0,,1,[capstr(lcstr(%0))]: [u(fname,%q5)],capstr(lcstr(%0))s:%r[iter(%q5,[space(5)][u(fname,%i0)],%b,%r)]
&ORGANIZE Amulet of Memory=iter(EXIT ROOM THING PLAYER,u(organizelist,%i0))[pemit(%#,Organizing...)]
&ORGANIZELIST Amulet of Memory=set(me,%0:[squish(iter(v(%0),if(not(comp(type(%i0),%0)),%i0),%b,%b))])
&REMEMBER Amulet of Memory=pemit(%#,Remembered: [words(v(thing))] Things, [words(v(room))] Rooms, [words(v(player))] Players, [words(v(exit))] Exits. Total: [add(words(v(thing)),words(v(player)),words(v(room)),words(v(exit)))]
&REMEMBERALL Amulet of Memory=pemit(%#,Remembering the list...)[iter(%0,if(not(comp(num(%i0),%i0)),set(me,type(%i0):[setunion(v(type(%i0)),%i0)])))]
&REMEMBERED Amulet of Memory=iter(Player Exit Room Thing,if(gt(strlen(v(%i0)),0),pemit(%#,%i0s:%r[iter(v(%i0),space(3)[u(fname,itext(0))],%b,%r)]
&REMEMBERER Amulet of Memory=pemit(%#,switch(locate(%#,%0,*),#-2,Multiple Matches,#-1,No Match,Remembering [u(fname,#$)][set(me,type(#$):[setunion(v(type(#$)),#$)])]))
&SEARCH Amulet of Memory=if(not(gt(match(TYPE NAME ZONE PARENT ROOMS EXITS OBJECTS PLAYERS FLAGS EVAL,ucstr(%1)*),0)),Class must be: Type%, Name%, Zone%, Parent%, Exits%, Objects%, Rooms%, Players%, Flags%, or Eval,[if(cand(eq(strlen(%3),0),eq(strlen(%4),0)),u(search.[grab(TYPE NAME ZONE PARENT ROOMS EXITS OBJECTS PLAYERS FLAGS EVAL,ucstr(%1)*)],u(search.real,%0),%2),if(cand(isint(%3),isint(%4),gte(%4,%3)),u(search.[grab(TYPE NAME ZONE PARENT ROOMS EXITS OBJECTS PLAYERS FLAGS EVAL,ucstr(%1)*)],squish(iter(u(search.real,%0),if(cand(gte(edit(%i0,#,),%3),lte(edit(%i0,#,),%4)),%i0))),%2),Argument 4 and 5 must be integers and 5 >= 4)
&SEARCH.EVAL Amulet of Memory=squish(iter(%0,if(s(edit(%1,\#\#,[%i0])),%i0)))
&SEARCH.EXITS Amulet of Memory=u(search.name,u(search.type,%0,exits),%1)
&SEARCH.FLAGS Amulet of Memory=squish(iter(%0,if(andflags(%i0,%1),%i0)))
&SEARCH.NAME Amulet of Memory=squish(iter(%0,if(strmatch(name(%i0),%1),%i0)))
&SEARCH.OBJECTS Amulet of Memory=u(search.name,u(search.type,%0,objects),%1)
&SEARCH.PARENT Amulet of Memory=if(not(u(get_one,%1)),No Match for %1,squish(iter(%0,if(not(comp(parent(%i0),%q0)),%i0))
&SEARCH.PLAYERS Amulet of Memory=u(search.name,u(search.type,%0,players),%1)
&SEARCH.REAL Amulet of Memory=[switch(%0,me,squish(iter(v(thing) [v(room)] [v(player)] [v(exit)],if(not(comp(owner(%i0),%#)),%i0))),all,v(thing) [v(room)] [v(player)] [v(exit)],t(pmatch(*%0)),squish(iter(v(thing) [v(room)] [v(player)] [v(exit)],if(not(comp(owner(%i0),pmatch(*%0))),%i0))),Player %0 not found)]
&SEARCH.REAL2 Amulet of Memory=[switch(%0,me,squish(iter(v(thing) [v(room)] [v(player)] [v(exit)],if(not(comp(owner(%i0),%#)),%i0))),all,v(thing) [v(room)] [v(player)] [v(exit)],squish(iter(v(thing) [v(room)] [v(player)] [v(exit)],if(not(comp(owner(%i0),pmatch(*%0))),%i0))))]
&SEARCH.ROOMS Amulet of Memory=u(search.name,u(search.type,%0,rooms),%1)
&SEARCH.TYPE Amulet of Memory=if(not(gt(match(OBJECTS ROOMS EXITS PLAYERS,ucstr(%1)*),0)),Type must be: Objects%, Rooms%, Exits%, or Players,setq(0,after(grab(OBJECTS:THING ROOMS:ROOM EXITS:EXIT PLAYERS:PLAYER,ucstr(%1)*),:))[squish(iter(%0,if(strmatch(type(%i0),%q0),%i0)))]
&SEARCH.ZONE Amulet of Memory=if(not(u(get_one,%1)),No Match for %1,squish(iter(%0,if(not(comp(zone(%i0),%q0)),%i0))
&SEND Amulet of Memory=if(u(get_two,v(thing),%0,v(thing) [v(player)] [v(room)],%1),pemit(%#,[switch(loc(%q0),%q1,It is already there.,[tel(%q0,%q1)][if(not(comp(loc(%q0),%q1)),You send the [u(fname,%q0)] to [u(fname,%q1)] with a snap.,You are unable to send the [u(fname,%q0)] to [u(fname,%q1)].)])]))
&SUMMON Amulet of Memory=pemit(%#,if(u(get_one,v(thing),%0),setq(1,loc(%q0))[tel(%q0,%#)][if(abs(comp(%#,loc(%q0))),You are unable to summon the [u(fname,%q0)] to your hands.,[switch(%q1,%L,You summon the [u(fname,%q0)] from the floor to your hand.,%#,You're already carrying it!,You summon the [u(fname,%q0)] to your hand with a snap.)]
&TRACK Amulet of Memory=pemit(%#,if(u(get_one,setunion(v(player),lwho()),%0),if(not(comp(%q0,%#)),Did you lose yourself?,[setq(1,loc(%#))][tel(%#,loc(%q0))][switch(%q1,loc(%q0),You are in the same room as [u(fname,%q0)].,loc(%#),You are unable to track down [u(fname,%q0)],You track down [u(fname,%q0)].)]
&TYPE Amulet of Memory=parent tool
&VISUALIZE Amulet of Memory=pemit(%#,if(u(get_one,v(thing) [v(player)] [v(room)] [v(exit)],%0),[u(fnamer,%q0)]%r[u(%q0/describe)]
&WALK Amulet of Memory=[if(u(get_one,[v(room)] [v(thing)],%0),pemit(%#,[setq(1,%L)][switch(%q1,loc(%q0),You are already there,[tel(%#,%q0)][if(not(comp(loc(%#),%q0)),You walk to the [u(fname,%q0)].,You are unable to walk to [u(fname,%q0)].)])]))]

look Amulet of Memory