Difference between revisions of "Talk:GetCrosshairRef"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Haama
(Note on Activation)
 
imported>Takark
(Telekinesis)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
== Returns NULL when player presses activate ==
This function "falsely" returns NULL for a frame when the player activates an object. Which frame seems to depend on whether you're also using [[IsKeyPressed]], any of the other [[:Category:Input Functions (OBSE)|OBSE Input functions]], and whether the player uses the Mouse or Keyboard key. A few more tests, and I'll have exacts here later.--[[User:Haama|Haama]] 17:08, 22 June 2008 (EDT)
This function "falsely" returns NULL for a frame when the player activates an object. Which frame seems to depend on whether you're also using [[IsKeyPressed]], any of the other [[:Category:Input Functions (OBSE)|OBSE Input functions]], and whether the player uses the Mouse or Keyboard key. A few more tests, and I'll have exacts here later.--[[User:Haama|Haama]] 17:08, 22 June 2008 (EDT)
:I've posted some findings on the main page - you can test it yourself with the '''GetCrosshairRef''' debug file [http://www.tesnexus.com/downloads/file.php?id=18334 here].
:*Test Setup
:**No other mods - the debug file and an [http://www.tesnexus.com/downloads/file.php?id=18334 Autoload file]
:***Beginning character using [http://www.tesnexus.com/downloads/file.php?id=1888 Kobu's Skip Intro mod] (savegame included with Autoload, removed KSI dependency manually/re-saving)
:**Oblivion patch v1.2.0416, SI, [[:Category:Oblivion_Script_Extender|OBSE v15]], [[:Category:Pluggy|Pluggy v73]], [[:Category:TSFC|TSFC v0.5.3]]
:**Manually pressed Activate
:***Used both a keyboard key (Left-arrow) and a mouse key (Right MB)
:**Tried various objects around the Imperial Sewer Exit and Anvil
:*Tested Objects
:**Statics and flora - 1 frame of NULL
:**Doors - 2 to 5 frames of NULL
:--[[User:Haama|Haama]] 16:29, 10 July 2008 (EDT)
== Suggestions for other tests ==
#Will object types return NULL?
#Will they return NULL when using[[TapKey]] and/or [[TapControl]]?
#*From informal tests, I'd say yes.
#When will it return NULL - the frame the player presses NULL, the next frame, etc.?
#*From informal tests I'd say the next frame. It's hard to say when the key is pressed exactly, but when using '''if [[IsControlPressed]] 5''', the function will still return the correct reference. However, if you use '''if [[IsKeyPressed2]] ActivateKey''' the function will return NULL. '''IsKeyPressed2''' seems to trigger a frame after '''IsControlPressed''', meaning there's at least one frame after the player preses Activate and when the function returns NULL.
#*From discussions with Scruggsy, the input functions use two different systems: Windows-API and Direct-X. The functions that use Windows-API detect the key a frame before the Direct-X functions, but more importantly they detect the key press before '''GetCrosshairRef''' returns 0. These functions include [[IsKeyPressed]] and, for keyboard keys, the "third generation" input functions like [[IsKeyPressed3]] and [[OnControlDown]].
#Is there an .ini setting to control this?
#*Essentially, nullifying the crosshair reference seems... pointless. I wonder if there's a way to turn it off.
:--[[User:Haama|Haama]] 16:29, 10 July 2008 (EDT)
== Telekinesis ==
Forgive me if I'm just pointing out something you already know, but in my brief encounters with this function it appears that it will return a distant reference if a Telekinesis spell is selected. The only real implication of this is that you may need to add a distance check if the reference is intended to be close-by. I've actually found this to be a very useful little quirk of this function. --[[User:Takark|Takark]] 08:40, 12 September 2010 (EDT)

Latest revision as of 07:40, 12 September 2010

Returns NULL when player presses activate[edit source]

This function "falsely" returns NULL for a frame when the player activates an object. Which frame seems to depend on whether you're also using IsKeyPressed, any of the other OBSE Input functions, and whether the player uses the Mouse or Keyboard key. A few more tests, and I'll have exacts here later.--Haama 17:08, 22 June 2008 (EDT)

I've posted some findings on the main page - you can test it yourself with the GetCrosshairRef debug file here.
  • Test Setup
    • No other mods - the debug file and an Autoload file
      • Beginning character using Kobu's Skip Intro mod (savegame included with Autoload, removed KSI dependency manually/re-saving)
    • Oblivion patch v1.2.0416, SI, OBSE v15, Pluggy v73, TSFC v0.5.3
    • Manually pressed Activate
      • Used both a keyboard key (Left-arrow) and a mouse key (Right MB)
    • Tried various objects around the Imperial Sewer Exit and Anvil
  • Tested Objects
    • Statics and flora - 1 frame of NULL
    • Doors - 2 to 5 frames of NULL
--Haama 16:29, 10 July 2008 (EDT)

Suggestions for other tests[edit source]

  1. Will object types return NULL?
  2. Will they return NULL when usingTapKey and/or TapControl?
    • From informal tests, I'd say yes.
  3. When will it return NULL - the frame the player presses NULL, the next frame, etc.?
    • From informal tests I'd say the next frame. It's hard to say when the key is pressed exactly, but when using if IsControlPressed 5, the function will still return the correct reference. However, if you use if IsKeyPressed2 ActivateKey the function will return NULL. IsKeyPressed2 seems to trigger a frame after IsControlPressed, meaning there's at least one frame after the player preses Activate and when the function returns NULL.
    • From discussions with Scruggsy, the input functions use two different systems: Windows-API and Direct-X. The functions that use Windows-API detect the key a frame before the Direct-X functions, but more importantly they detect the key press before GetCrosshairRef returns 0. These functions include IsKeyPressed and, for keyboard keys, the "third generation" input functions like IsKeyPressed3 and OnControlDown.
  4. Is there an .ini setting to control this?
    • Essentially, nullifying the crosshair reference seems... pointless. I wonder if there's a way to turn it off.
--Haama 16:29, 10 July 2008 (EDT)

Telekinesis[edit source]

Forgive me if I'm just pointing out something you already know, but in my brief encounters with this function it appears that it will return a distant reference if a Telekinesis spell is selected. The only real implication of this is that you may need to add a distance check if the reference is intended to be close-by. I've actually found this to be a very useful little quirk of this function. --Takark 08:40, 12 September 2010 (EDT)