Last active
October 20, 2021 22:02
-
-
Save lcanady/31040f10aa3223cc4f111998225e98fd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| ############################################################################## | |
| Random @defines! | |
| This is a collection of shortcuts that I've found genereally handy | |
| while authoring MUX flavored MUSHcode. | |
| ############################################################################## | |
| */ | |
| @define @create (.*)=(\w+)(?:\,(.*))? { | |
| // @@create <name>=<alias> [,<flag list>] | |
| // Conditionally create new object. This is great for | |
| // global objects that you don't want to recreate with | |
| // every run of your code. | |
| // Personal pet peve. :3 | |
| @@ Conditional @create statement that doesn't build an object if it | |
| @@ already exists. Made via the @@create @define. | |
| @@ URL: https://github.com/digibear-io/mf-defines | |
| @@ @create $1 | |
| @@ Written with mush-format | |
| @if [not( isdbref( v( $2 )))] = { | |
| // Create our object | |
| @create $1; | |
| &$2 me=lastcreate( me, thing ); | |
| @set v( $2 ) = inherit safe $3; | |
| // If there's.a master room set, link our object to the | |
| // master room | |
| @if config( MASTER_ROOM ) = { | |
| @link v( $2 ) = [config( MASTER_ROOM )]; | |
| }; | |
| } | |
| } | |
| @define @dig (.*)\/(.*)(?:\,(.*))? { | |
| // Same as @@create but for Rooms | |
| // @@dig <room>/<alias>[,<flag list>] | |
| @@ Conditional @cdig statement that doesn't dig the room if it | |
| @@ already exists. Made via the @@dig @define. | |
| @@ URL: https://github.com/digibear-io/mf-defines | |
| @@ Written with mush-format | |
| @@ @dig $1 | |
| // if the room doesn't have a dbref, then dig a new room | |
| @if not( isdbref( setr( 0, search( name=$1 )) )) = { | |
| @dig $1; | |
| @if words($3) = { @aset %q0 = $3 }; | |
| &$2 me = lastcreate(me, room); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment