Fortiva's Luggage Case
Instructions
Copy and paste the below code into a compatible MUSH or MUX.
MUSHCode for Fortiva's Luggage Case
@create Fortiva's Luggage Case
@lock Fortiva's Luggage Case==me
@set Fortiva's Luggage Case = TRUST
@set Fortiva's Luggage Case = OPAQUE
@set Fortiva's Luggage Case = ENTER_OK
@set Fortiva's Luggage Case = MONITOR
@set Fortiva's Luggage Case = !NO_COMMAND
&AENTER Fortiva's Luggage Case=think [u(Fn_Sort_Contents)]
@set Fortiva's Luggage Case/AENTER=no_command
&ALEAVE Fortiva's Luggage Case=@lemit [switch(type(%L),ROOM,,[name(%L)] gets %n from [name(me)].)];think [u(Fn_Sort_Contents)]
@set Fortiva's Luggage Case/ALEAVE=no_command
&CMD_CCLOSE Fortiva's Luggage Case=$cclose:@switch [hasflag(me,enter_ok)]=0, {@pemit %#=[name(me)] is already closed.}, {@pemit %#=You close and lock [name(me)].;@oemit %#=%n closes and locks [name(me)].;@set me=!enter_ok}
&CMD_CGRAB Fortiva's Luggage Case=$cgrab *:@switch [setq(0,grab(v(Dat_Contents),%0^*,|))][setq(1,rest(%q0,^))]%q0|[hasflag(me,enter_ok)]=*|0, {@pemit %#=[name(me)] is closed.}, |1, {@pemit %#=There is no "%0" in [name(me)].}, {@oemit %#=[switch(loc(me),%#,,%n unloads [name(%q1)] from [name(me)].)];drop %q1};@fo %#=grab %q1
&CMD_CLOAD Fortiva's Luggage Case=$cload *:@switch [setq(0,grab(edit(iter(lcon(here),[name(##)]^##|,),|%b,|),%0^*,|))][setq(1,rest(%q0,^))]%q0|[hasflag(me,enter_ok)]=*|0, {@pemit %#=[name(me)] is closed.}, |1, {@pemit %#=There is no "%0" here.}, {@pemit %#=You put [name(%q1)] into [name(me)].;@oemit %#=%n puts [name(%q1)] into [name(me)].;get %q1}
&CMD_COPEN Fortiva's Luggage Case=$copen:@switch [hasflag(me,enter_ok)][u(HasKey,%0)]=1*, {@pemit %#=[name(me)] is already open.;@oemit %#=%n tries to open [name(me)] but realizes it is already open.}, 00, {@pemit %#=You don't have the key to [name(me)].;@oemit %#=%n tries to open [name(me)] but does not have the key.}, {@pemit %#=You unlock and open [name(me)].;@oemit %#=%n unlocks and opens [name(me)].;@set me=enter_ok}
&CMD_CRELOAD Fortiva's Luggage Case=$creload *:@switch [setq(0,grab(v(Dat_Contents),%0^*,|))][setq(1,rest(%q0,^))]%q0|[hasflag(me,enter_ok)]=*|0, {@pemit %#=[name(me)] is closed.}, |1, {@pemit %#=There is no "%0" in [name(me)].}, {@oemit %#=[switch(loc(me),%#,,%n unloads [name(%q1)] from [name(me)].)];drop %q1};@fo %#={grab %q1;reload}
&CMD_CUNLOAD Fortiva's Luggage Case=$cunload *:@switch [setq(0,grab(v(Dat_Contents),%0^*,|))][setq(1,rest(%q0,^))]%q0|[hasflag(me,enter_ok)]=*|0, {@pemit %#=[name(me)] is closed.}, |1, {@pemit %#=There is no "%0" in [name(me)].}, {@oemit %#=[switch(loc(me),%#,,%n unloads [name(%q1)] from [name(me)].)];drop %q1}
&CMD_CWEAR Fortiva's Luggage Case=$cwear *:@switch [setq(0,grab(v(Dat_Contents),%0^*,|))][setq(1,rest(%q0,^))]%q0|[hasflag(me,enter_ok)]=*|0, {@pemit %#=[name(me)] is closed.}, |1, {@pemit %#=There is no "%0" in [name(me)].}, {@oemit %#=[switch(loc(me),%#,,%n unloads [name(%q1)] from [name(me)].)];drop %q1};@fo %#=wear %q1
&CMD_CWIELD Fortiva's Luggage Case=$cwield *:@switch [setq(0,grab(v(Dat_Contents),%0^*,|))][setq(1,rest(%q0,^))]%q0|[hasflag(me,enter_ok)]=*|0, {@pemit %#=[name(me)] is closed.}, |1, {@pemit %#=There is no "%0" in [name(me)].}, {@oemit %#=[switch(loc(me),%#,,%n unloads [name(%q1)] from [name(me)].)];drop %q1};@fo %#=wield %q1
&CONTENTS Fortiva's Luggage Case=It is currently [switch(hasflag(me,enter_ok),0,closed.,open.[switch(con(me),#-1,,%r%chContents:%cn[u(Fn_Sort_Contents)][u(Fn_Display_Contents)])])]
&DAT_CONTENTS Fortiva's Luggage Case=|Empire Object^#1085|pig latin^#6283|Shipconfig Datapad^#4310|Urinal^#1214|Dummy Item^#0
&DESCRIBE Fortiva's Luggage Case=[u(PDesc)]%r[u(Contents)]
@set Fortiva's Luggage Case/DESCRIBE=no_command visual public nearby
&DROP Fortiva's Luggage Case=You drop [name(me)].
@set Fortiva's Luggage Case/DROP=no_command
&ENTER Fortiva's Luggage Case=You climb into the [name(me)].
@set Fortiva's Luggage Case/ENTER=no_command
&FN_CONTENTS Fortiva's Luggage Case=[iter(lcon(me),%r#[rjust(rest(##,#),5)] - [name(##)])]
&FN_DISPLAY_CONTENTS Fortiva's Luggage Case=[setq(0,first(first(v(Dat_Contents),|),^))][setq(9,rest(first(v(Dat_Contents),|),^))][setq(1,0)][setq(2,1)][iter(v(Dat_Contents),[switch(first(##,^),%q0,[setq(1,add(%q1,1))],%r[rjust(%q2,2)][setq(2,add(%q2,1))]> \[#[rjust(rest(%q9,#),5)]\] %q0 [switch(%q1,1,,(%q1))][setq(1,1)][setq(0,first(##,^))][setq(9,rest(##,^))])],|)]
&FN_SORT_CONTENTS Fortiva's Luggage Case=[set(me,Dat_Contents:[trim(sort(edit(iter(lcon(me),[name(##)]^##|),|%b,|),a,|),,|)]|Dummy Item^#0)]
&HASKEY Fortiva's Luggage Case=[member(v(Keys),%#)]
&IDESCRIBE Fortiva's Luggage Case=You are packed inside a cramped luggage case. The air inside here is stuffy and stale, but provides barely enough ventilation for someone to stay alive.
@set Fortiva's Luggage Case/IDESCRIBE=no_command
&INPREFIX Fortiva's Luggage Case=From outside the case,
@set Fortiva's Luggage Case/INPREFIX=no_command
&KEYS Fortiva's Luggage Case=
&LEAVE Fortiva's Luggage Case=You climb out of the [name(me)].
@set Fortiva's Luggage Case/LEAVE=no_command
&ODROP Fortiva's Luggage Case=drops [name(me)].
@set Fortiva's Luggage Case/ODROP=no_command
&OENTER Fortiva's Luggage Case=climbs into the [name(me)].
@set Fortiva's Luggage Case/OENTER=no_command
&OLEAVE Fortiva's Luggage Case=climbs out of the [name(me)].
@set Fortiva's Luggage Case/OLEAVE=no_command
&OSUCCESS Fortiva's Luggage Case=takes [name(me)].
@set Fortiva's Luggage Case/OSUCCESS=no_command
&OUSE Fortiva's Luggage Case=examines [name(me)] closely.
@set Fortiva's Luggage Case/OUSE=no_command
&PDESC Fortiva's Luggage Case=A plain brown compact luggage case. It has a pair of wheels on the bottom, giving the option of wheeling the case rather than carrying it.
&SETUP Fortiva's Luggage Case=@switch [parent(me)]=#-1,, {@va me;@va me=[v(va)];&Keys me;&Keys me=[remove(v(Keys),%#)] %#;@set me=MONITOR;@set me=OPAQUE;think [u(Fn_Sort_Contents)]}
&SUCCESS Fortiva's Luggage Case=You get [name(me)].
@set Fortiva's Luggage Case/SUCCESS=no_command
&USE Fortiva's Luggage Case=[repeat(-,79)]%rcopen%t%t%t- Opens the case%rcclose%t%t%t- Closes the case%rget case's <item>%t- Takes <item> from the case%rcunload <fullname>%t- Unloads <item> from the case (specify full name)%rcwield/creload/cgrab/%rcwear <item>%t%t- Unloads <item> and uses it%rgive case=<item>%t- Puts <item> inside the case%rcload <fullname>%t- Loads <item> into the case (no weapons)%r[repeat(-,79)]
@set Fortiva's Luggage Case/USE=no_command
&VA Fortiva's Luggage Case=^* gave you *.:@lemit %0 puts %1 in [name(me)].
@fo me=&KEYS [num(Fortiva's Luggage Case)]=%#
@wait 1={think You may add a list of player dbrefs to the KEYS attribute to control who is allowed to open this luggage case.}
@wait 1={use Fortiva's Luggage Case}
@lock Fortiva's Luggage Case==me
@set Fortiva's Luggage Case = TRUST
@set Fortiva's Luggage Case = OPAQUE
@set Fortiva's Luggage Case = ENTER_OK
@set Fortiva's Luggage Case = MONITOR
@set Fortiva's Luggage Case = !NO_COMMAND
&AENTER Fortiva's Luggage Case=think [u(Fn_Sort_Contents)]
@set Fortiva's Luggage Case/AENTER=no_command
&ALEAVE Fortiva's Luggage Case=@lemit [switch(type(%L),ROOM,,[name(%L)] gets %n from [name(me)].)];think [u(Fn_Sort_Contents)]
@set Fortiva's Luggage Case/ALEAVE=no_command
&CMD_CCLOSE Fortiva's Luggage Case=$cclose:@switch [hasflag(me,enter_ok)]=0, {@pemit %#=[name(me)] is already closed.}, {@pemit %#=You close and lock [name(me)].;@oemit %#=%n closes and locks [name(me)].;@set me=!enter_ok}
&CMD_CGRAB Fortiva's Luggage Case=$cgrab *:@switch [setq(0,grab(v(Dat_Contents),%0^*,|))][setq(1,rest(%q0,^))]%q0|[hasflag(me,enter_ok)]=*|0, {@pemit %#=[name(me)] is closed.}, |1, {@pemit %#=There is no "%0" in [name(me)].}, {@oemit %#=[switch(loc(me),%#,,%n unloads [name(%q1)] from [name(me)].)];drop %q1};@fo %#=grab %q1
&CMD_CLOAD Fortiva's Luggage Case=$cload *:@switch [setq(0,grab(edit(iter(lcon(here),[name(##)]^##|,),|%b,|),%0^*,|))][setq(1,rest(%q0,^))]%q0|[hasflag(me,enter_ok)]=*|0, {@pemit %#=[name(me)] is closed.}, |1, {@pemit %#=There is no "%0" here.}, {@pemit %#=You put [name(%q1)] into [name(me)].;@oemit %#=%n puts [name(%q1)] into [name(me)].;get %q1}
&CMD_COPEN Fortiva's Luggage Case=$copen:@switch [hasflag(me,enter_ok)][u(HasKey,%0)]=1*, {@pemit %#=[name(me)] is already open.;@oemit %#=%n tries to open [name(me)] but realizes it is already open.}, 00, {@pemit %#=You don't have the key to [name(me)].;@oemit %#=%n tries to open [name(me)] but does not have the key.}, {@pemit %#=You unlock and open [name(me)].;@oemit %#=%n unlocks and opens [name(me)].;@set me=enter_ok}
&CMD_CRELOAD Fortiva's Luggage Case=$creload *:@switch [setq(0,grab(v(Dat_Contents),%0^*,|))][setq(1,rest(%q0,^))]%q0|[hasflag(me,enter_ok)]=*|0, {@pemit %#=[name(me)] is closed.}, |1, {@pemit %#=There is no "%0" in [name(me)].}, {@oemit %#=[switch(loc(me),%#,,%n unloads [name(%q1)] from [name(me)].)];drop %q1};@fo %#={grab %q1;reload}
&CMD_CUNLOAD Fortiva's Luggage Case=$cunload *:@switch [setq(0,grab(v(Dat_Contents),%0^*,|))][setq(1,rest(%q0,^))]%q0|[hasflag(me,enter_ok)]=*|0, {@pemit %#=[name(me)] is closed.}, |1, {@pemit %#=There is no "%0" in [name(me)].}, {@oemit %#=[switch(loc(me),%#,,%n unloads [name(%q1)] from [name(me)].)];drop %q1}
&CMD_CWEAR Fortiva's Luggage Case=$cwear *:@switch [setq(0,grab(v(Dat_Contents),%0^*,|))][setq(1,rest(%q0,^))]%q0|[hasflag(me,enter_ok)]=*|0, {@pemit %#=[name(me)] is closed.}, |1, {@pemit %#=There is no "%0" in [name(me)].}, {@oemit %#=[switch(loc(me),%#,,%n unloads [name(%q1)] from [name(me)].)];drop %q1};@fo %#=wear %q1
&CMD_CWIELD Fortiva's Luggage Case=$cwield *:@switch [setq(0,grab(v(Dat_Contents),%0^*,|))][setq(1,rest(%q0,^))]%q0|[hasflag(me,enter_ok)]=*|0, {@pemit %#=[name(me)] is closed.}, |1, {@pemit %#=There is no "%0" in [name(me)].}, {@oemit %#=[switch(loc(me),%#,,%n unloads [name(%q1)] from [name(me)].)];drop %q1};@fo %#=wield %q1
&CONTENTS Fortiva's Luggage Case=It is currently [switch(hasflag(me,enter_ok),0,closed.,open.[switch(con(me),#-1,,%r%chContents:%cn[u(Fn_Sort_Contents)][u(Fn_Display_Contents)])])]
&DAT_CONTENTS Fortiva's Luggage Case=|Empire Object^#1085|pig latin^#6283|Shipconfig Datapad^#4310|Urinal^#1214|Dummy Item^#0
&DESCRIBE Fortiva's Luggage Case=[u(PDesc)]%r[u(Contents)]
@set Fortiva's Luggage Case/DESCRIBE=no_command visual public nearby
&DROP Fortiva's Luggage Case=You drop [name(me)].
@set Fortiva's Luggage Case/DROP=no_command
&ENTER Fortiva's Luggage Case=You climb into the [name(me)].
@set Fortiva's Luggage Case/ENTER=no_command
&FN_CONTENTS Fortiva's Luggage Case=[iter(lcon(me),%r#[rjust(rest(##,#),5)] - [name(##)])]
&FN_DISPLAY_CONTENTS Fortiva's Luggage Case=[setq(0,first(first(v(Dat_Contents),|),^))][setq(9,rest(first(v(Dat_Contents),|),^))][setq(1,0)][setq(2,1)][iter(v(Dat_Contents),[switch(first(##,^),%q0,[setq(1,add(%q1,1))],%r[rjust(%q2,2)][setq(2,add(%q2,1))]> \[#[rjust(rest(%q9,#),5)]\] %q0 [switch(%q1,1,,(%q1))][setq(1,1)][setq(0,first(##,^))][setq(9,rest(##,^))])],|)]
&FN_SORT_CONTENTS Fortiva's Luggage Case=[set(me,Dat_Contents:[trim(sort(edit(iter(lcon(me),[name(##)]^##|),|%b,|),a,|),,|)]|Dummy Item^#0)]
&HASKEY Fortiva's Luggage Case=[member(v(Keys),%#)]
&IDESCRIBE Fortiva's Luggage Case=You are packed inside a cramped luggage case. The air inside here is stuffy and stale, but provides barely enough ventilation for someone to stay alive.
@set Fortiva's Luggage Case/IDESCRIBE=no_command
&INPREFIX Fortiva's Luggage Case=From outside the case,
@set Fortiva's Luggage Case/INPREFIX=no_command
&KEYS Fortiva's Luggage Case=
&LEAVE Fortiva's Luggage Case=You climb out of the [name(me)].
@set Fortiva's Luggage Case/LEAVE=no_command
&ODROP Fortiva's Luggage Case=drops [name(me)].
@set Fortiva's Luggage Case/ODROP=no_command
&OENTER Fortiva's Luggage Case=climbs into the [name(me)].
@set Fortiva's Luggage Case/OENTER=no_command
&OLEAVE Fortiva's Luggage Case=climbs out of the [name(me)].
@set Fortiva's Luggage Case/OLEAVE=no_command
&OSUCCESS Fortiva's Luggage Case=takes [name(me)].
@set Fortiva's Luggage Case/OSUCCESS=no_command
&OUSE Fortiva's Luggage Case=examines [name(me)] closely.
@set Fortiva's Luggage Case/OUSE=no_command
&PDESC Fortiva's Luggage Case=A plain brown compact luggage case. It has a pair of wheels on the bottom, giving the option of wheeling the case rather than carrying it.
&SETUP Fortiva's Luggage Case=@switch [parent(me)]=#-1,, {@va me;@va me=[v(va)];&Keys me;&Keys me=[remove(v(Keys),%#)] %#;@set me=MONITOR;@set me=OPAQUE;think [u(Fn_Sort_Contents)]}
&SUCCESS Fortiva's Luggage Case=You get [name(me)].
@set Fortiva's Luggage Case/SUCCESS=no_command
&USE Fortiva's Luggage Case=[repeat(-,79)]%rcopen%t%t%t- Opens the case%rcclose%t%t%t- Closes the case%rget case's <item>%t- Takes <item> from the case%rcunload <fullname>%t- Unloads <item> from the case (specify full name)%rcwield/creload/cgrab/%rcwear <item>%t%t- Unloads <item> and uses it%rgive case=<item>%t- Puts <item> inside the case%rcload <fullname>%t- Loads <item> into the case (no weapons)%r[repeat(-,79)]
@set Fortiva's Luggage Case/USE=no_command
&VA Fortiva's Luggage Case=^* gave you *.:@lemit %0 puts %1 in [name(me)].
@fo me=&KEYS [num(Fortiva's Luggage Case)]=%#
@wait 1={think You may add a list of player dbrefs to the KEYS attribute to control who is allowed to open this luggage case.}
@wait 1={use Fortiva's Luggage Case}