FurryEskimo Posted September 22, 2021 Share Posted September 22, 2021 (edited) I've already (more-or-less) figured out how to detect when the player presses a key, so I can turn abilities on and off at will, but when players are typing to talk or enter code, the key presses are still registered. Is there a way to detect when players are entering text, vs when a key is simply being pressed? I've heard that some mods do this. Update: I think I found an example, but there's a lot here I've never seen before.. Specifically, why is the second half of their code so different from what I have? AddModRPCHandler("The Wild Child -Ver. 1.3.4.7","ToogleSwimming",ToogleSwimming) GLOBAL.TheInput:AddKeyDownHandler(GLOBAL.key_to_swim, function() if GLOBAL.ThePlayer then SendModRPCToServer(MOD_RPC["The Wild Child -Ver. 1.3.4.7"]["ToogleSwimming"]) end end) AddModRPCHandler(modname, "widgette_bundle", widgette_bundle) GLOBAL.TheInput:AddKeyDownHandler(GetModConfigData("key_bundle", true), function() if not GLOBAL.ThePlayer or GLOBAL.ThePlayer.prefab ~= "widgette" or GLOBAL.TheFrontEnd:GetActiveScreen() ~= GLOBAL.ThePlayer.HUD then return end if GLOBAL.TheNet:GetIsServer() then widgette_bundle(GLOBAL.ThePlayer) else SendModRPCToServer(MOD_RPC[modname]["widgette_bundle"]) end end) Edited September 22, 2021 by FurryEskimo Link to comment https://forums.kleientertainment.com/forums/topic/133875-detect-when-a-player-is-typing/ Share on other sites More sharing options...
Helwdrokin Posted September 24, 2021 Share Posted September 24, 2021 (edited) On 9/22/2021 at 7:56 PM, FurryEskimo said: try to use this if statement if _G.ThePlayer and not _G.ThePlayer.HUD:IsChatInputScreenOpen() and not _G.ThePlayer.HUD:IsConsoleScreenOpen() and not _G.ThePlayer.HUD.writeablescreen then Edited September 24, 2021 by Helwdrokin 1 Link to comment https://forums.kleientertainment.com/forums/topic/133875-detect-when-a-player-is-typing/#findComment-1498133 Share on other sites More sharing options...
FurryEskimo Posted September 24, 2021 Author Share Posted September 24, 2021 (edited) @Helwdrokin Thanks a lot! I actually did manage to figure it out. ^-^ The first part of their check made sure no one was trying, and the second part appears to be outdated, and is related to caves, so I just used what I had. The ‘modname’ is apparently just some unique indicator to help with the code, so I simplified mine. I think a lot of people use ‘modname’, which may lead to errors if using the mods at the same time (idk for sure though). Edited September 24, 2021 by FurryEskimo Link to comment https://forums.kleientertainment.com/forums/topic/133875-detect-when-a-player-is-typing/#findComment-1498136 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now