Difference between revisions of "GetActionRef"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Nellis
imported>Scruggs
(Clean up recent additions)
Line 3: Line 3:
    
    


Returns the reference currently interacting with the scripted object. '''Valid only when the object is being activated or triggered.''' It will only return a value during the frame after the object has been interacted with. This means it is generally only useful inside an [[OnActivate]] or [[OnTrigger]] block. If more than one object is interacting with the object (for instance, several objects colliding with the same trigger zone), only the most recently interacting object will be returned by this function.
Returns the reference currently interacting with the scripted object. It will only return a value during the frame after the object has been interacted with. This means it is generally only useful inside an [[OnActivate]] or [[OnTrigger]] block. If more than one object is interacting with the object (for instance, several objects colliding with the same trigger zone), only the most recently interacting object will be returned by this function.
 
'''Clarification''': GetActionRef puts the current action ref into a ref variable. IsActionRef checks to see if the given ref is our action ref. The action ref is whatever ref is responsible for the most recent script action (ie: in an OnActivate block, its the ref that activated the scripted object, in an OnTriggerEnter, its the ref that entered the trigger, etc).
 
;this is GOOD. stores our action ref in a ref variable for later use
ref actorref
set actorref to GetActionRef
 
;this is GOOD. check to see if the player is our action ref
if ( IsActionRef player == 1.0 )
endif
 
;this is BAD. because the code is in an expression block its not
; evaluated at compile time. but when we evaluate the expression
; when the script runs, it will generate an error and shut down the script
if ( GetActionRef player == 1.0 )
endif
 
 
 


==Notes==
* This function is only useful inside an [[OnActivate]] or [[OnTrigger]] block.
* Unlike [[IsActionRef]], which checks for a specific reference, this function returns a reference. However, it can be used to imitate the behavior of [[IsActionRef]]:
<pre>if ( GetActionRef == player )
if ( IsActionRef player ) ; these two expressions are equivalent</pre>
   
   
==See Also==
==See Also==

Revision as of 15:09, 3 December 2007

Syntax:

set refVar to GetActionRef 
 

Returns the reference currently interacting with the scripted object. It will only return a value during the frame after the object has been interacted with. This means it is generally only useful inside an OnActivate or OnTrigger block. If more than one object is interacting with the object (for instance, several objects colliding with the same trigger zone), only the most recently interacting object will be returned by this function.

Notes

  • This function is only useful inside an OnActivate or OnTrigger block.
  • Unlike IsActionRef, which checks for a specific reference, this function returns a reference. However, it can be used to imitate the behavior of IsActionRef:
if ( GetActionRef == player )
if ( IsActionRef player ) ; these two expressions are equivalent

See Also

IsActionRef