Re: Various cool Problems !

From: Sean Daley (daley@IDT.NET)
Date: 09/02/97


Franco wrote:
>
> ----------
> > From: Rasdan <rasdan@PEAK.ORG>
> > To: CIRCLE@post.queensu.ca
> > Subject: Re:  Various cool Problems !
> > Date: Tuesday, September 02, 1997 2:34 PM
> >
> > > >> int counter;
> > > >> ~~~cut
> > > >> if (get_hit(ch) <50 && counter <1)
> > >    and here i load in the mob
> > > >> counter = 1;
> > > then i  set counter = 1 so it wont go into this if the next time ??
> > >
> > > >> Understand my thoughts ?! how do i make so that it only will jump
> into this
> > > >> if thingy once, ie only loads the mob once ??
> > > >>
> > > >Just make a char flag that is set when the mob is loaded, if this flag
> is
> > > >set, don't load:
> > >
> > > hmm, feels like stoopid to do a new flag for just this thing
> > > aint there a way to do the counter
> > > so if counter = 1 it wont do it ?
> >
> > No it won't, because each time the function is called, it will reset the
> > counter variable, can't have that. A char flag is the best way to do it,
> > and there are a lot of them. Besides, if you run out of them, you can
> > always add more. I have added 4 new sets of aff_flags, it's not hard. :)
> >
>   Hmm...heard of the keyword "static"? Will cure that problem real
> quick and then you can keep the resources of using a flag open.
>

Just make sure if you use static that you do something to reset the
counter back to 0 after the mob dies (assuming this is a mob since you
said a spec_proc?) or else only the first instance of the mob will
do what you want it to do...

Sean Daley
daley@mail.idt.net


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