Difference between revisions of "Reference functions"

From the Fallout3 GECK Wiki
Jump to navigation Jump to search
imported>Henning
m (None)
imported>Qazaaq
m (Reverted edits by LakiasSena (talk) to last revision by Cipscis)
 
Line 3: Line 3:
  GetFactionRelation player  
  GetFactionRelation player  


GetFactionRelation is a reference function -- whose faction relation are you asking for? In this <span class="plainlinks">[http://tinyurl.com/6a83yjx <span style="color:black;font-weight:normal;text-decoration:none!important;background:none!important; text-decoration:none;">stretch marks</span>]</span> case, since we did not specify a reference, it is implied that we are really saying:  
GetFactionRelation is a reference function -- whose faction relation are you asking for? In this case, since we did not specify a reference, it is implied that we are really saying:  


  thisReference.GetFactionRelation player  
  thisReference.GetFactionRelation player  

Latest revision as of 13:19, 9 November 2011

Most script functions are reference functions. This refers to the fact that they must be run on an object reference. Reference scripts (object scripts and dialogue result scripts) can use implicit reference syntax. For example:

GetFactionRelation player 

GetFactionRelation is a reference function -- whose faction relation are you asking for? In this case, since we did not specify a reference, it is implied that we are really saying:

thisReference.GetFactionRelation player 

You can always use explicit reference syntax, meaning that you explicitly specify the reference to run the function on. Non-reference scripts MUST use explicit reference syntax, since they are not running on an object reference. For example:

LucasSimmsRef.GetFactionRelation player 

Here we are asking for Lucas Simm's faction relation towards the player. This syntax could be used in any script, because we have made the function's reference explicit.

NOTE: you can also run reference functions on reference variables, just as if they were the object themselves.