UILibOnKeyDown Issues

Post » Mon Aug 25, 2014 5:17 pm

I have this script, to rename a horse, and yet the Debug.Messagebox never even fires. It compiles correctly, and I've done hotkey scripts dozens of times so I have no idea what's wrong.

Scriptname NYHControlScript extends Quest  {Governs all horse naming-related functions.}Keyword Property HorseKeyword Auto Int Property HorseRenameKey AutoMessage Property RenameHorse Auto Faction Property PlayerHorseFaction AutoEvent OnKeyDown(Int KeyCode)	If KeyCode == HorseRenameKey		Debug.Messagebox("Key pressed...")		If !Utility.IsInMenuMode()			If Game.GetCurrentCrosshairRef().HasKeyword(HorseKeyword) && (Game.GetCurrentCrosshairRef() as Actor).IsInFaction(PlayerHorseFaction)				Debug.MessageBox("Crosshair on horse.")				Actor PlayerHorse = (Game.GetCurrentCrosshairRef() as Actor)				String HorseName = ((Self as Form) as UILIB_1).ShowTextInput("Change Horse Name", "")				If HorseName != ""					PlayerHorse.SetDisplayName(HorseName)					RenameHorse.Show()				EndIf			EndIf		EndIf	EndIfEndEvent

This is how it's set up:

http://i1295.photobucket.com/albums/b630/Matthiaswagg/Screenshot52_zps582cbd04.png

HorseRenameKey is 22 (U). And the MCM script, which works perfect.

Spoiler
Scriptname NYHMCM extends SKI_ConfigBase  ;Variables;==========NYHControlScript Property ControlScr Auto Int NYHHotkey;Events;=======Event OnConfigOpen()	NYHHotkey = ControlScr.HorseRenameKeyEndEventEvent OnConfigClose()	UnregisterForAllKeys()	RegisterForKey(NYHHotkey)EndEventEvent OnPageReset(string a_page)	If a_page == ""		LoadCustomContent("NameYourHorse/NYHLogo.dds", 0, 0)	Else 		UnloadCustomContent()	EndIf	If a_page == "Customization"		AddKeyMapOptionST("NYHHotkeyState", "Name Your Horse Hotkey", NYHHotkey)	EndIfEndEvent;Name Your Horse Hotkey State;=============================State NYHHotkeyStateEvent OnHighlightST()	SetInfoText("Change the Name Your Horse hotkey.\n Default is U.")	EndEventEvent OnKeyMapChangeST(Int newKeyCode, String conflictControl, String conflictName)	Bool ContinueNYH = true		    If (conflictControl != "")		        String NYHHotkeyMsg			        If (conflictName != "")			            NYHHotkeyMsg = "This key is already mapped to:\n\"" + conflictControl + "\"\n(" + conflictName + ")\n\nAre you sure you want to continue?"						Else						NYHHotkeyMsg = "This key is already mapped to:\n\"" + conflictControl + "\"\n\nAre you sure you want to continue?"						EndIf			        ContinueNYH = ShowMessage(NYHHotkeyMsg, true, "$Yes", "$No")			    EndIf		    If (ContinueNYH)		 		NYHHotkey = newKeyCode		SetKeymapOptionValueST(NYHHotkey)			    EndIfEndEventEvent OnDefaultST()	NYHHotkey = 22	SetKeyMapOptionValueST(NYHHotkey)EndEventEndState
User avatar
marina
 
Posts: 3401
Joined: Tue Mar 13, 2007 10:02 pm

Return to V - Skyrim