Difference between revisions of "Return"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Tegid
(Clarified that returning does not perminently terminate the script)
imported>QQuix
(Clarifying the "terminates the script for the rest of the that iteration")
 
(5 intermediate revisions by 3 users not shown)
Line 2: Line 2:
   return
   return


Return is used to force the '''script''' to stop processing in the current frame. It does not JUST terminate the current block, it terminates the script for the rest of the frame. The script will be run again the next frame. This can be useful inside [[if]] statements where you want to prevent lines following the return from being processed.  
== Summary of command ==
Return is used to force a '''script''' to stop processing from that line on. It does not JUST terminate the current block, it terminates the script for the rest of the that iteration of the script in that frame, including the blocks below, if any.
 
If the script uses a block that runs for multiple frames, such as [[GameMode]], the script will be run again in the next frame. Return can be useful inside of [[If]] statements by allowing you to prevent the lines following the return from being processed.
 
 
 
== Minimizing CPU strain using the Return command ==
Return can be used in If-EndIf blocks to minimize the amount of CPU bandwidth required to process that script in one frame. See the relevant chapter of the [[Minimizing_your_Script#An_important_note_on_If_blocks_vs_early_Returns|Minimizing your Script]] page for more information concerning this issue.


[[Category: Commands]]
[[Category: Commands]]

Latest revision as of 18:06, 4 January 2012

Syntax:

 return

Summary of command[edit | edit source]

Return is used to force a script to stop processing from that line on. It does not JUST terminate the current block, it terminates the script for the rest of the that iteration of the script in that frame, including the blocks below, if any.

If the script uses a block that runs for multiple frames, such as GameMode, the script will be run again in the next frame. Return can be useful inside of If statements by allowing you to prevent the lines following the return from being processed.


Minimizing CPU strain using the Return command[edit | edit source]

Return can be used in If-EndIf blocks to minimize the amount of CPU bandwidth required to process that script in one frame. See the relevant chapter of the Minimizing your Script page for more information concerning this issue.