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