Difference between revisions of "ForceRefIfEmpty - ReferenceAlias"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Jlundin
(Created page with "Category:Scripting Category:Papyrus '''Member of:''' ReferenceAlias Script Forces this alias to use the specified reference, but only if the alias is currently empty...")
 
imported>Thingy Person
 
Line 7: Line 7:
== Syntax ==
== Syntax ==
<source lang="papyrus">
<source lang="papyrus">
Function ForceRefIfEmpty(ObjectReference akNewRef)
bool Function ForceRefIfEmpty(ObjectReference akNewRef)
if (GetReference())
return False
else
ForceRefTo(akNewRef)
return True
endif
EndFunction
</source>
</source>


Line 14: Line 21:


== Return Value ==
== Return Value ==
None.
True if the alias now holds the passed reference, false if it was already filled.


== Examples ==
== Examples ==

Latest revision as of 16:20, 29 June 2013

Member of: ReferenceAlias Script

Forces this alias to use the specified reference, but only if the alias is currently empty

Syntax[edit | edit source]

bool Function ForceRefIfEmpty(ObjectReference akNewRef)
	if (GetReference())
		return False
	else
		ForceRefTo(akNewRef)
		return True
	endif
EndFunction

Parameters[edit | edit source]

Return Value[edit | edit source]

True if the alias now holds the passed reference, false if it was already filled.

Examples[edit | edit source]

; Force the alias to use the random person as the reference, but only if the alias is currently empty
Alias_JohnDoe.ForceRefIfEmpty(RandomPerson)

See Also[edit | edit source]