Do while loops wait for all function returns?

Post » Thu Jun 21, 2012 1:28 pm

Hey all again. Probably a simple question this time. Just looking for some clarification really.

Say I have a function that contains a while loop that calls another function. Something like this:

Function SomeFunction()	while somevariable < 5		SomeOtherFunction()	    somevariable += 1	endwhileEndFunction

Would this function actually wait for the return of the while loop before processing the variable increment?

Also, what if I called ANOTHER function from SomeOtherFunction. Would the original while loop wait for the SomeOtherFunction to get the return of what IT called, before waiting for SomeOtherFunction to complete, before hitting the increment?
User avatar
Erich Lendermon
 
Posts: 3322
Joined: Sat Nov 03, 2007 4:20 pm

Post » Thu Jun 21, 2012 1:35 pm

Yes, While loops share the same behavior as the rest of Papyrus. They will do everything you tell them in full, in order from top to bottom, until the loop ends. So in your example, the While loop will call for SomeOtherFunction() to be processed in full (or until you ask the Function to return) five times.
User avatar
Lil Miss
 
Posts: 3373
Joined: Thu Nov 23, 2006 12:57 pm

Post » Fri Jun 22, 2012 12:09 am

Thanks. I edited my original example to what is more of what I was asking, but it seem from your description, this should process the complete function chain before hitting the increment line even with it in the while loop.
User avatar
Taylrea Teodor
 
Posts: 3378
Joined: Sat Nov 18, 2006 12:20 am

Post » Thu Jun 21, 2012 10:49 am

this is a good read:
http://www.creationkit.com/Threading_Notes_(Papyrus)
User avatar
Maddy Paul
 
Posts: 3430
Joined: Wed Feb 14, 2007 4:20 pm


Return to V - Skyrim