Home   Help Search Login Register  

Author Topic: Pausing a Script  (Read 1213 times)

0 Members and 1 Guest are viewing this topic.

Offline domomo

  • Members
  • *
Pausing a Script
« on: 08 Sep 2007, 15:06:21 »
I am sorry if this is obvious, but i'd like to know how to pause a script at a certain point and when a trigger ingame is activated the script continues.

so i can avoid making countless scripts for everything :S

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re: Pausing a Script
« Reply #1 on: 08 Sep 2007, 15:16:35 »
Hm...is it sqs or sqf? Anyway, give you examples for both. Make your trigger to set a self defined variable to TRUE (my_variable = true). Then in a sqs script, enter this line:
Code: [Select]
@ my_variable
and in a sqf script, it's this line:
Code: [Select]
waituntil {_my_variable};

But you should think about ripping you script into pieces since a wait command doesn't really put a script to sleep (doin absolutely nothing) but checks a condition which is also "work".


Myke out

Offline domomo

  • Members
  • *
Re: Pausing a Script
« Reply #2 on: 08 Sep 2007, 15:27:11 »
so i should avoid this tactic?

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re: Pausing a Script
« Reply #3 on: 08 Sep 2007, 16:18:46 »
Not if you keep this in mind and take care that not too many scripts are suspendedd this way. A handful of scripts supended will not drop performance extremly, but if you encounter performance problems while creating your mission, this could be one point to free some ressources.

So, no, you don't have to avoid completely, but always have an eye on it.


Myke out

Offline domomo

  • Members
  • *
Re: Pausing a Script
« Reply #4 on: 08 Sep 2007, 17:03:56 »
thanks