I promise this will be the last thread for a while. Really.
Alright, onto the issue. I have a script with an OnKeyDown event. The key is registered correctly, and everything is set correctly the first time you use the key. Then, after that, it kind of functions. It'll take a little while to work, and then it'll show the debug. However, once you've used the key about 10 times, you're never able to use it again and it stops functioning. This is the script:
Scriptname SAFControlScript extends Quest Message Property SummonConfirmation Auto {0 is cancel, 1 is confirm}GlobalVariable Property SAFKey Auto {To choose a follower to summon}GlobalVariable Property AllowAnyNPC Auto{Disabled by default. If true, allow to choose any NPC for summon. For custom follower framework followers.}Faction Property CurrentFollowerFaction Auto {CurrentFollowerFaction}ReferenceAlias Property FollowerToSummon Auto{Empty property to reference the follower to summon}Bool Ready = True Event OnInit() RegisterForKey(SAFKey.GetValueInt())EndEventEvent OnKeyDown(int keyCode) If KeyCode == SAFKey.GetValueInt() && Ready Debug.MessageBox("Keycode was SAFKey.") If (Game.GetCurrentCrosshairRef() as Actor) && !(Game.GetCurrentCrosshairRef() as Actor).IsDead() If AllowAnyNPC.GetValueInt() == 0 && (Game.GetCurrentCrosshairRef() as Actor).IsInFaction(CurrentFollowerFaction) Int Button = SummonConfirmation.Show() While SummonConfirmation If Button == 1 ;confirm FollowerToSummon.Clear() FollowerToSummon.ForceRefTo(Game.GetCurrentCrosshairRef() as Actor) EndIf EndWhile ElseIf AllowAnyNPC.GetValueInt() == 1 ;NPC is actor and AllowAnyNPC is true Int Button = SummonConfirmation.Show() While Button If Button == 1 ;confirm FollowerToSummon.Clear() FollowerToSummon.ForceRefTo(Game.GetCurrentCrosshairRef() as Actor) EndIf EndWhile EndIf Ready = False Utility.Wait(3.0) Ready = True EndIf EndIfEndEventFunction RegisterForSAFKey(bool abUnregister = false) If !abUnregister RegisterForKey(SAFKey.GetValueInt()) Debug.MessageBox("Registered for SAFKey.") Else UnregisterForAllKeys() EndIfEndFunction
And then I have an issue where the alias I forced the actor in your crosshair to in the above script is always NONE. No matter what I do. This is the picture of the alias:
http://s1295.photobucket.com/user/Matthiaswagg/media/Screenshot56_zps1745cae5.png.html?filters%5Buser%5D=141050589&filters%5Brecent%5D=1&sort=1&o=0
Lastly, I have an issue with my MCM where a toggle option won't work, and I have no idea why. The select event registers, but the global is never changed. (All properties are filled, double-checked.) This is the MCM:
Scriptname SAFMCMScript extends SKI_ConfigBase ;Properties and Variables;============================GlobalVariable Property SAFHotkey Auto {Set Summon Follower hoteky}GlobalVariable Property SAFAllowNPC Auto {Allow any NPCs to be the follower summon}SAFControlScript Property SAFControl Auto{SAFControlScript property};Events;=======Event OnPageReset(string a_page) If a_page == "" LoadCustomContent("SAF/SAFIcon.dds", 0, 0);x, y Else UnloadCustomContent() EndIf If a_page == "Options" SetCursorFillMode(TOP_TO_BOTTOM) AddKeyMapOptionST("SAFHotkeyState", "Set Follower Summon", SAFHotkey.GetValueInt()) AddToggleOptionST("SAFAllowNPCState", "Custom Follower Support", SAFAllowNPC.GetValueInt()) AddTextOptionST("SAFGuideState", "Guide", "Help") EndIfEndEventEvent OnConfigClose() SAFControl.RegisterForSAFKey(true) SAFControl.RegisterForSAFKey()EndEvent;States;=======State SAFHotkeyStateEvent OnKeyMapChangeST(Int newKeyCode, String conflictControl, String conflictName) Bool ContinueSAFKey = true If (conflictControl != "") String SAFKeyHotkeyMsg If (conflictName != "") SAFKeyHotkeyMsg = "This key is already mapped to:\n\"" + conflictControl + "\"\n(" + conflictName + ")\n\nAre you sure you want to continue?" Else SAFKeyHotkeyMsg = "This key is already mapped to:\n\"" + conflictControl + "\"\n\nAre you sure you want to continue?" EndIf ContinueSAFKey = ShowMessage(SAFKeyHotkeyMsg, true, "$Yes", "$No") EndIf If (ContinueSAFKey) SAFHotkey.SetValueInt(newKeyCode) SetKeymapOptionValueST(SAFHotkey.GetValueInt()) EndIf EndEventEvent OnHighlightST() SetInfoText("Change the hotkey used to set the follower to summon.\n Default is ].") EndEventEvent OnDefaultST() SAFHotkey.SetValueInt(27) SetKeyMapOptionValueST(SAFHotkey.GetValueInt()) EndEventEndStateState SAFAllowNPCStateEvent OnSelectST() ShowMessage("Selected SAFAllowNPC toggle.", true) If SAFAllowNPC.GetValueInt() == 0 SAFAllowNPC.SetValueInt(1) Else SAFAllowNPC.SetValueInt(0) EndIfEndEventEvent OnDefaultST() SAFAllowNPC.SetValueInt(0)EndEventEvent OnHighlightST() SetInfoText("Allow custom follower support.\n Enabling it will allow you to choose ANY NPC as your summon, follower or not.")EndEventEndStateState SAFGuideStateEvent OnSelectST() ShowMessage("Summon Any Follower allows you to select any follower and summon them. Currently, there is one slot for a follower to summon.\n To choose a new follower to summon, press the assigned hotkey (default is ]) when looking at your follower. Then confirm that you want that NPC to be your follower summon. Now you can use your Summon Follower spell to summon the designated follower whenever you want.\n The custom follower support allows you to choose ANY NPC, not just followers, to be your summon, since not all custom followers are classified as followers. This feature can be toggled in the MCM.", false)EndEventEvent OnHighlightST() SetInfoText("An explanation of what this mod does.")EndEventEndState
Does anybody have any input on any of these problems? Help would be appreciated.