Passing args to spells [Was: Re: [NEWBIE] [CODE] Locate Object]

From: Peter Ajamian (peter@pajamian.dhs.org)
Date: 11/01/00


Thomas Arp wrote:
>
> To solve this you will want to pass the argument of the spell to the
> spell function itself. Several solutions have been mentioned on the mailing
> list, and they can be found in the archives. One solution could be to
> simply pass the argument to all manual spells by redefining ASPELL:
>
Another solution would be to simply stash the entire command line into a
global for every command that is recieved and acted upon.  While this is
a hack of sorts it is also relatively simple and does not require making
changes to several different places in the code.  Simply define a
global, something like...

char command_line[MAX_INPUT_LENGTH];

Then just strcpy the command buffer to this global buffer in
command_interpreter before calling the ACMD.  You can then access and
parse out anything you want from any function in the entire MUD simply
by putting the following in...

extern command_line[];

Or even just stick it in a header file somewhere.

Regards, Peter


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 04/11/01 PDT