Difference between revisions of "Label"

From the Fallout3 GECK Wiki
Jump to navigation Jump to search
imported>Cipscis
(Changed indentation and lebel ID - I don't think label IDs can go higher than 256)
imported>Odessa
(fixed link, added example)
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Function
{{Function
  |origin = FOSE1
  |origin = FOSE1
  |summary = Creates a label in a script, allowing this location to be referred to by the [[GoTo]] function.
  |summary = Defines a labeled position in a script which subsequent calls to Goto can use to create loops. The label must be defined before Goto is called.
  |name = Label
  |name = Label
|returnType = void
  |arguments =  
  |arguments =  
   {{FunctionArgument
   {{FunctionArgument
   |Name = ID
   |Name = labelID
   |Type = int
   |Type = int
   }}
   }}
  |example = Label 1
  |example = int GetNextActor ; * or some appropriate name
set GetNextActor to 1
Label GetNextActor
}}
}}
==Notes==
==Notes==
===The Label/GoTo Loop===
*There are 256 available slots for Labels, enabling IDs from 0 to 255 inclusively. Values outside of this range will not work.
This function can be used to create a loop when combined with [[Goto]]. The following script loops the script instructions ''iterations'' times:
*If using NVSE since version 4, label/goto should be replaced by [[While]] or [[Foreach]] in all but exceptional cases, as this is more powerful, readable and reliable.
ScriptName LoopScript
int count
int iterations
Begin GameMode
Label 1
;Script instructions to loop
set count to count + 1
if count < iterations
GoTo 1
endif
End
 
==See Also==
==See Also==
*[[GoTo]]
*[[Goto]]
 
*[[While]]
[[Category:Functions]]
*[[Foreach]]
[[Category:Functions_(FOSE)]]

Latest revision as of 06:18, 24 June 2014

< [[::Category:Functions|Category:Functions]]

A function added by the Fallout Script Extender.

Description

Defines a labeled position in a script which subsequent calls to Goto can use to create loops. The label must be defined before Goto is called.

Syntax

[help]
Label labelID:int

Example

int GetNextActor ; * or some appropriate name
set GetNextActor to 1
Label GetNextActor

Notes

  • There are 256 available slots for Labels, enabling IDs from 0 to 255 inclusively. Values outside of this range will not work.
  • If using NVSE since version 4, label/goto should be replaced by While or Foreach in all but exceptional cases, as this is more powerful, readable and reliable.

See Also