Problems with StopScript function

Post » Thu Apr 02, 2015 8:33 am

Hello,

I have a problem with StopScript function. This is my script:

Begin myscriptshort doOnceMessageBox "Script 1 is running"if ( doOnce == 0 )	if ( GetJournalIndex A2_2_6thHouse >= 50 )		MessageBox "Executed stage 1"		set doOnce to 1	endif	returnelseif ( doOnce )	if ( GetJournalIndex C3_DestroyDagoth >= 50 )		MessageBox "Executed stage 2"		StopScript, "myscript"		return	endifendifend

Unfortunatelly, even when I set my journal to C3_DestroyDagoth 50 and although I get message "Executed stage 2", the script is still running (as it still spams "Script 1 is running" message).

Anyone has any ideas why it does not work? Thanks in advance for any tips :)

User avatar
jessica sonny
 
Posts: 3531
Joined: Thu Nov 02, 2006 6:27 pm

Post » Thu Apr 02, 2015 9:08 am

Is the script attached to an actor or object? Stopscript only works on Global Scripts. (As I have discovered and as it is stated in MSFWD :) )

User avatar
Lisha Boo
 
Posts: 3378
Joined: Fri Aug 18, 2006 2:56 pm

Post » Thu Apr 02, 2015 7:03 am

It is global script ;)

User avatar
Marquis T
 
Posts: 3425
Joined: Fri Aug 31, 2007 4:39 pm

Post » Thu Apr 02, 2015 12:13 am

Is the script global start script or being started via other script? If the latter, may be it is being started once again when it is stopped.

User avatar
Heather M
 
Posts: 3487
Joined: Mon Aug 27, 2007 5:40 am

Post » Thu Apr 02, 2015 2:08 am

No, it is global start script

User avatar
christelle047
 
Posts: 3407
Joined: Mon Apr 09, 2007 12:50 pm

Post » Wed Apr 01, 2015 9:21 pm

Nevermind, I figured it out. For some reason, the game did not like the return statement after the StopScript command :)

User avatar
Marquis T
 
Posts: 3425
Joined: Fri Aug 31, 2007 4:39 pm

Post » Thu Apr 02, 2015 3:24 am

Wierd. Isn't it common practise to return as soon as stopping that script? Many of the vanilaa scripts does the same. dbattackscript comes to mind.

User avatar
Queen
 
Posts: 3480
Joined: Fri Dec 29, 2006 1:00 pm

Post » Thu Apr 02, 2015 5:22 am

Yes, but strangely when I moved the return after the endif, it started to work correctly.

User avatar
Becky Cox
 
Posts: 3389
Joined: Thu Jun 22, 2006 8:38 am

Post » Wed Apr 01, 2015 10:40 pm

That is really odd. Though, if what you posted is the entire script, you definitely don't need a return at the end. You only need it when the script has to stop short before executing the rest of the script again.
User avatar
Kelli Wolfe
 
Posts: 3440
Joined: Thu Aug 23, 2007 7:09 am

Post » Wed Apr 01, 2015 9:40 pm

Yes, you are right, it is not necessarry there. I think I have added it as I thought the script will be longer. But it will not hurt to keep it in either (well, except for the bug with StopScript :D )

User avatar
Lauren Denman
 
Posts: 3382
Joined: Fri Jun 16, 2006 10:29 am


Return to III - Morrowind