Difference between revisions of "GetCrosshairRef"
Jump to navigation
Jump to search
imported>Quetzilla m (links were dead so I removed them) |
imported>Haama (→Notes: Implications of activate null) |
||
Line 8: | Line 8: | ||
*Returns the reference of the object within activate distance of the player. You can change the distance by changing [[iActivatePickLength]]. It may take a frame for the new setting to take effect. | *Returns the reference of the object within activate distance of the player. You can change the distance by changing [[iActivatePickLength]]. It may take a frame for the new setting to take effect. | ||
*Returns 0 when called during [[MenuMode]]. If you need to use the crosshair reference during MenuMode, keep checking it in [[GameMode]]. Note that this will keep the script active and running, so use it carefully. | *Returns 0 when called during [[MenuMode]]. If you need to use the crosshair reference during MenuMode, keep checking it in [[GameMode]]. Note that this will keep the script active and running, so use it carefully. | ||
*Returns 0 for 1-5 frames (maybe even longer) after player presses Activate. | *Returns 0 for 1-5 frames (maybe even longer) after player presses Activate. This has two implications: | ||
**If you're using this function every frame, keep in mind 0 may not always mean no object. | |||
**If you're detecting the object in front of the player after pressing Activate (i.e., '''OnControlDown 5''') don't use [[IsKeyPressed2]] and for extra mouse buttons (button 4, wheel) use a [[DisableControl]]/[[OnControlDown]]/[[TapControl]] combo. | |||
*This function will return non-activatable references as well; use [[IsActivatable]] to determine if the reference can be activated normally. | *This function will return non-activatable references as well; use [[IsActivatable]] to determine if the reference can be activated normally. | ||
Latest revision as of 12:47, 5 January 2009
A command for Oblivion Script Extender
Syntax:
(crosshairRef:ref) GetCrosshairRef
Returns a reference to the object under the player's crosshair.
Notes[edit | edit source]
- Returns the reference of the object within activate distance of the player. You can change the distance by changing iActivatePickLength. It may take a frame for the new setting to take effect.
- Returns 0 when called during MenuMode. If you need to use the crosshair reference during MenuMode, keep checking it in GameMode. Note that this will keep the script active and running, so use it carefully.
- Returns 0 for 1-5 frames (maybe even longer) after player presses Activate. This has two implications:
- If you're using this function every frame, keep in mind 0 may not always mean no object.
- If you're detecting the object in front of the player after pressing Activate (i.e., OnControlDown 5) don't use IsKeyPressed2 and for extra mouse buttons (button 4, wheel) use a DisableControl/OnControlDown/TapControl combo.
- This function will return non-activatable references as well; use IsActivatable to determine if the reference can be activated normally.