Re: Code question re: AFK ADDENDUM

From: Cervo (chrisf@PTD.NET)
Date: 08/31/98


Oops, sorry just realized the error said do_tell, i'm still asleep.
Anyway use one_argument or half chop, or something like that on the
variable argument, then locate the character via get_char_vis and make
some sort of check.  get_char_vis(struct char_data*, char *)  I just put
the type of argument it takes, but the char_data* argument, usually ch
runs the checks of if that person can see you, char * is a string, usually
the name of the character, so that is how you locate a player.  It returns
a char_data pointer, usually vict, and it returns NULL if nothing is
found.  Therefore

int argLength = strlen(argument);
char arg1[argLength] = '\0', arg2 [argLength] = '\0';

half_chop(argument, arg1, arg2);
if (*arg1 = '\0' || *arg2 = '\0') {
  send_to_char("Who was that again?  And what was that message?\r\n", ch );
  return;
}
if ((vict = get_char_vis(ch, arg1)) == NULL) {
  send_to_char("Tell who?\r\n", ch );
  return;
}
then after all of your afk checks and stuff you can
perform_tell(ch, vict, arg2);

because you type "tell cervo hello"
argument will hold "cervo hello"
half_chopping it will make arg1 hole "cervo" and arg2 hold "hello", even
for "tell cervo bleh blah hmm this is boring!" after a half chop arg1 will
hold "cervo", and arg2 will hold "bleh blah hmm this is boring!".  Those
are just a few of the checks that would have to be done.  I remember that
much being done by stock tell, but if it was ruined or destroyed somehow,
this should look something like it.  Wow am I tired :P  Well hopefully
something like it :P  Hopefully this will also give you an idea about what
you were doing wrong, and how do_tell works, and maybe even some C
insight, if not, remember my quote from last message about confusing em :P


Cervo the redoC retsaM


     +------------------------------------------------------------+
     | 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