@q
@program oocsay.muf
1 9999 d
i

( oocsay.muf    v1.0    Jessy @ FurryMUCK    7/99
  
  A simple say program that inserts a configurable string to indicate
  the statement is made OOC. There is a companion program, oocpose.muf,
  to handle OOC poses.
  
  INSTALLATION:
  
  Link a global action to the program. No macros or libraries are
  required.
  
  CONFIGURATION:
  
  A wizard or the owner of the program may set either a prefix, insert,
  or suffix that indicates a statement is OOC, by setting props
  _prefix, _insert, or _suffix on the trigger. The default is a suffix
  of [OOC].
  
  EXAMPLES:
  
  @set osay=_prefix:<<OOC>>
  osay Hiya!
  <<OOC>> You say, "Hiya!"
  <<OOC>> Jessy says, "Hiya!"
  
  @set osay=_insert:<<OOC>>
  osay Hiya!
  You <<OOC>> say, "Hiya!"
  Jessy <<OOC>> says, "Hiya!"
  
  @set osay=_suffix:<<OOC>>
  osay "Hiya!"
  You say, "Hiya!" <<OOC>>
  Jessy says, "Hiya!" <<OOC>>
  
  USAGE:
  
  Type the command name followed by a message string to make an OOC
  statement.
  
  This program may be freely ported. Please comment any changes.
)
 
(2345678901234567890123456789012345678901234567890123456789012345678901)
 
$define tell me @ swap notify $enddef
 
lvar ourText                          (* str: original message string *)
lvar ourTell             (* str: message formatted to display to user *)
lvar ourOTell  (* str: message formatted to display to others in room *)
lvar ourSet           (* bool: true if a configured OOC string is set *)
 
: DoHelp  (  --  )                             (* display help screen *)
  
  " " tell
  "oocsay.muf (#" prog intostr strcat ")" strcat tell " " tell
  
  "A simple tell program that inserts a string to indicate that "
  "statements are made Out Of Character." strcat tell " " tell
  
  "SYNTAX: " command @ strcat " <message>" strcat tell " " tell
  
  "CONFIGURATION: Wizards or the owner of the trigger action may "
  "set a prefix, insert, or suffix string that indicates statements "
  "are made OOC. Prefixes are put before the message string; inserts "
  "appear immediately after the speaker's name; suffixes follow the "
  "message string. Set prop _prefix, _insert, or _suffix, respectively, "
  "on the trigger to configure these. The default is a suffix of [OOC]."
  strcat strcat strcat strcat strcat tell
;
 
: main
  
  "me" match me !                          (* block identity spoofing *)
  
  dup if
    "#help" over stringpfx if
      DoHelp exit
    then
    ourText !
  else                                  (* bail out for null messages *)
    exit
  then
  
  trig "_prefix" getpropstr dup if     (* insert prefix if configured *)
    dup
    " " strcat ourTell  !
    " " strcat ourOTell !
    1 ourSet !
  else
    pop "" "" ourTell ! ourOTell !
  then
  
  ourTell  @ "You " strcat ourTell !         (* insert name and 'You' *)
  ourOTell @ me @ name strcat " " strcat ourOTell ! 
  
  trig "_insert" getpropstr dup if     (* insert suffix if configured *)
    dup
    ourTell  @ swap strcat "say, \""  strcat ourTell  !
    ourOTell @ swap strcat "says, \"" strcat ourOTell !
    1 ourSet !
  else
    pop
    ourTell  @ "say, \""  strcat ourTell  !
    ourOTell @ "says, \"" strcat ourOTell !
  then
                                            (* insert trailing quote *)
  ourTell  @ ourText @ strcat "\"" strcat ourTell  !
  ourOTell @ ourText @ strcat "\"" strcat ourOTell !
  
  trig "_suffix" getpropstr dup if    (* insert suffix if configured *)
    dup
    ourTell  @ " " strcat swap strcat ourTell  !
    ourOTell @ " " strcat swap strcat ourOTell !
    1 ourSet !
  else
    pop
  then
  
       (* insert default indicatore string if nothing was configured *)
  ourSet @ not if
    ourTell  @ " [OOC]" strcat ourTell  !
    ourOTell @ " [OOC]" strcat ourOTell !
  then
  
  me @ ourTell @ notify                           (* display to user *)
                                        (* display to others in room *)
  me @ location me @ ourOTell @ notify_except
;
.
c
q