define(COMMENT, )
COMMENT(m4 definitions for TinyMUD loads)

changequote({,})

COMMENT(
make a type, args are maketype(var, name) or maketype(var, name, parent)
)
define(maketype, { 
 tell "Type: " $2 to me

 if !$1 then set $1 to create endif
 set $1.$aliases to $2
 set $1.$name to $2   ifelse($3,,, set $1.parent to $3)
 move $1 to me
})

COMMENT(
make an object: makeobj(var, name, parent)
)
define(makeobj, {
 tell "Object: " $2 to me

 if !$1 then set $1 to create endif
 set $1.$aliases to $2
 set $1.$name to $2
 set $1.parent to $3
 move $1 to me
})

COMMENT(
create a method: makemethod(type, verb, code)
)
define(makemethod, {
 tell "Method for " $1.$name ".&$2" to me

 set $1.&$2 to [$3]
})

COMMENT(
add a method alias: alias_method(type, alias, verb)
)
define(alias_method, {set $1.&$2 to $1.&$3})

COMMENT(
perform the usual object matching around a player: do_match(player, result)
)
define(do_match, { if $text = "here" then
  set $2 to $1.location
 elseif $text = "me" then
  set $2 to $1
 else 
  in $1.location matching $text do set $2 to next break end
  if ! $2 then in $1 matching $text do set $2 to next break end endif
 endif })

COMMENT(
Utility.
)
define(upcase,
 {translit($1,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ)})