Home   Help Search Login Register  

Author Topic: stop script?  (Read 562 times)

0 Members and 1 Guest are viewing this topic.

FFAK

  • Guest
stop script?
« on: 17 Dec 2002, 14:47:35 »
How can I set up a trigger to stop a running script? (in init field...)

thanx!

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:stop script?
« Reply #1 on: 17 Dec 2002, 19:29:18 »
I assume you mean that you have a script that continuously loops, and you want a trigger, when activated, to make the script exit.  That's fortunately easy to do.

Somewhere in your script, preferably at the beginning or end (but within the looping code), put the following code:

? StopScript : exit

Then, in your trigger's On Activation field, put the following code:

StopScript = true

Just for good coding practices, in your init.sqs script, put the following code:

StopScript = false

(This initializes the variable, and gives it a default value of false.)

Simply, the code in your script checks if the StopScript variable is true.  If it is, then it causes the script to exit (stop).  Otherwise, it continues.

That'll do it!  Good luck.
Ranger