Jan 29, 2015, 3:32 AM

So I have an online editor for MU code that I've added to the menu (the document icon with the hover text Muxify). This will bring you to the editor in a new tab.

Usage:
def <alias> { <code> } - Simple preprocessor for code repetition or object replacement.
Ex:

def roller {
  #36
}
def alert {
  [ansi(hr, |, hw, %o, hr, |)]
}

To use in code wrap the def in colons:

&f.function :roller:=pemit(%1, :alert:)

Which will result in:

&f.function #36=pemit(%1, [ansi(hr, |, hw, %o, hr, |)])

Commenting - Use // before any comments to have them parsed when minified. Everything after // is commented out, so make sure no code follows it. Block commenting is also available as /* <multiline comments> */
Ex:

  // set initial total value
  [setq(t, ladd(%qf))] // here is okay too

or

/*
  this
  is
  a 
  multiline
  comment
*/

Keyboard Shortcuts - Supported, see the ACE editor list

Storage - Code can be saved locally or loaded in minified or expanded form.

Minification - As you code, the minified version will be filled in simultaneously. It should cover most cases to proper format.

Explode - This will take minified code and add whitespace to it in the left pane.

Finally, here is some example code you can copy/paste to the left pane to test it out:

/* Requires global function pluck: 
 * [setq(i, if(t(%2), %2, %b))][setq(o, if(t(%3), %3, %b))][extract(%0, match(%0, %1*, %qi), 1, %qi, %qo)]
 *
 * Requires global function alert:
 * [ansi(hr, |, hw, %b%0%b, hr, |)]
 *
 * For english stats, a fate stat object is needed, defined here with fss,
 * with the following format &d.skills fss=skill|skill|skill
 */

def fr {
  #36 // set to object dbref
}

def fss {
  #75 // dbref for stat system
}

&c.roll :fr:=$+roll *:ulocal(%!/f.parse, %#, %0)

&f.parse :fr:=
  // preformat roll string
  [setq(s, edit(%1, %b, , +, %b))]
  
  // set error register
  [setq(e,)]                       
  
  // set natural language register
  [setq(l,)]
  
  // fate dice
  [setq(f, lrand(-1, 1, 4))]
  
  // set initial total value
  [setq(t, ladd(%qf))]
  
  /* check if string token is a word and parse it, otherwise assume
   * it is a number and add to total
   */
  [iter( %qs, 
    if(isword(%i0), 
      setq(t, ladd(%qt [u(%!/f.get-dice, %0, %i0)])), 
      [setq(t, add(%qt, %i0))]
      [setq(l, %ql|%i0)]
    )
  )]
  
  // if error(s), display them, otherwise display successful roll
  [if( t(%qe), 
    u(%!/f.display.error, %0, trim(%qe, , |)), 
    u(%!/f.display.roll, %0, trim(%ql, , |), %qt, %qf)
  )]
  
&f.get-dice :fr:=
  /* get the skill from the stat object (used for default cases where the
   * skill exists but is not present on charbit)
   */
  [setq( 0, pluck( get(%va/d.skills), %1, |))]
  [if( t(%q0), 
    
    // get skill value from charbit or return 0
    [setq( 1, pluck( get(%0/_skills), %q0, |))]
    [if( t(%q1),
      trim(rest(%q1, :)),
      0
    )]
    
    // add to the language output
    [setq( l, %ql|[if(t(%q1), %q1, %q0)])], 
    
    // or add as an error
    setq(e, %qe|could not find '%1'.)
  )]
  
&f.display.roll :fr:=
  // send roll message to room
  remit(loc(%0), 
    [alert(+roll)]%b[name(%0)] rolls [u(%!/f.tr.dice, %3)] + 
    [iter(%1, if(t(rest(%i0,:)), [first(%i0,:)] %(+[rest(%i0,:)]%), %i0), |, %b+%b)]
    for a[case(%qt,1,n,7,n)] 
    [ansi(hw,[u(%!/f.tr.success, %qt)] %([if(gte(%qt,0), +%qt, %qt)]%))].)]
  )
  
&f.tr.dice :fr:=
  // make fate dice pretty
  edit(%0, -1, ansi(y, %[, hw, -, y, %]), 
    0, ansi(y, %[, hw, %b, y, %]), 
    1, ansi(y, %[, hw, +, y, %])) 
    
&f.tr.success :fr:=
  // provide english language values
  case(%0, -2, Terrible, -1, Poor, 0, Mediocre, 1, Average, 2, Fair, 
    3, Good, 4, Great, 5, Superb, 6, Fantastic, 7, Epic, 8, Legendary, Mythic)
  
&f.display.error :fr:=
  // display any errors to roller
  pemit(%0, [alert(+roll)] Errors: [itemize(%1, |)])

/* set the data object for skills list.  Alternatively add a d.skills
 * attribute to the roller and edit f.get-dice to use %! instead of %va
 */
@va :fr:=:fss: