Nested Loops with FOSE

Post » Tue May 17, 2011 2:19 pm

Hello all,

I have tried the following script:

scn 1ntfsTestLoopScriptshort doonceBegin GameModeLabel 1if doonce < 200	Label 2	if doonce < 100		set doonce to doonce + 1	goto 2	endifgoto 1endifend


and the game crashes as soon as the script begins.

Is it impossible to achieve a nested loop even with FOSE or am I missing something? :brokencomputer:
User avatar
Alina loves Alexandra
 
Posts: 3456
Joined: Mon Jan 01, 2007 7:55 pm

Post » Tue May 17, 2011 12:56 pm

Odd. What exactly are you trying to accomplish? Besides the whole loop.
User avatar
Alexander Horton
 
Posts: 3318
Joined: Thu Oct 11, 2007 9:19 pm

Post » Tue May 17, 2011 8:48 am

Well, I have written a pretty complex ref-walk script where every ref-walked actor performs his own ref-walk. I could do it with a script effect or a form list but this would be the most reliable way (and I'd have to rewrite the script :banghead:)
User avatar
Nicola
 
Posts: 3365
Joined: Wed Jul 19, 2006 7:57 am

Post » Tue May 17, 2011 3:57 pm

in this case its a logic mistake, doonce is only incremented in the inner loop, which requires it to be <100. So once its 100, the loop2 will no longer run, but loop1 runs until its 200, which will be forever.
User avatar
Darlene DIllow
 
Posts: 3403
Joined: Fri Oct 26, 2007 5:34 am

Post » Tue May 17, 2011 6:47 am

in this case its a logic mistake, doonce is only incremented in the inner loop, which requires it to be <100. So once its 100, the loop2 will no longer run, but loop1 runs until its 200, which will be forever.


omg, I shouldn't write scripts after midnight :banghead: Am I blind or what? I'll have to look for the crashing reason elsewhere. Thnx :celebration:
User avatar
Benjamin Holz
 
Posts: 3408
Joined: Fri Oct 19, 2007 9:34 pm

Post » Tue May 17, 2011 12:03 pm

omg, I shouldn't write scripts after midnight :banghead: Am I blind or what? I'll have to look for the crashing reason elsewhere. Thnx :celebration:


The effect you're going to get is the game freezing because there is no way out of the GOTO 1 outer loop. You don't need to look any further for the crashing reason.
User avatar
Natalie Harvey
 
Posts: 3433
Joined: Fri Aug 18, 2006 12:15 pm

Post » Tue May 17, 2011 4:08 am

In my case (my big script), it was due to multiple getFirstRef/getNextRef calls within the same script. Seems that FOSE supports only one reference iterator in a script at a time :)
User avatar
Helen Quill
 
Posts: 3334
Joined: Fri Oct 13, 2006 1:12 pm

Post » Tue May 17, 2011 1:45 pm

In my case (my big script), it was due to multiple getFirstRef/getNextRef calls within the same script. Seems that FOSE supports only one reference iterator in a script at a time :)


I've done two ref walks for different things in the same quest script where both run every iteration - but the loops were not nested, nor were the loops intersecting in such a way that the GetFirstRef/GetNextRef pairs were crossing. In other words, only one of them was active at a time.
User avatar
Cassie Boyle
 
Posts: 3468
Joined: Sun Nov 05, 2006 9:33 am


Return to Fallout 3