Page 1 of 1

deactivating scripts after running once

PostPosted: Mon Jun 27, 2011 8:56 pm
by mal99
I want to run two separate scripts initiated by 'mouse button down' events on the same actor. One script must run repeatedly, after each 'mouse button down', the other must run just once. So, I need a way to de-activate the run-once script after the first mouse button down.

Is there a simple way to do this?

I tried putting the whole script in a 'for loop' with a one cycle limit but, so far, this just succeeded in crashing the whole game.

Any ideas would be much appreciated.

Thanks

Re: deactivating scripts after running once

PostPosted: Mon Jun 27, 2011 9:01 pm
by foleyjo
When I do something like this I use an integer Variable called ACTIVE

So when you want to start the script make a statement saying script.ACTIVE = 1;

In the script itself start with

If (ACTIVE){

and at the end of the if put
ACTIVE = 0;}

I assume you are doing this in the Draw Actor event otherwise you could do an On Mouse Click action and not repeat