[MUD-Dev] Re: MUD Design doc (long)

Travis Casey efindel at io.com
Fri Dec 18 21:20:54 CET 1998


On Friday, December 18, 1998, Mik Clarke wrote:
> Caliban Tiresias Darklock wrote:
>> From: Mik Clarke <mikclrk at ibm.net>

>> >      if (!object->can_you_be(CMD_SNIFFED))
>> >        send_to_char "It smells of nothing in particular."
>>
>> The usual smartass message I've seen is:
>>
>>   > smell foo
>>   Smells like foo.
>>
>> While this is cute the first few times you see it, especially when it
>> recognises the command and not the objects in the room ("smell teen spirit",
>> huhuhuhu that was cool), it gets boring rapidly. Same thing with default
>> messages in general.

> Well, fundamentally it's an error message: 'The target object does not
> support the verb "smell".'  That really mucks the SoD up though, so it
> gets replaced with an ingame message (sometimes of a margianlly humerous
> nature).

And, of course, a message of some sort is needed, so the user realizes
that his/her command actually made it through.  You can, though, build
a little more intelligence into the routine, and/or vary the messages.
For example:

cmd_smell(string what) {
  if (!(object = find_object(what, LOCAL))) {
    send_to_char("There is no %s here for you to smell.", object);
    return;
  }
  if (object->smell_me(player())) return;
  message = choose_random_string( ({
    "The %o smells pretty much like you'd expect it to.",
    "You sniff the %o, but don't smell anything unusual.",
    ...
  }) );
  send_to_char(message, object);
}

>> Intuitive action is not always correct. It may also be intuitive, if the
>> flower is in a room with a bonfire, to throw the flower into the bonfire.
>> Does it need a "burn" handler? A "throw" handler? What if the flower is not
>> in a room with a bonfire, but can conceivably be put into one? Should the
>> "burn" handler be on the flower, or the bonfire? Is it a good idea to use
>> inheritance for this, and give the generic MUDObject type all these
>> handlers? Wouldn't you get stupid things like trees and doors with "throw"
>> handlers? Who the hell throws a tree? (Caber throwing notwithstanding.)

> Well, that's why you need a good object hierarchy at the base.
> Consider:

>   Static Object
>     +--- Door
>     +--- Sign
>     +--- Plant
>     +--- Moving Object
>            +--- Weapon
>            +--- Armour

[snip]

> In such a hierarchy you would have different throw methods on Static
> Object (a don't be silly message), Moving Object (it gets thrown),
> Pouch (thrown and spills some contents), Container (maybe comes open and
> loses it's contents).

Another possibility, instead of giving every object a handler for the
action, is to be careful in how you define what the verb does if there
is no handler.  For example:

cmd_throw(string what) {
  flag = RANDOM_THROW;
  if (try_to_parse("OBJECT at OBJECT", object, target))
    flag = ATTACK;
  else if (try_to_parse("OBJECT to LIVING", object, target))
    flag = TOSS_TO;
  else if (!(object = find_object(what, INVENTORY))) {
    if (object = find_object(what, LOCAL)) {
      send_to_char("You'd have to pick up the %o first.", object);
      return;
    } else {
      send_to_char("There is no %s here.", what);
      return;
    }
  }
  if (object->throw_handler(object, target, flag) return;

  switch (flag) {
    case ATTACK:
      COMBAT_MODULE->attack(player, target, object, THROW);
      return;
    case TOSS_TO:
      if (!player()->skill_check(THROW, -(object->weight()))) {
        object->move_to(player()->environment());
        send_to_char("You miss %L badly.", target);
        return;
      }

 ... // I think that's enough for you all to get the idea.

}

--
       |\      _,,,---,,_        Travis S. Casey  <efindel at io.com>
 ZZzz  /,`.-'`'    -.  ;-;;,_   No one agrees with me.  Not even me.
      |,4-  ) )-,_..;\ (  `'-'
     '---''(_/--'  `-'\_)






More information about the mud-dev-archive mailing list