Scripting and alias issues

Post » Wed Aug 27, 2014 2:06 pm

So the users of http://www.nexusmods.com/skyrim/mods/57513/? seem to be having this problem (from what I can tell, only on loading a current save game - not new - where they already own a horse):

Yet it works perfectly for me. I'm using SkyUILib to do this, and these are my scripts (one renames the horse when you press a hotkey, the other is the MCM):

Scriptname NYHControlScript extends Quest  {Governs all horse naming-related functions.}Keyword Property HorseKeyword Auto Message Property RenameHorse Auto Faction Property PlayerHorseFaction AutoGlobalVariable Property HorseRenameKey Auto GlobalVariable Property NYHHotkeyToggle Auto ReferenceAlias Property PlayerHorseAlias AutoEvent OnKeyDown(Int KeyCode)	If KeyCode == HorseRenameKey.GetValueInt() && NYHHotkeyToggle.GetValueInt() == 1		If !Utility.IsInMenuMode()			If Game.GetCurrentCrosshairRef().HasKeyword(HorseKeyword) && (Game.GetCurrentCrosshairRef() as Actor).IsInFaction(PlayerHorseFaction)				Actor PlayerHorse = (Game.GetCurrentCrosshairRef() as Actor)				String HorseName = ((Self as Form) as UILIB_1).ShowTextInput("Change Horse Name", "")				If HorseName != ""					PlayerHorseAlias.Clear()					PlayerHorseAlias.ForceRefTo(PlayerHorse)					PlayerHorse.SetDisplayName(HorseName)					RenameHorse.Show()				EndIf			EndIf		EndIf	EndIfEndEventFunction RegisterForNYHHotkey(Bool UnregisterNYH = false)	If !UnregisterNYH		RegisterForKey(HorseRenameKey.GetValueInt())	Else 		UnregisterForAllKeys()	EndIfEndFunction 

MCM:

Scriptname NYHMCM extends SKI_ConfigBase  ;Variables;==========GlobalVariable Property NYHHotkey AutoGlobalVariable Property NYHToggle Auto NYHControlScript Property ControlScr Auto ;Events;=======Event OnConfigInit()     ControlScr.RegisterForNYHHotkey()EndEventEvent OnConfigClose()	ControlScr.RegisterForNYHHotkey(true)	ControlScr.RegisterForNYHHotkey()EndEventEvent OnPageReset(string a_page)	If a_page == ""		LoadCustomContent("NameYourHorse/NYHLogo.dds", 60.5, 72.0)	Else 		UnloadCustomContent()	EndIf	If a_page == "Customization"		SetCursorFillMode(TOP_TO_BOTTOM)		AddKeyMapOptionST("NYHHotkeyState", "NYH Hotkey", NYHHotkey.GetValueInt())		AddToggleOptionST("NYHToggleState", "Toggle NYH Hotkey", NYHToggle.GetValueInt())	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.SetValueInt(newKeyCode)		SetKeymapOptionValueST(NYHHotkey.GetValueInt())			    EndIfEndEventEvent OnDefaultST()	NYHHotkey.SetValueInt(22)	SetKeyMapOptionValueST(NYHHotkey.GetValueInt())EndEventEndState;Toggle NYH Hotkey State;========================State NYHToggleStateEvent OnSelectST()	If NYHToggle.GetValueInt() == 1		NYHToggle.SetValueInt(0)	Else		NYHToggle.SetValueInt(1)	EndIfEndEventEvent OnDefaultST()	NYHToggle.SetValueInt(1)EndEventEvent OnHighlightST()	SetInfoText("Activate or deactivate the NYH hotkey.")EndEventEndState

I really have no idea what might be wrong. Can anyone be of help?

User avatar
Angela
 
Posts: 3492
Joined: Mon Mar 05, 2007 8:33 am

Post » Wed Aug 27, 2014 8:09 pm

No idea how alias display names work, but if you want to try a new approach, you could give the player a perk with an Activate entry point that changes the activation text of their horse when they look at it, which would essentially be the same as renaming it (unless the horse name is displayed anywhere else besides when the player crosshair is focused on it..)

http://www.creationkit.com/SetNthEntryText_-_Perk would allow you to change the activate text of your perk entry to whatever the player inputs.

User avatar
April
 
Posts: 3479
Joined: Tue Jun 20, 2006 1:33 am

Post » Wed Aug 27, 2014 7:03 am

I might try that at some point, I'm just hoping this would work, and I'm not entirely sure why it doesn't.

There's one other script, on the player alias, so if they set the hotkey by console it registers properly (since usually the MCM does that):

Scriptname NYHPlayerAliasScript extends ReferenceAlias  NYHControlScript Property OwningScript Auto Event OnPlayerLoadGame()	OwningScript.RegisterForNYHHotkey(true)	OwningScript.RegisterForNYHHotkey()	EndEvent
User avatar
Sammygirl
 
Posts: 3378
Joined: Fri Jun 16, 2006 6:15 pm


Return to V - Skyrim