Difference between revisions of "GetSelf"

From the Fallout3 GECK Wiki
Jump to navigation Jump to search
imported>Henning
(Complete article.)
imported>Cipscis
(Updated to use Function template; fixed bad example; added note about implicit reference syntax)
Line 1: Line 1:
Link to TES4 Construction Set Wiki: [http://cs.elderscrolls.com/constwiki/index.php/GetSelf GetSelf].
{{Function
|CSWikiPage = GetSelf
|origin = GECK1
|summary = Returns the RefID of the calling reference.  [[GetSelf]] is only useful when this information is accessed externally, or when the scripted reference's RefID needs to be passed as a parameter to a function like [[PushActorAway]]
|alias = this
|referenceType = Reference
|example = ref rSelf
set rSelf to GetSelf
player.PushActorAway rSelf 5
}}


Syntax:
==Notes==
set RefVar to GetSelf
<ul>
 
<li>Because reference functions can be called on the scripted reference implicitly by omitting explicit reference syntax, the following code structure should never be used:
Example:
<pre>ref rSelf
ref target
set rSelf to GetSelf
set RefVar to GetSelf
rSelf.ReferenceFunction</pre>
If RefVar.IsInCombat == 0
Instead, just use code like this:
  return
<pre>ReferenceFunction</pre>
Endif
</li>
 
</ul>
 
Returns the calling object itself as a reference. Useful for if statements and script effects on targets.


[[Category:Functions]]
[[Category:Functions]]

Revision as of 23:48, 23 October 2009

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

Link to TES4 Construction Set Wiki: GetSelf.

A function included in the GECK version 1.1.0.36.

Description

Returns the RefID of the calling reference. GetSelf is only useful when this information is accessed externally, or when the scripted reference's RefID needs to be passed as a parameter to a function like PushActorAway

Syntax

[help]
Reference.GetSelf 

Or:

Reference.this

Example

ref rSelf
set rSelf to GetSelf
player.PushActorAway rSelf 5

Notes

  • Because reference functions can be called on the scripted reference implicitly by omitting explicit reference syntax, the following code structure should never be used:
    ref rSelf
    set rSelf to GetSelf
    rSelf.ReferenceFunction

    Instead, just use code like this:

    ReferenceFunction