Re: CON_Q...

From: Russ Brown (russelltbrown@netzero.net)
Date: 07/05/00


>   I have implemented races and classes, and I have quite a lot of
>classes
>as well as races and I wanted to add a little menu function in
><interpreter.c> that outputs a text-string (one unique string for
>every
>race/class) and puts up a <y/n> prompt to let the user confirm if
>he/she
>wants the chosen class, if not, print the race/class menu again.
>

okay here is a few tips on how to implement what you have described,
in plain language no less.  interpreter.c is the right place to add what
you want, it is basically just a loop with a big switch statement in it and
each time through the loop it swtiches to a particular case statement
base on the state of connectedness (ie CON_QCLASS, etc). here is
a hopefully simple step by step guide.

1. add a new CON_xxx state for confirmation of race, I'll call it
CON_RACE_CONFIRM. ( I assume you have already added
CON_QRACE  or something similar.for chosing race.

2. Find the end of the CON_QRACE block, there should be a statement
near the end setting the state to whatever the next step in your character
creation process is. Change the assignment to set the state to your new
CON_RACE_CONFIRM, but note what the next state was.  change
the SEND_TO_Q statement to print your y/n statement with the name of
the race chosen.

3. Add a new case statement for CON_RACE_CONFIRM.  Read the input
from your y/n prompt (examine other case statements to see how) The case
block should contain a simple if then else statement .
If (input == y )   /* obviously psuedo code */
   put the original state assigment and SEND_TO_Q statements
   from the end of CON_QRACE here.
   Then break out of the case block.
else /* input was anything but y*/
  set the state to CON_QRACE
  use SEND_TO_Q to print your race menu again
  break out of case, on the next pass through the loop you can choose
 a new race

>------------------------------------------------------------------
>
>Its funny that this question should be brought up. I tried the same
>thing you are talking about, with no luck. Basically, I prompted for
>race first, then (depending on which race was selected) I sent a
>class menu to the descriptor. By making several class menus, it was
>easy to do, but the problem was that the player could still choose
>any class he/she wanted, regardless of whether or not it was on the
>menu that was sent to them. I then tried searching for the race, then


Here is what I did: (you chose race first then class on my mud)
1.  Declare a constant array of type bitvecter_t  (hey i have 22
classes) with an element for each race. Within the declaration
set the bit for each class allowed by that race:
(1 << CLASS_WARRIOR) | ( 1 << CLASS_BARBARIAN) | ...etc

2. instead of making a bunch of menus, write a function to interpret
the bitvector for the chosen race and only print the allowed classes.
If your players get clever and choose a value not allowed, just check
their selection against the bitvector and make them choose again
until the pick a valid class.


Bitvectiors, the circlemud coders best friend!
I hope this helps.

Russ Brown




_______________________________________________
Why pay for something you could get for free?
NetZero provides FREE Internet Access and Email
http://www.netzero.net/download/index.html


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 04/10/01 PDT