Re: A motd/imotd online editor

From: Rasdan (rasdan@PEAK.ORG)
Date: 12/16/97


At 10:53 pm 12/15/97 -0600, you wrote:
>Ok, this command code doesn't even get to the send_to_char call to send the
>text to the player(like you didnt know what that did!).  Anyone have any
>idea why?
>
>ACMD(do_edit_motd)
>{
>  char motd = "text/motd";
>  int i = TRUE;
>  FILE *f;
>  char buf2[100];
>
>  f = fopen(motd,"w");
>  send_to_char("Enter a new MOTD below:\r\n", ch);
>    while(i != FALSE) {
>       send_to_char("] ", ch);
>       fgets(buf2);
>   if(buf2 == "/s")
>      i = FALSE;
>   else
>      fprintf(f, "%s\r\n", buf2);
>  }
> fclose(f);
>}
>
>Chuck
>

You need to include a CON_ state or it will always lock up the mud
while the player is editing the motd. You never want to pass total
control of the mud into one function. Always use connection states.
Granted, it takes quite a bit more of coding, but it's the only thing
to do in a mud.

Rasdan
                                  /   \
        _                 )      ((   ))     (
       (@)               /|\      ))_((     /|\                 _
       |-|`\            / | \    (/\|/\)   / | \               (@)
       | | ------------/--|-voV---\`|'/--Vov-|--\--------------|-|
       |-|                  '^`   (o o)  '^`                   | |
       | |  James C. Thomas Jr.   `\Y/'  Founder of Finality   |-|
       |-|                 rasdan@finality.com                 | |
       | |                  finality.com 4000                  |-|
       |_|_____________________________________________________| |
       (@)       l   /\ /         ( (       \ /\   l         `\|-|
                 l /   V           \ \       V   \ l           (@)
                 l/                _) )_          \I
                                   `\ /'
                                     `


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