Home   Help Search Login Register  

Author Topic: force-quitting a script elegantly...  (Read 434 times)

0 Members and 1 Guest are viewing this topic.

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
force-quitting a script elegantly...
« on: 24 Feb 2005, 23:59:09 »
is there a way to break out of a script already running, without having a variable checked every second line?

i'd like to avoid this kind of thing -

Code: [Select]
move camera to player

is it okay to continue?

display text

still okay to continue?

move camera to next character

we're continuing, right?

etc....

any nice and easy ways?

Captain Wacky

  • Guest
Re:force-quitting a script elegantly...
« Reply #1 on: 25 Feb 2005, 00:35:10 »
I'm not sure exactly what you want to achieve. Whether you want the script to quit because of a vast array of actions of just one? Or, how complicated the event that causes the script to quit will be? Or, whether you want this to just cover quitting a cutscene?

I'm going to assume it's to force quit a cutscene and I'm also making the assumption it's a simple event, you could create another smaller script, "scriptend.sqs", for example and run it from the player's init field. And, in it write something like:

; loop begins

#Loop

; wait 0.01 seconds

~0.01

; check if unit is still alive

? not alive unitname : GoTo "Next"

; reread code from loop

GoTo "Loop"

; continue reading code from next

#Next

; terminate the camera to stop cutscene

_cameraname cameraeffect ["terminate", "back"]
camdestroy _cameraname

; exit script

Exit

I'm not sure if that's any help, or if that's anything like what you wanted, though...
« Last Edit: 25 Feb 2005, 00:36:54 by Captain Wacky »

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:force-quitting a script elegantly...
« Reply #2 on: 25 Feb 2005, 00:42:49 »
m'kay, well just to clarify, the situation is pretty much as you've guessed: i have a cutscene running, and some other event triggers the end of the mission. the cutscene however keeps going, causing a very messy mess indeed.

i have the sinking feeling this is going to be a case of checking the end-of-mission variable before every command in those last cutscenes. tedious, but at least it'll stay tidy... unless anyone has some bright idea?