Blaise1203 Posted April 10, 2021 Share Posted April 10, 2021 (edited) function CloseInCombat() if game.GetPlayer().IsInCombat() debug.Notification("I can't do this in combat!") utility.WaitMenuMode(0.150000) input.TapKey(Input.GetMappedKey("Tween Menu")) utility.WaitMenuMode(0.150000) endIf endFunction i am trying to make it so if the journal or loading menu are opened while in combat then it will be closed before the player has enough time to do anything however the script wont close the menu it will give me the debug notification but wont close so can someone tell me where i went wrong edit1: if i change the input.getmappedkey to a number it works however that will only work if the player has not changed their controls and will not work on controller if the number is like 15 Edited April 10, 2021 by Blaise1203 Link to comment Share on other sites More sharing options...
Blaise1203 Posted April 10, 2021 Author Share Posted April 10, 2021 (edited) i fixed that issue now however i cant get the code to work with the game padthe fixed code for keyboard and mouse function CloseInCombat() if game.GetPlayer().IsInCombat() debug.Notification("I can't do this in combat!") self.iKey() utility.WaitMenuMode(0.050000) endIf endFunction function iKey() int numberAny = Input.GetMappedKey("Tween Menu",0xff) If numberAny == Input.GetMappedKey("Tween Menu",0xff) Input.TapKey(numberAny) endIf endFunction Edited April 10, 2021 by Blaise1203 Link to comment Share on other sites More sharing options...
dylbill Posted April 10, 2021 Share Posted April 10, 2021 Use 0x02 for gamepad. You can maybe check if the menu is still open and then detect gamepad if it is: function iKey() int numberAny = Input.GetMappedKey("Tween Menu",0xff) If numberAny == Input.GetMappedKey("Tween Menu",0xff) Input.TapKey(numberAny) endIf Utility.WaitMenumode(0.1) If UI.IsMenuOpen("Journal Menu") numberAny = Input.GetMappedKey("Tween Menu",0x02) Input.TapKey(numberAny) Endif endFunction Link to comment Share on other sites More sharing options...
Blaise1203 Posted April 10, 2021 Author Share Posted April 10, 2021 i have tried that. I even used the exact code you put but still no luck, i don't know what is wrong Link to comment Share on other sites More sharing options...
dylbill Posted April 10, 2021 Share Posted April 10, 2021 Hmmm, I dunno then. It's possible that TapKey doesn't work for gamepad. Link to comment Share on other sites More sharing options...
dylbill Posted April 10, 2021 Share Posted April 10, 2021 A few workarounds to consider. Using: Game.DisablePlayerControls() Game.EnablePlayerControls()Will force close some menus. I don't think it works on the Journal Menu but will work on the Stats Menu or Inventory Menu. For journal, if you want to prevent saving you can use SetInChargen. Disable on combat start then enable again when combat ends. https://www.creationkit.com/index.php?title=SetInChargen_-_Game Link to comment Share on other sites More sharing options...
Blaise1203 Posted April 10, 2021 Author Share Posted April 10, 2021 (edited) well then that's annoying i guess ill keep trying to find an alternative to the tapkey Edited April 10, 2021 by Blaise1203 Link to comment Share on other sites More sharing options...
Blaise1203 Posted April 10, 2021 Author Share Posted April 10, 2021 (edited) i didn't want to just disable saving but loading and quitting the game or to main menu while in combat Edited April 10, 2021 by Blaise1203 Link to comment Share on other sites More sharing options...
dylbill Posted April 10, 2021 Share Posted April 10, 2021 Ok I thought of a possible solution. Since tapKey doesn't seem to work for game pad, have the script make it so you stop using gamepad at the start of the function, then re-enable gamepad at the end of the function function iKey() Bool GamepadCheck = Utility.GetIniBool("bGamepadEnable:MAIN") If GamepadCheck == True Utility.SetIniBool("bGamepadEnable:MAIN", False) Endif Utility.WaitMenuMode(0.1) int numberAny = Input.GetMappedKey("Tween Menu",0xff) Input.TapKey(numberAny) Utility.WaitMenuMode(0.1) If GamepadCheck == True Utility.SetIniBool("bGamepadEnable:MAIN", True) Endif endFunctionI haven't tested but I think it would work. Link to comment Share on other sites More sharing options...
Blaise1203 Posted April 10, 2021 Author Share Posted April 10, 2021 alright did testing it is registering the controller as key press -1 which does not link to any key whether keyboard or gamepad Link to comment Share on other sites More sharing options...
Recommended Posts