Difference between revisions of "User:Edith"
(Created page with "===== Temporary Places Code ===== This code provides temporary places code that you can put on an object and drop into a scene. It's useful for big events such as parties, cou...") |
|||
Line 15: | Line 15: | ||
@link Temporary Places=me | @link Temporary Places=me | ||
− | @desc Temporary Places=%rTEMPORARY PLACES HELP | + | @desc Temporary Places=%rTEMPORARY PLACES HELP%r%r[ljust(+pl,25)]Show available places%r[ljust(+pl/join <num>,25)]Join place <num>%r%r[ljust(+pl <say>,25)]Tabletalk say/pose/emit%r[ljust(+pl :<pose>,25)]%r[ljust(+pl \;<pose>,25)]%r[ljust(+pl |<emit>,25)]%r%r[ljust(+pl/leave,25)]Leave a place%r[ljust(+pl/depart,25)]%r%r[ljust(+pl/look <num>,25)]Look at a place's description%r[ljust(+pl/cleanup,25)]Manual cleanup of disconned/absent players%r%rOwner: use +pl/ownerhelp for owner only commands.%r |
&prefix Temporary Places=%ccTemp Places:%cn | &prefix Temporary Places=%ccTemp Places:%cn |
Latest revision as of 01:15, 11 February 2024
Temporary Places Code
This code provides temporary places code that you can put on an object and drop into a scene. It's useful for big events such as parties, courts, performances, duels, etc. Gossip with your character's friends while not spamming everyone or missing the main action! It's usable by anyone: you don't need wizard or staff permissions to make it work.
Just copy and paste all the code below to make your own object, and drop it in a room to use it. Look at the description for help.
A couple caveats: I've tested this, but testing it myself on my own server and handing it to actual players are two different things. I also suspect it's vulnerable to race conditions, but it's temporary places code so I'm not terribly concerned; if your table for four ends up with five players, I'm not sure it really matters.
All bug reports should go to Gabriela/Jess/Eithne in game.
Temporary Places Code - Expand Me!
@create Temporary Places
@link Temporary Places=me
@desc Temporary Places=%rTEMPORARY PLACES HELP%r%r[ljust(+pl,25)]Show available places%r[ljust(+pl/join <num>,25)]Join place <num>%r%r[ljust(+pl <say>,25)]Tabletalk say/pose/emit%r[ljust(+pl :<pose>,25)]%r[ljust(+pl \;<pose>,25)]%r[ljust(+pl |<emit>,25)]%r%r[ljust(+pl/leave,25)]Leave a place%r[ljust(+pl/depart,25)]%r%r[ljust(+pl/look <num>,25)]Look at a place's description%r[ljust(+pl/cleanup,25)]Manual cleanup of disconned/absent players%r%rOwner: use +pl/ownerhelp for owner only commands.%r
&prefix Temporary Places=%ccTemp Places:%cn
&fn_get.player.place Temporary Places=if(setr(+,iter(lattr(me/place_members.*),if(member(v(%i0),%0),[after(%i0,.)][ibreak()]), ,),num),%q<num>,0)
&fn_get.place.name Temporary Places=default(me/place_name.%0, place %0)
&fn_list.players Temporary Places=if(hasattr(me,place_members.%0),%r[wrap(Present: [iter(v(place_members.%0),name(%i0), ,[lit(,)]%b)],70,left,space(5))])
&cmd_places Temporary Places=$+pl:@include me/do_cleanup;@trigger me/do_places=%#
&do_places Temporary Places=@pemit %0=%r%cc[v(prefix)]%cn%r[iter(lattr(me/place_totalslots.*),%b%b[capstr(u(fn_get.place.name,setr(+,after(%i0,.),num)))] \(#%q<num>\) has [setr(+,sub(v(place_totalslots.%q<num>),words(v(place_members.%q<num>))),slots)] spot[if(neq(%q<slots>,1),s)] available[u(fn_list.players,%q<num>)], ,%r)]%r
&cmd_cleanup Temporary Places=$+pl/cleanup:@include me/do_cleanup
&do_cleanup Temporary Places=@dolist [lattr(me/place_members.*)]=@set/quiet me=##:[iter(v(##),if(cand(neq(conn(%i0),-1),strmatch(loc(me),loc(%i0))),%i0))]
&check_is.valid.place Temporary Places=@assert [hasattr(me/place_totalslots.%1)]=@pemit %0=[v(prefix)] That isn't a valid place.
&cmd_join Temporary Places=$+pl/join *:@include me/do_cleanup;@trigger me/do_join=%#,[trim(objeval(%#,%0))]
&do_join Temporary Places=@include me/check_is.valid.place=%0,%1;@switch/first 0=[not(u(fn_get.player.place,%0))],@pemit %0=[v(prefix)] You're already at a place!,[lt(words(v(place_members.%1)),v(place_totalslots.%1))],@pemit %0=[v(prefix)] [capstr(u(fn_get.place.name,%1))] is full.,{@emit [v(prefix)] [name(%0)] joins [u(fn_get.place.name,%1)].;@set/quiet me=place_members.%1:[setunion([v(place_members.%1)], %0)]}
&cmd_leave Temporary Places=$+pl/leave:@include me/do_cleanup;@trigger me/do_leave=%#
&cmd_depart Temporary Places=$+pl/depart:@include me/do_cleanup;@trigger me/do_leave=%#
&do_leave Temporary Places=@assert [setr(0,u(fn_get.player.place,%0),num)]=@pemit %0=[v(prefix)] You're not at a place!;@set/quiet me=place_members.%q<num>:[setdiff([v(place_members.%q<num>)], %0)];@emit [v(prefix)] [name(%0)] leaves [u(fn_get.place.name,%q<num>)].
&cmd_tabletalk Temporary Places=$+pl *:@include me/do_cleanup;@trigger me/do_tabletalk=%#,[objeval(%#,%0)]
&do_tabletalk Temporary Places=@assert [setr(+,u(fn_get.player.place,%0),num)]=@pemit %0=[v(prefix)] You're not at a place!;@pemit/list [v(place_members.%q<num>)]=At [u(fn_get.place.name,%q<num>)], [switch(left(%1,1),:,[name(%0)] [delete(%1,0,1)],\;,[name(%0)][delete(%1,0,1)],|,delete(%1,0,1),[name(%0)] says\, "%1")]
&cmd_look Temporary Places=$+pl/look *:@include me/do_cleanup;@trigger me/do_look=%#,[objeval(%#,%0)]
&do_look Temporary Places=@include me/check_is.valid.place=%0,%1;@pemit %0=%r[capstr(u(fn_get.place.name,%1))]%r[default(v(place_desc.%1),You see nothing special.)][u(fn_list.players,%1)]%r
&check_is.owner Temporary Places=@assert [eq(%0,owner(me))]=@pemit %0=[v(prefix)] Only the owner can do that.
&check_is.valid.slot.num Temporary Places=@assert [cand(isnum(%1),gt(%1,0))]=@pemit %0=[v(prefix)] That isn't a valid number of slots.
&cmd_wipe Temporary Places=$+pl/wipe:@include me/check_is.owner=%#;@wipe me/place_*;@pemit %#=[v(prefix)] All places wiped from [name(me)].
&cmd_create Temporary Places=$+pl/create *:@include me/check_is.owner=%#;@include me/check_is.valid.slot.num=%#,[setr(+,before(objeval(%#,%0),=),slots)];@set me=place_totalslots.[setr(+,inc(words(lattr(me/place_totalslots.*))),num)]:%q<slots>;@set me=place_name.%q<num>:[setr(+,after(objeval(%#,%0),=),name)];@pemit %#=[v(prefix)] You create [u(fn_get.place.name,%q<num>)] with %q<slots> slot[if(neq(%q<slots>,1),s)][if(%q<name>, as place %q<num>)].
&cmd_rename Temporary Places=$+pl/rename *:@include me/check_is.owner=%#;@include me/check_is.valid.place=%#,[setr(+,before(objeval(%#,%0),=),num)];@set me=place_name.%q<num>:[after(objeval(%#,%0),=)][setq(+,u(fn_get.place.name,%q<num>),oldname)];@pemit %#=[v(prefix)] You rename %q<oldname> to [u(fn_get.place.name,%q<num>)].
&cmd_slots Temporary Places=$+pl/slots *=*:@include me/check_is.owner=%#;@include me/check_is.valid.place=%#,[setr(+,objeval(%#,%0),num)];@include me/check_is.valid.slot.num=%#,[setr(+,objeval(%#,%1),slots)];@set me=place_totalslots.%q<num>:%q<slots>;@pemit %#=[v(prefix)] [capstr(u(fn_get.place.name,%q<num>))] now has %q<slots> slot[if(neq(%q<slots>,1),s)].
&cmd_desc Temporary Places=$+pl/desc *:@include me/check_is.owner=%#;@include me/check_is.valid.place=%#,[setr(+,before(objeval(%#,%0),=),num)];@set me=place_desc.%q<num>:[after(objeval(%#,%0),=)];@pemit %#=[v(prefix)] You redesc [u(fn_get.place.name,%q<num>)].
&cmd_delete Temporary Places=$+pl/delete *:@include me/check_is.owner=%#;@include me/check_is.valid.place=%#,[setr(+,objeval(%#,%0),num)];@include me/do_delete=%q<num>;@dolist [iter(lattr(me/place_totalslots.*),if(gt(after(%i0,.),%0),after(%i0,.)))]={@mvattr me=place_totalslots.##,place_totalslots.[dec(##)];@mvattr me=place_members.##,place_members.[dec(##)];@mvattr me=place_desc.##,place_desc.[dec(##)];@mvattr me=place_name.##,place_name.[dec(##)]};@pemit %#=[v(prefix)] You delete place %q<num>. All higher numbered places have been moved down.
&cmd_ownerhelp Temporary Places=$+pl/ownerhelp:@pemit %#=%rTEMPORARY PLACES OWNER COMMANDS%R%R[ljust(+pl/create <slots>,30)]Create a place with <slots>%r[ljust(+pl/create <slots>=<name>,30)]Create a place called <name> with <slots>%r%r[ljust(+pl/slots <num>=<slots>,30)]Change available slots in place <num>%r%r[ljust(+pl/rename <num>=<name>,30)]Rename <num> to <name>%r[ljust(+pl/rename <num>,30)]Clear the name of place <num>%r%r[ljust(+pl/desc <num>=<desc>,30)]Redesc place <num>%r[ljust(+pl/desc <num>,30)]Clear the desc of place <num>%r%r[ljust(+pl/delete <num>,30)]Delete <num> and move all higher numbered%r[ljust( ,30)]places down a number%r[ljust(+pl/wipe,30)]Wipe all places%r%r[ljust(&prefix [name(me)]=<prefix>,30)]Change the prefix added to error messages%r