Difference between revisions of "GetSelf"
Jump to navigation
Jump to search
imported>Geckbot m (Robot: Automated text replacement (-\[\[Category:(.*?)Functions\]\] +Category:\1Functions\nCategory:\1Functions (GECK 1.0))) |
imported>Tgspy |
||
(6 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{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 | |||
|example = ref rSelf | |||
set rSelf to GetSelf | |||
player.PushActorAway rSelf 5 | |||
}} | |||
==Notes== | |||
<ul> | |||
<li>While functions that take an implied reference can be cast without needing a variable or call to getself, like so: | |||
<pre>CIOS someSpell</pre> | |||
Doing so may not be clear, and makes the code less portable if moved to a different script that does not support the implied reference. For this reason, modders should prefer the more expressive syntax: | |||
<pre> | |||
ref rSelf | |||
set rSelf to GetSelf | |||
rSelf.CIOS someSpell</pre> | |||
Not only for CIOS, but for all "reference methods" that require a reference, like CIOS. | |||
</li> | |||
<li>[[GetSelf]] will return 0 if called on a reference that has been created dynamically (for example, created via [[PlaceAtMe]], or dropped from an inventory into the game world). | |||
</li> | |||
</ul> | |||
*Using GetSelf in scripts rather than this will result in GECKPU throwing errors. | |||
[[Category:Functions]] | [[Category:Functions]] | ||
[[Category:Functions (GECK 1. | [[Category:Functions (GECK 1.1)]] | ||
[[Category:Reference Variable Functions]] | [[Category:Reference Variable Functions]] | ||
[[Category:Reference Variable Functions (GECK 1. | [[Category:Reference Variable Functions (GECK 1.1)]] |
Latest revision as of 07:47, 13 January 2017
< [[::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
GetSelf
Or:
this
Example
ref rSelf set rSelf to GetSelf player.PushActorAway rSelf 5
Notes
- While functions that take an implied reference can be cast without needing a variable or call to getself, like so:
CIOS someSpell
Doing so may not be clear, and makes the code less portable if moved to a different script that does not support the implied reference. For this reason, modders should prefer the more expressive syntax:
ref rSelf set rSelf to GetSelf rSelf.CIOS someSpell
Not only for CIOS, but for all "reference methods" that require a reference, like CIOS.
- GetSelf will return 0 if called on a reference that has been created dynamically (for example, created via PlaceAtMe, or dropped from an inventory into the game world).
- Using GetSelf in scripts rather than this will result in GECKPU throwing errors.