Jump to content

OnKeyUp compilation error


Josephish

Recommended Posts

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


EndEvent

And 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
	
EndEvent

If you can see what's missing, I'm not sure where I'm going wrong and would really appreciate some help.

 

Thanks!

 

-jo

Edited by Josephish
Link to comment
Share on other sites

How did you install SKSE? Installer or 7z archive? The latter is required for developing mods since it contains the source files for the modified scripts and it sounds like you might not have those modified script source files.

Link to comment
Share on other sites

hi :) thanks for replying.

 

I installed the contents of the 7zip and have the source files. I've been able to tweak scripts before (similar simple edits) and the original and any other scripts all compile fine.

Edited by Josephish
Link to comment
Share on other sites

Have you checked to see that the definition for the OnKeyUp event in the copy of Form.psc that you are using does indeed match with what you are using in the script in your original post? Are you compiling from within CK's script editor or do you have a setup involving an external text editor? I'm asking just in case you have a setup that uses a more complex argument for the import folders when running the compiler. If that is the case, then you might accidentally be using the vanilla version of Form.psc when compiling.

Link to comment
Share on other sites

Oh wow, such a silly mistake. It compiles just fine, I had just mistaken one file for another

 

gosh :O please excuse me. I'm embarrassed!

 

really do appreciate you trying to help, thank-you. I'll make sure I've had a good night's sleep before coming here with a question again.

Edited by Josephish
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...