Re: [CODE] Adding/removing pfile flags?

From: Dana Luther (dtluther@mindspring.com)
Date: 10/16/00


-----Original Message-----
From: Adam Scriven <scriven@LORE.COM>
---snip---

>Hey all.
>
>I've added the ASCII pfiles, and they seem to be OK (some wierd crashing,
>but I don't think that's the ASCII pfile stuff), but I wanted to change the
>player structure, to add a flag (boolean) that says whether they've been
>told they can level or not (took out auto-level).
>
>I removed the autolevelling code, and added in a spec_proc called Level
>that I've assigned to a mob, so you can only level at the mob.  In place of
the
>old level code, I've added a line "You feel more powerful.", which means
you
>can level.  The problem is, that line is displayed every time you get more
>exp (before you advance yourself).  I'd like to set a flag SHOWN_MESSAGE
>or something, so that it knows not to show the message more than once, even
>if the person quits before they level.
---snip---

This is mailer snippet, so double check your syntaxes, don't copy/paste

Instead of adding something to the player struct, why not add another PLR_X
flag?
In structs.h, where all the other PLR_X flags are listed, add
#define PLR_SHOWN_CANLEVEL  23   /* this should not be 23, it should be
whatever your highest PLR flag is plus 1)

before showing them the message check for the flag with a quick
if ( /*whatever your criteria for level meesage*/ &&  !PLR_FLAGGED(ch,
PLR_SHOWN_CANLEVEL)
  ... show message here....
  /* Set the message flag */
  SET_BIT(PLR_FLAGS(ch), PLR_SHOWN_CANLEVEL);

and when they do their level at the mob,
REMOVE_BIT(PLR_FLAGS(ch), PLR_SHOWN_CANLEVEL);

That's it, hope it helps,

Dana


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