Re: [Circle] [Newbie][Code]Nanny problems

From: Ron Hensley (
Date: 11/16/96


> 	//scanf ("%s", &answer);
> 	SEND_TO_Q("Yes/No ??:", d);
> 	printf ("Answer is %s\n", d);

Pardon me while I fall off my chair laughing.
scanf reads input from the keyboad attatched to the computer the mud is
running on.

> Now if i have the scanf, the the game hangs .. like it's waiting for
> something
Umm... some one to type something on the console and hit enter

> No if I add the SEN_TO_Q in .. the game runs, but doesn't wait for the
> user to type in some input (which should be the yes / no).
SEND_TO_Q sends output to a descriptor, it does not ask for input

and then you use printf() ?????? printf sends to the console on the
computer hte mud is running on.

To send to a player use:
  send_to_char("string to send", ch);

As to input, you cannot directly ask for input from a player. That is done
low level by hte mud itself in a nice tightly controlled loop.
Once the player has typed in a full line and hit enter, hte mud pushes
what the player typed in there descriptor.

Youre really gonna have to study the code on this one. Take a look at the
nanny() function in interpreter.c

If the player was asked a question that needs processing of htere answer,
you generally set a STATE on the player and a CASE statement in nanny() to
process there answer.

    *   Ron Hensley                              *
    *   Systems Administrator        *
    *                                   PGP Key at WWW Page           *
    *   DelMarVa OnLine                 749-7898 Ext. 403             *

| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   |

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