Re: [DG SCRIPTS] [OBJECTS] Adding a new command

From: Daniel W. Burke (dwb@IX.NETCOM.COM)
Date: 10/09/98


On Fri, 9 Oct 1998, Phillip A. Ames wrote:

> OCMD(do_obj_value_setting)
> {
      char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
>     obj_data *object;
>
>     two_arguments(argument, arg1, arg2);
>
>     if (!arg1 || !arg2 || !is_number(arg1) || !is_number(arg2))
>     {
>         obj_log(obj, "osetval: bad syntax");
>         return;
>     }
          GET_OBJ_VAL(object, atoi(arg1)) = atoi(arg2);
> }
>

The lines without a > are the changed lines... that should work for you no
problem.  What you were doing was, you had arg1 and arg2 as int's instead of
strings... I know strings are what's passed to the command, but you have to
use atoi to turn them into an int so you can assign the values... your
program was probably crashing at the "two_arguments(" line...

Brazil


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



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