Must-Have Mux Functions?


  • Coder

    Both @Chime and I share a love-hate relationship with Mux Code these days, but she keeps going back to make possible changes to the server to make it more usable, and I keep doing softcode bits for it. Right now my medium-term project with this is bringing the core SGP install up to date.

    With that, I present a list of what I have put in as mandatory functions. Input or additions welcome.

    (The addition I don't have here and am waffling on is ictime(). Seems like something that would belong to a different system.)

    • isstaff(): Not just 'is staff?' but levels for 'wizard' and 'admin/royalty' too.
    • header()/footer()/divider()/wheader()/etc.
    • msg(): Instead of having multiple ways of formatting '<game> message', we should have one
    • titlestr(): Makes Text Look a Lot Like This
    • lmax()/lmin(): max/min with a delimiter
    • isic(): for a different system?
    • shortdesc(): for a different system?
    • vcolumns()/vtable(): Chime and my vertical-column-output code
    • crumple(): trim() + squish(), I use this a lot
    • plural()
    • say(): simple way to format input into say/pose/emit output
    • lpmatch(): list-pmatch
    • width(): a replacement to built-in width() that uses a user-definable '&width' attribute

  • Coder

    Regarding lpmatch, does mux not have namelist()?


  • Coder

    It does not.


  • Coder

    For IC vs OOC time, I'd recommend using the code I wrote for DarkSpires there.

    QUIT
    @va me=#230
    -
    @wipe %va
    -
    
    @name %va=Time Commands
    -
    
    &conf_ic_ratio %va=1.5
    -
    
    &conf_ooc_launch %va=Tue Jan 01 00:00:00 2013
    -
    
    &conf_ic_launch %va=Tue Jan 01 00:00:00 2002
    -
    
    &fn_offset %va=
      sub( 
        convtime( get( #230/conf_ooc_launch ), utc ), 
        convtime( get( #230/conf_ic_launch ), utc ))
    -
    
    &gfn_ictimeof %va=
      add( 
        mul( 
          sub( %0, convtime( get( #230/conf_ooc_launch ), utc )),
          get( #230/conf_ic_ratio )),
        convtime( get( #230/conf_ic_launch ), utc ))
    -
    
    &gfn_ooctimeof %va=
      add( 
        trunc( fdiget( #230/
          sub( %0, convtime( get( #230/conf_ic_launch ), utc )),
          get( #230/conf_ic_ratio ))),
        convtime( get( #230/conf_ooc_launch ), utc ))
    -
    
    &gfn_icsecs %va=ictimeof( secs() )
    -
    
    &cmd_time %va=$+time:
    @pemit %#=
      strcat( 
        header( +time )%r, 
        OOC Time:%b, convsecs( secs(), utc ) UTC.%r,
        %bIC Time:%b, convsecs( icsecs(), utc ) UTC.%r,
        %rEventually cool moon and weather stuff will go here.%r,
        %rRemember that this game runs on loose-IC time%;%b,
        feel free to RP with an IC time-setting near the IC time listed above.%r,
        footer())
    -
    

    isstaff() et all

    These should probably change into a more general purpose group membership test system, but in the absence of consensus, isstaff() is a pretty good simple answer. Given more time/energy/giveadamn, I'd recommend something like

    hasrole( dbref, rolename )

    were rolename might be staff, etc.

    header() ...

    I regret the existence of wheader() as a separate things. Most newer games using my base code just have header() and it is wide. That looks bad with certain older crufty mushcode. It might be good to have a more general api for visual-form construction, but header/divider/footer is the basic minimum.

    msg() ...

    Yes.

    titlestr()

    I know you're proud of how very clever it is, but... is it really used that much?

    lmax/lmin()

    Brazil added hardcode for these in the 2.12 tree in January. Otherwise yes.

    isic()

    Hmmmmmm. I want to say that a more general concept of "situational context" should be articulated here, but isic is reasonable.

    shortdesc()

    is an approach to permissions. Really it should just be @attribute short-desc=visual or something, but people never seem to remember that.

    vcolumns()/vtable()

    Yeah.

    crumple()

    Never heard of it, but sounds handy.

    plural()

    Only if it is per-object overridable, like MOOs tend to do.

    say()

    Yes!

    lpmatch()

    How is this different than iter( ...,pmatch(%i0))?

    width()

    Hrm. Yeah, I guess. Might be wise to call it uwidth() or the like. Along these lines it might also be good to have header/divider/footer take an optional width argument, so that they can be used in the construction of more complex form combinators.


  • Coder

    @Chime said:

    header() ...
    I regret the existence of wheader() as a separate things.

    And so, my header is really:

    • header( <text>[, <width>] )

    And:

    • wheader( <text>) -> header( <text>, width( %# ))

    TAH-DAH!

    More comments and replies later.


Log in to reply
 

Looks like your connection to MU Soapbox was lost, please wait while we try to reconnect.