[CODE] Intresting Function

From: Kevin (geosly@DCN.DAVIS.CA.US)
Date: 06/21/98


Hello List-
An idea popped into my head for a bit of cool code. I'm not an advanced
programer but I know enough to write without parse errors *laugh* sometimes
anyways.
Well here's what' shanging me up... I made it so the mud asks the player a
question that invokes a yes/no responce (or y or n).
Well I made the Con_statement and loaded it in interpreter so i could pull
the player out of the con_playing.
And i made the switch statement to check the argument. I get however a few
errors. Think you could look at this code and help me out. Part of my
problem i think is that I'm using ch, and vict in an area I can't use them.
When only descriptor and argument are set up. But anyway here is my code.
And a few of the errors my compiler spit out.
------SNIP----------- interpreter.c

  case CON_SEDIT:
    sedit_parse(d, arg);
    break;
  /*. End of OLC states .*/

  case CON_AUTOMESSAGE: /* <---------the code i added is here */
switch (*arg) {
    case 'y':
    case 'Y':
    STATE(d) = CON_PLAYING;
     automsg_this_person(ch, vict);
      break;
    case 'n':
    case 'N':
     return;
      break;
    default:
      SEND_TO_Q("Invalid choice!\r\nDo you wish to send an
auto-msg?\r\nType: (Y)es (N)o: ", d);
      break;
    }
    return;
 }

    STATE(d) = CON_PLAYING;
}

  case CON_GET_NAME:            /* wait for input of name */

-----------End Snip-----
Errors:
interpreter.c: In function `nanny':
interpreter.c:1526: warning: implicit declaration of function `automsg_this_pers
on'
interpreter.c:1526: `ch' undeclared (first use this function)
interpreter.c:1526: (Each undeclared identifier is reported only onc
[Interrupt Process]
900: parse error before `->'
interpreter.c:1900: conflicting types for `read_aliases'
interpreter.c:59: previous declaration of `read_aliases'
interpreter.c:1900: warning: data definition has no type or storage class

...lot more errors but probably all because of that little bit of code
hanging it at the top.


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