monsto Posted January 31, 2017 Share Posted January 31, 2017 In papyrus, what's the best way to set up using a modifier key? Like ctrl or alt. I've looked at the Input Script, but i'm unsure of pitfalls, requirements, or are generally the best methods to use those functions. I could probably stab this to death to figure out a way to get it done, but the question is about potential problems and/or the best way to do it. My main concern is that something like Ctrl W would fire the the game bindings for those keys. How can I avoid that? Link to comment Share on other sites More sharing options...
IsharaMeradin Posted January 31, 2017 Share Posted January 31, 2017 I know of one mod that used Shift+L by default for something. You could probably look and see how that was done.https://afkmods.iguanadons.net/index.php?/files/file/1844-just-do-it/ Link to comment Share on other sites More sharing options...
monsto Posted January 31, 2017 Author Share Posted January 31, 2017 Most excellent. Thanks. Link to comment Share on other sites More sharing options...
cdcooley Posted February 1, 2017 Share Posted February 1, 2017 The short answer is that you won't be able to prevent the normal game actions for keys that are already bound. So Ctrl + W is a bad example since both Ctrl and W are bound to actions by default and W is active in just about every situation. I make use of modifiers in my Storage Helpers mod. Pressing NumLock triggers item placement but pressing Alt + NumLock triggers item renaming instead. I used RegisterForKey on the NumLock key and then when the event fires I use IsKeyPressed to see if Alt is also being held. At least with default bindings Shift and Alt are usually safe to use as a modifier. Ctrl can be used inside inventory menus and while the console is open, but not when normal player controls are active. If you're wanting to avoid conflicts you'll want to use SkyUI's key conflict system although it still won't catch everything since not all mods (mine included) bother properly registering their keys with its tracking system. The best option is to provide a way for the user to change both the main key and modifier key. Link to comment Share on other sites More sharing options...
monsto Posted February 1, 2017 Author Share Posted February 1, 2017 https://www.reddit.com/r/skyrimmods/comments/5r4n4p/setting_up_a_modifier_key_shift_alt_etc_for/dd4o0pz/ The crux: Game.disablePlayerControls(); works as advertised. What i'm doing is i have a "mode" key. Press NUM0 to activate my keys. I haven't done it yet, but I'll probably disable everything except movement & looking while in my mods mode by using the flags on that function. Link to comment Share on other sites More sharing options...
cdcooley Posted February 2, 2017 Share Posted February 2, 2017 That's a nice trick for disabling other keys, but it's only going to work for the game's own controls. Other mods that have created custom key mappings won't know about your mod and so will still run whatever scripted activities they use for their own key mapping. Link to comment Share on other sites More sharing options...
monsto Posted February 3, 2017 Author Share Posted February 3, 2017 (edited) That's a nice trick for disabling other keys, but it's only going to work for the game's own controls. Other mods that have created custom key mappings won't know about your mod and so will still run whatever scripted activities they use for their own key mapping. The original question, and your first response, was about game keys, which can be disabled with that function. I'm not concerned about other mods. I can't begin to know and i'm not even going to pretend to avoid conflicts with other mods. Simply too many. Edited February 3, 2017 by monsto Link to comment Share on other sites More sharing options...
Recommended Posts