Re: [RFC] dynamically assigned spec procs

From: Sammy (samedi@DHC.NET)
Date: 08/06/97

On Wed, 6 Aug 1997 angus@EDGIL.CCMAIL.COMPUSERVE.COM wrote:

>      ok... on to my real point - SPEC's
>      I was just mulling over in my head a way for builders to add a spec to
>      a mob without me having to add a spec_assign.  essentially, have the
>      assigns happen on the fly using and ESPEC parameter in the
>      mob/obj/world file. (would have to add espec code to the last two, but
>      hey, they need it)  I think it could be dynamic by doing something
>      like how interpreter.c does the command pointers:

THere was a discussion about this some time ago that mentioned some good
ideas and ooutlined a pretty good way to do it (might have even included
the code).  I think the basic idea is to set up an array that includes the
spec name and function pointer, which would allow you to add a new entry
in your room/obj/wld file with the function name.

>      I was trying to figure out how to allow builder to assign multiple
>      specs to one mob using the present system, but that will probably take
>      flags or a couple of different spec pointers,  like a fighting spec,
>      and a non fighting spec.  right now the only way to do it is how the
>      archipelego code handles moods and citizens,  the SPEC(citizen) calls
>      the mood code.  Any comments, questions?  (please direct flames to
>      root@localhost)

I think that was covered to.  The best way is probably a linked list of
function pointers.  You just have to watch for conflicts between various

Something I just added was a new function macro:

#define GREET_SPECIAL(name) \
   int(name)(struct char_data *ch, void *me, int dir)

I added a greet_fun to mobs, rooms, and objects.  In char_to_room, it
checks the room, then everything in it for a greet special.  The "dir"
argument is the direction the player is entering from, so you can have the
special ignore people who aren't coming in from that direction, or maybe
you want a mob that says one thing to people coming from one direction,
and something else to peopel moving the other way.  It's got potential for
entrance traps too.


     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

This archive was generated by hypermail 2b30 : 12/08/00 PST