Re: Various cool Problems !

From: Uffe Svanstrom (ulfs@MAIL.KAREN.HKR.SE)
Date: 09/03/97


At 11:32 1997-09-03 -0400, you wrote:
>On Tue, 2 Sep 1997, Uffe Svanstrom wrote:
>
>> >> int counter;
>> >> ~~~cut
>> >> if (get_hit(ch) <50 && counter <1)
>>    and here i load in the mob
>> >> counter = 1;
>
>Use a static int, not an int. Static variables, maintain there values
>between invocations of the function
>
>static int counter=0;
>
>if (GET_HIT(ch) <50 && counter <1)
>>    and here i load in the mob
>> >> counter = 1;
>
>The first time the function is called counter is set to value 0.
>The second and all other times it is called, it is NOT initialized to 0.
>It instead, still has whatever value you left it in last time.
>
>For an example of this, see the code for the midgard mayor
>
Yeah, great now we are rocking ...
Just gonna se if i can manage to do it in the code !!

Wonna Thanx all who helped me ...(sofar)
i moght not get it to work :(

/Uffe


     +------------------------------------------------------------+
     | 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/08/00 PST