Possible to do a loop in script?

Post » Fri Jan 28, 2011 4:55 pm

Hi.

Is it possible to do a "while: or "for" loop in script without the FOSE?

Thanks,
Dan
User avatar
Sakura Haruno
 
Posts: 3446
Joined: Sat Aug 26, 2006 7:23 pm

Post » Fri Jan 28, 2011 9:23 pm

No unfortunately there was no while loop implemented in Fo3 scripting.

However! The FOSE team has added the capability using the Label/Goto method, which is quite an old method historically speaking (most modern languages have no equivalent of a "goto" command anymore as functions like while() replaced them). Still the FOSE implementation of Goto/Label is quite good. The wiki has a good http://geck.gamesas.com/index.php/FOSE that can get you off to the races.

Luck,

Miax
User avatar
Kat Lehmann
 
Posts: 3409
Joined: Tue Jun 27, 2006 6:24 am

Post » Sat Jan 29, 2011 1:34 am

Hi.

Is it possible to do a "while: or "for" loop in script without the FOSE?

Thanks,
Dan


YES!!!!!

I've been doing quite a lot of this lately. I've been using actor effects. The "scripteffectupdate" script block in an effect has the characteristic that it will repeat. I tend to see like 2 iterations in the first frame, and then it runs like 1 iteration per frame from then on.

ScriptEffectStart will run one time at the beginning when you apply the effect, if you need something like that.

So you can loop like this:

scn MyHappyEffectSCRIPTshort totalbegin scripteffectupdateif total == 10     dispel MyHappyEffect ;im not sure this is even necessary     returnendifif total < 10 ; this is to be sure you don't somehow get extra iterations          set Total to Total + 1endifend

User avatar
Stacey Mason
 
Posts: 3350
Joined: Wed Nov 08, 2006 6:18 am

Post » Fri Jan 28, 2011 4:26 pm

I've written a tutorial on how to use FOSE's http://fose.silverlock.org/fose_command_doc.html#Label and http://fose.silverlock.org/fose_command_doc.html#Goto functions to create common loop structures like "while" and "for" loops. Here's a link - http://cipscis.com/fallout/tutorials/loops.aspx

Cipscis
User avatar
Sandeep Khatkar
 
Posts: 3364
Joined: Wed Jul 18, 2007 11:02 am


Return to Fallout 3