JohnWatson Posted December 28, 2016 Share Posted December 28, 2016 I made a mod that relies on keystrokes, however, that makes it harder to type in the console because it would perform its functions while I'm typing in it. Is there a way to check if the console is open? 1 Link to comment Share on other sites More sharing options...
CarlZalph Posted December 28, 2016 Share Posted December 28, 2016 15 minutes ago, JohnWatson said: I made a mod that relies on keystrokes, however, that makes it harder to type in the console because it would perform its functions while I'm typing in it. Is there a way to check if the console is open? Mostly what is done is checking if the user is actively in-game via: local function cz_hotkey_checker() local curScreen = TheFrontEnd:GetActiveScreen() if(curScreen and curScreen.name=="HUD") then return false end return true end TheInput:AddKeyUpHandler( KEY_Z, function() if cz_hotkey_checker() then return end -- Do stuff end ) 1 Link to comment Share on other sites More sharing options...
JohnWatson Posted December 28, 2016 Author Share Posted December 28, 2016 19 hours ago, CarlZalph said: Mostly what is done is checking if the user is actively in-game via: local function cz_hotkey_checker() local curScreen = TheFrontEnd:GetActiveScreen() if(curScreen and curScreen.name=="HUD") then return false end return true end TheInput:AddKeyUpHandler( KEY_Z, function() if cz_hotkey_checker() then return end -- Do stuff end ) Thanks, mate. Works just fine. Link to comment 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