Re: Blackjacking and MOB awareness

From: Peter Ajamian (peter@pajamian.dhs.org)
Date: 09/17/00


Jason Pullara wrote:
>
> Soooo my next question is.. how might I go about setting a timer to
> eventually take the flag off?
>
Add a variable to struct char_data in structs.h of type time_t, then in
do_blackjack, set the variable to time(NULL) + (number of seconds you
want the flag to stay on).

> Could I just set a timer in 'heartbeat' to remove the flag after a certain
> amount of time?

Create a function which walks the player list and compares time(null) to
each player's timer (the one you just created) (use a >= comparision).
Then clear the flags of those players who pass the test.  Add this
function to heartbeat and call it every 5 or 10 seconds (the longer you
make this the less accurate the timer will be, but it will also lessen
CPU load).

Regards, Peter


     +------------------------------------------------------------+
     | 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/11/01 PDT