Re: Nanny, moving back one con state?

From: Artovil (
Date: 07/12/02

At 14:00 2002-07-12 +0000, you wrote:
>On Fri, Jul 12, 2002 at 05:41:06AM -0700, Mathew Earle Reuther wrote:
> > I'd like to go ahead and allow myself the opportunity to move from one con
> > state back to the previous one.  Particularly for folks to move backwards
> > out of race to sex, and out of class back to race.  I'm having trouble
> > getting this to happen as parse_race and parse_class require returning a
> > value.
>[specifics snipped for brevity]
>There is no "move forward" or "back up" with con states. They are
>not in any particular linear order as far as the code is concerned.
>When exiting any state in the nanny you can proceed to any other you
>want simply bu altering the end of its case block. Just put a
>conditional at the end to check the value of the previous input. If
>it was your "back up" choice then re-print the text for the previous
>state and switch to it. If it was anything else print the text for
>the next con state and switch to it. Look at the character name
>verification portion of the nanny to see similar code in action.
>Now if you want to be clean about it you may need to move more of
>the inline string constants to a header file so you don't have to
>duplicate them within nanny. And if you really are careful to put
>your states in numerical order you might consider incrementing and
>decrementing. Of course this *will* mostly relegate you to a linear
>step in either direction during the character creation sequence, but
>it will also help organize your otherwise convoluted nanny.

Or, make all printing of menus/prompts into functions that are called on
each CON_x case in nanny, and then just make a function that takes an
argument like: "race" and then returns the proper CON_x state you need, and
then you can just return after that and the proper CON_x state will display.


   | FAQ: |
   | Archives: |
   | Newbie List:   |

This archive was generated by hypermail 2b30 : 06/25/03 PDT