@q @program tinysay.muf 1 99999 d i ( tinysay.muf v1.4 Jessy @ FurryMUCK 10/96 This is a small, easy-to-set up 'say' program. Rather than building elaborate functionality into the program itself, the _say/def/say and _say/def/osay props are parsed for MPI: players can set up their own filters, random says, etc., by including appropriate MPI in their say-verb settings. This version is compatible with most vehicle systems. Installation: Create a global action named say;" and link it to this program. TinySay requires Mucker level 3, for the PARSEPROP primitive. Use: "<message> Say something. say <message> Say something. say #def = <string> Set your 1st-person say verb. say #odef = <string> Set your 3rd-person say verb. say #filter = <string> Set your MPI say filter. Filter Examples: In the filter, the text of your comment is stored in the {&how} variable. To replace all occurances of 'l' with 'r', one would do the following: > say #filter {subst:{&how},l,r} Set. > "Hello, world! You say, "Herro, worrd!" Following standard MPI syntax, setting multiple filters would require that the filtering functions, such as {subst} above, be nested. For example, to replace all occurances of 'l' with 'r', and to replace all occurances of 'w' with 'mw', one would do the following: > say #filter {subst:{subst:{&how},l,r},w,mw} Set. > "Hello, world! You way, "Herro, mworrd!" TinySay.muf may be freely ported. Please comment any changes. ) $define Tell me @ swap notify $enddef : DoHelp ( -- ) (* show help screen *) " " Tell "TinySay.muf (#" prog intostr strcat ")" strcat Tell " " Tell " \"<message> .................. Say something" Tell " say <message> ............... Say something" Tell " say #def = <string> ......... Set your 1st-person say verb" Tell " say #odef = <string> ........ Set your 3rd-person say verb" Tell " say #filter = <string> ...... Set your MPI filter to <string>" Tell " " Tell "Your verb and filter definintions are stored in your _say/def/ " "directory. They definitions may include MPI. The 'say' runs before " "the 'osay'. Filter example: {subst:{&how},l,r} would cause you to " "say \"Herro, worrd!\" when you type \"say Hello, world!\"." strcat strcat strcat Tell " " Tell ; : DoDef ( s -- ) (* set the user's 1st-person say verb string *) dup "=" instr dup not if (* check syntax *) pop pop "Syntax: say #def = <string> (You forgot the '=')" Tell exit then strcut swap pop me @ "_say/def/say" rot strip setprop (* set it *) "Set." Tell ; : DoODef ( s -- ) (* set the user's 3rd-person say verb string *) dup "=" instr dup not if (* check syntax *) pop pop "Syntax: say #odef = <string> (You forgot the '=')" Tell exit then strcut swap pop me @ "_say/def/osay" rot strip setprop (* set it *) "Set." Tell ; : DoSetFilter ( -- ) (* set say filter *) dup " " instr if dup " " instr strcut swap pop strip me @ "_say/def/filter" rot setprop "Set." Tell else me @ "_say/def/filter" remove_prop "Filter removed." Tell then ; : main "me" match me ! dup not if (* check syntax *) DoHelp exit then dup "#*" smatch if (* route to other function? *) strip dup "#help" swap stringpfx if DoHelp exit else dup "#def*" smatch if DoDef exit else dup "#odef*" smatch if DoODef exit else dup "#filt*" smatch if DoSetFilter exit then then then then then (* parse and emit the say *) me @ "_say/def/filter" getpropstr if me @ "_say/def/filter" rot 0 parseprop then "You " me @ "_say/def/say" getpropstr if me @ "_say/def/say" over over getpropstr 0 parseprop strcat ", \"" else "say, \"" then strcat over strcat "\"" strcat Tell loc @ me @ dup name " " strcat over "_say/def/osay" getpropstr if over "_say/def/osay" over over getpropstr 0 parseprop strcat ", \"" else "says, \"" then strcat 4 rotate strcat "\"" strcat dup me @ location swap notify me @ location contents begin dup while dup me @ dbcmp not if dup 3 pick notify then next repeat begin depth while pop repeat ; . c q