Difference between revisions of "Talk:Return"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>GreyWanderer
imported>J.O.D.
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
-------------------------------------------------------
-------------------------------------------------------
( never used a Wiki before, hope I do this right )
( never used a Wiki before, hope I do this right )
Line 31: Line 30:


-- [[User:GreyWanderer|Grey]]: Although this is valueable information and exactly what I was looking for, let me note that in your example, DoOnce isn't needed as OnLoad Blocks are only executed once at a time.
-- [[User:GreyWanderer|Grey]]: Although this is valueable information and exactly what I was looking for, let me note that in your example, DoOnce isn't needed as OnLoad Blocks are only executed once at a time.
--[[User:J.O.D.|J.O.D.]] 05:19, 6 February 2007 (EST) I think that DoOnce is actually needed to do anything just on the first OnLoad event - otherwise the action would take place on every load.

Latest revision as of 05:21, 6 February 2007


( never used a Wiki before, hope I do this right )


I had a glitch in a script, and careful debugging has taught me that RETURN is a little more powerful than first suspected.

The scripts are designed with the BEGIN <event> syntax. I was considering these independednt functions called seperately. However if within the same frame execution you have more than one <event> expected to be processed, and use RETURN in the first <event> for any reason. No other <event>s will be processed.

The clear example I discovered, was using RETURN within an OnLoad event. Which ultimately glitched the necessary OnReset event. Because OnLoad and OnReset are processed at the same frame during a cell load the OnLoad event exited the script before the OnReset had a chance to process.

Begin OnLoad

 If doOnce == 1
   Return
 Endif
 ; Stuff to do once

End

Begin OnReset

 ; Stuff to do every Reset

End

The "stuff to do every reset" will only process the one time OnLoad processes.

RETURN as clearly stated in the Wiki exits the script, not the OnLoad function.

Just thought I would add this bit of business so others would not make the same mistake I did. I hope it helps. -Dejunai

-- Grey: Although this is valueable information and exactly what I was looking for, let me note that in your example, DoOnce isn't needed as OnLoad Blocks are only executed once at a time.

--J.O.D. 05:19, 6 February 2007 (EST) I think that DoOnce is actually needed to do anything just on the first OnLoad event - otherwise the action would take place on every load.