expert975 Posted October 8, 2015 Share Posted October 8, 2015 (edited) Is there a way to bind keys to a function? Edited October 8, 2015 by expert975 Link to comment Share on other sites More sharing options...
Developer PeterA Posted October 9, 2015 Developer Share Posted October 9, 2015 You should be able to do something similar to what my quick emotes mod does. In modmain.luafunction KeyHandler( key, down ) if down then if key == GLOBAL.KEY_F1 then --change this to whatever key you want to listen to --your code goes here end endendfunction gamepostinit() GLOBAL.TheInput:AddKeyHandler( KeyHandler )end--add a post init to the game starting upAddGamePostInit(gamepostinit) You could also try using this call instead, but I haven't used it recently. GLOBAL.TheInput:AddKeyDownHandler( GLOBAL.KEY_F1, YourFunction ) 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