@q
@program doexits.muf
1 9999 d
i
( doexits.muf    v1.0    Jessy @ FurryMUCK    10/99
   
  A builder's utility that cycles through exits on a room, and prompts
  for the standard message props that still need set: @desc, @succ,
  @osucc, @fail, @ofail, and @odrop.
  
  INSTALLATION:
  
  Set doexits.muf to Mucker Level 2 and create a global action with a
  name such as @doexits. Doexits.muf requires lib-mucktools.
  
  USE:
  
  Type command names and follow prompts.
  
  Doexits.muf may be freely ported. Please comment any changes.
)
  
$include $lib/mucktools
 
$define Tell me @ swap notify $enddef
  
: DoHelp  (  --  )                                (* show help screen *)
 
  " " Tell
  prog name " (#" strcat prog atoi intostr strcat ")" strcat Tell
  " " Tell
  
  "This utility lets you set the message props on all the message "
  "properties on the exits from in a room from a prompt-driven "
  "interface, which cuts down on typing and ensures that all "
  "exits are checked." strcat strcat strcat Tell " " Tell
  
  "Usage:  " command @ strcat " " strcat Tell " " Tell
  
  "You may talk and pose while at a prompt." Tell
;
 
: GetMainName  ( d -- s )    (* return name of d, stripped of aliases *)
  
  name dup ";" instr if
    dup ";" instr strcut pop strip  
  then
;
 
: main
  
  "me" match me !                                 (* check permission *)
  dup if
    "#help" over stringpfx if DoHelp exit then  (* check: wants help? *)
  then
  me @ loc @ controls if
    loc @ exits
    ">>  NOTE: At any prompt, enter .s to skip the exit completely."
    Tell
    begin                                  (* begin exit-finding loop *)
      dup while
      dup getlink dup if      (* skip commands; check room links only *)
        room? not if
    next continue
  then
      else
        ">>  NOTE: " over GetMainName strcat
        " is an unlinked exit." strcat Tell pop
      then
      dup "_/de" getpropstr not if                         (* do desc *)
        ">>  What is the @desc for "
        over GetMainName strcat "?" strcat Tell
        ">> [Enter string, or .n for `none', or .q to quit]" Tell
        ReadLine strip QCheck
        dup ".s" smatch if pop next continue then
        dup ".n" smatch if
          pop
        else
          over "_/de" rot setprop
        then
      then
      
      dup "_/sc" getpropstr not if                         (* do succ *)
        ">>  What is the @succ for "
        over GetMainName strcat "?" strcat Tell
        ">> [Enter string, or .n for `none', or .q to quit]" Tell
        ReadLine strip QCheck
        dup ".s" smatch if pop next continue then
        dup ".n" smatch if
          pop
        else
          over "_/sc" rot setprop
        then
      then
      
      dup "_/osc" getpropstr not if                       (* do osucc *)
        ">>  What is the @osucc for "
        over GetMainName strcat "?" strcat Tell
        ">> [Enter string, or .n for `none', or .q to quit]" Tell
        ReadLine strip QCheck
        dup ".s" smatch if pop next continue then
        dup ".n" smatch if
          pop
        else
          over "_/osc" rot setprop
        then
      then
      
      dup "_/odr" getpropstr not if                       (* do odrop *)
        ">>  What is the @odrop for "
        over GetMainName strcat "?" strcat Tell
        ">> [Enter string, or .n for `none', or .q to quit]" Tell
        ReadLine strip QCheck
        dup ".s" smatch if pop next continue then
        dup ".n" smatch if
          pop
        else
          over "_/odr" rot setprop
        then
      then
      
      dup "_/fl" getpropstr not if                         (* do fail *)
        ">>  What is the @fail for "
        over GetMainName strcat "?" strcat Tell
        ">> [Enter string, or .n for `none', or .q to quit]" Tell
        ReadLine strip QCheck
        dup ".s" smatch if pop next continue then
        dup ".n" smatch if
          pop 
        else
          over "_/fl" rot setprop
        then
      then
      
      dup "_/ofl" getpropstr not if                       (* do ofail *)
        ">>  What is the @ofail for "
        over GetMainName strcat "?" strcat Tell
        ">> [Enter string, or .n for `none', or .q to quit]" Tell
        ReadLine strip QCheck
        dup ".s" smatch if pop next continue then
        dup ".n" smatch if
          pop
        else
          over "_/ofl" rot setprop
        then
      then
      
      next                                           (* get next exit *)
    repeat                                   (* end exit-finding loop *)
    pop
    ">>  Done." Tell
  else
    ">>  Permission denied." Tell exit
  then
;
.
c
q