[CODE] Advice with Mob Special

From: Ron Hensley (ron@cross.dmv.com)
Date: 02/01/97


Hello,

I need to implement a few mob specials that do something upon being given 
either money in some cases, or objects in other cases.

I do have mobprograms installed. however what needs to happen is more 
complex then what can be triggered VIA mobprograms. That is i need low 
level code to be executed.

That being said, I know, or 'think' mob specials get triggered basically 
whenever anyone types a command whithin a room with a mob. I know ive 
seen them catch what command was spoken using CMD_IS("string");

However im sitting here scratching my head how to tell the mobs just been 
given something, and to therefore take a look at whats been given it, 
money? how much? an object? what object?

Besides given SPECIALS assignment:
  #define SPECIAL(name) \
    int (name)(struct char_data *ch, void *me, int cmd, char *argument)   

IT doesnt appear the special is being passed anything. 
So I take it the special is called imediaely upon the player typing a 
command, thus before the actual transaction has been called.

Also upon looking at others, it seems when a typed command causes the 
special to be called, you return TRUE if you handled that command, so it 
wont be sent to the command parser, and FALSE if you did not handle it, 
and it was indeed a command that caused the SPECIAL to be called, thus 
letting the command parser handle calling some code to deal with what the 
player asked for.

Well i think im answering my own question here.
Id need to check:
  CMD_IS("give")
Split argument with two_arguments()
Check that the third argument is the mobs name, thus its the mob being 
given to, and then reproduce the do_give code, to have the player give 
the mob the obj, that being make sure he/she actually has the object and 
figure out exactly what object this is.

In the process i now know the exact objs vnum and can do my fancy 
footwork code to that object before giving it.

Likewise if cash was the given object, i could transfer the cash manually.

Then in either case, do my speical processing that happens when the 
correct item is given.

Well im definately answering my own questions here. Has anyone done tihs 
already? love to see an example of a special that checks for being given 
an object and takes action based on that.

Ramble Mode Off



    *******************************************************************
    *   Ron Hensley                     ron@dmv.com                   *
    *   Systems Administrator           http://www.dmv.com/~ron       *
    *                                   PGP Key at WWW Page           *
    *   DelMarVa OnLine                 749-7898 Ext. 403             *
    *******************************************************************

+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



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