I'm just quickly trying to add hold/release functionality to the "A Closer Look" hotkey for personal use, but I'm getting "the parameter types of function onkeyup in the empty state on script _lookcloserquest do not match the parent script form" when compiling. Here's the addition I make which I'm appending after the OnKeyDown event:
Event OnKeyUp(Int lookCloserHotKey, float holdTime)
;unclear if this is needed for edge cases, keeping for now
;if (lookCloserHotKey != lookCloserHotKey)
;return
;endif
;ignore keypress if menu mode or text input is enabled
If !UI.IsTextInputEnabled() && !Utility.IsInMenuMode()
ResetZoom()
EndIf
EndEventAnd the whole script:
Scriptname _lookCloserQuest extends Quest
;A Closer Look
;by fadingsignal
;special thanks to towawot, Reko, and CDM_ for their help
;special thanks to Isoku, whose source code I examined for best practices
;v1.0 4/20/2015
;====================================================================================
;Global variables
GlobalVariable Property _lookCloserZoomSteps Auto
GlobalVariable Property _lookCloserZoomStepFOVIncrement Auto
GlobalVariable Property _lookCloserZoomSpeed Auto
GlobalVariable Property _lookCloserHotKey Auto
;this script contains the base functions that interface with the DLL
import _lookCloserScript
;Internal variables
float _fWorldFOV
float _f1stPersonFOV
float _curWorldFOV
float _cur1stPersonFOV
;Variables have to be properties in order to be accessed/shared between scripts, so make these properties so the MCM can update them directly
Int Property lookCloserZoomSpeed Auto
Int Property lookCloserZoomFOV Auto
Int Property lookCloserHotKey Auto
Int Property lookCloserZoomStepsTotal Auto
Int Property lookCloserZoomStepCount Auto
Int Property lookCloserZoomStepFOVIncrement Auto
;====================================================================================
;Setup on initialization of the script, grab global variable values (only runs once, never again unless quest/script is stopped and started)
Event OnInit()
;grab values from global variables, which are updated by the MCM
lookCloserZoomSpeed = _lookCloserZoomSpeed.GetValue() as Int
lookCloserHotKey = _lookCloserHotKey.GetValue() as Int
lookCloserZoomStepsTotal = _lookCloserZoomSteps.GetValue() as Int
lookCloserZoomStepFOVIncrement = _lookCloserZoomStepFOVIncrement.GetValue() as Int
;We now always use the step count because it was dumb to have two modes
lookCloserZoomStepCount = lookCloserZoomStepsTotal
;Get the player's FOV values
_fWorldFOV = Utility.GetINIFloat("fDefaultWorldFOV:Display")
_f1stPersonFOV = Utility.GetINIFloat("fDefault1stPersonFOV:Display")
_curWorldFOV = _fWorldFOV
_cur1stPersonFOV = _f1stPersonFOV
endEvent
;====================================================================================
;Called by the MCM when switching keys
Function RegisterKey()
RegisterForKey(lookCloserHotKey)
Endfunction
;Called by the MCM when switching keys
Function UnRegisterKey()
UnRegisterForKey(lookCloserHotKey)
Endfunction
;Called internally and by MCM as needed
Function ResetZoom()
_lookCloserScript.ZoomFOVSmooth(_fWorldFOV, _f1stPersonFOV, lookCloserZoomSpeed)
lookCloserZoomStepCount = lookCloserZoomStepsTotal
_curWorldFOV = _fWorldFOV
_cur1stPersonFOV = _f1stPersonFOV
EndFunction
;====================================================================================
Event OnKeyDown(Int lookCloserHotKey)
;unclear if this is needed for edge cases, keeping for now
;if (lookCloserHotKey != lookCloserHotKey)
;return
;endif
;ignore keypress if menu mode or text input is enabled
If !UI.IsTextInputEnabled() && !Utility.IsInMenuMode()
;check if next FOV calculation will be less than 10, if so we clamp it at 10 to avoid any weirdness, which will also force a camera reset
If((_curWorldFOV - lookCloserZoomStepFOVIncrement) < 11)
_curWorldFOV = 10
_cur1stPersonFOV = 10
Else
_curWorldFOV -= lookCloserZoomStepFOVIncrement
_cur1stPersonFOV -= lookCloserZoomStepFOVIncrement
EndIf
;If this value is greater than zero, this means we can still zoom in another step, when it's zero, the zoom will reset
if (lookCloserZoomStepCount > 0)
ZoomFOVSmooth(_curWorldFOV, _cur1stPersonFOV - 7, lookCloserZoomSpeed)
ZoomFOVSmooth(_curWorldFOV, _cur1stPersonFOV, lookCloserZoomSpeed - 50)
;Subtract from the number of steps
lookCloserZoomStepCount -= 1
;Clamp this, so if people put weird values it will just reset if it zooms too far in
If(_curWorldFOV <11)
lookCloserZoomStepCount = 0
EndIf
;If this value is zero, that means it's time to reset steps and zoom out, as all steps have been reached
else
ResetZoom()
endif
EndIf
EndEvent
Event OnKeyUp(Int lookCloserHotKey, float holdTime)
;unclear if this is needed for edge cases, keeping for now
;if (lookCloserHotKey != lookCloserHotKey)
;return
;endif
;ignore keypress if menu mode or text input is enabled
If !UI.IsTextInputEnabled() && !Utility.IsInMenuMode()
ResetZoom()
EndIf
EndEventIf you can see what's missing, I'm not sure where I'm going wrong and would really appreciate some help. Thanks! -jo