Re: [Code] Arguments in Wait State

From: Daniel Koepke (dkoepke@CALIFORNIA.COM)
Date: 10/02/97


On Wed, 1 Oct 1997, Aaron Miller wrote:

-+Thanks to everyone who helped me out on the last thing. It was a very
-+stupid error of mine that was causing it not to work :( Fixed now, tho
-+
-+Now, I added a new "wait state" to interpreter.c, and I have it working
-+great. Now, heres my question. How can I get the arguments from *arg?
-+Heres what I am doing with the wait state..

The one_argument() function takes a full string, splits off the first
word; and returns the remaining string after it.  The first word is
"returned" in the second variable.  For instance, this:

  char arg[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
  argument = one_argument(argument, arg);
  argument = one_argument(argument, arg2);
  sprintf(buf, "Arg==%s, Arg2==%s\r\nRemainder: %s\r\n", arg, arg2, argument);
  send_to_char(buf, ch);

with argument=="jack jumped over the", would output:

  Arg==jack, Arg2==jumped
  Remainder:  over the

(note the extra space in Remainder; this is because the spaces aren't
stripped from before argument, so the string is, " over the"; to
strip the spaces use skip_spaces(&argument);).

-+This will work, but when I check str_att later (in the same wait state,
-+btw) it will be at its original value. I tried return str_att; but the
-+compiler didn't like that. Thanks everyone.

Well, if the person leaves the wait state, then they also leave the
nanny() function.  When they leave the nanny() function, all the
local variables expire...Solution would be to put the variable in the
person's structure...:)


--
Daniel Koepke -:- dkoepke@california.com -:-  [Shadowlord/Nether]
Think.


     +------------------------------------------------------------+
     | 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/08/00 PST