Gossler Posted July 21, 2019 Share Posted July 21, 2019 Hi there, I am attempting to modify the earplug script such that the users of our server can set their own activation key (IE: not Pause/Break) via the Use Action 1-20 custom keys. I am also very new to scripting and so I am having issues with this. The script uses displayAddEventHandler to compare the key pressed to Pause/Break (197) but I dont know how to reference the Custom Controls keys inside of that script. Any help? This is where Im at. The commented line is the original, and I am just attempting to have a hint show the number of the key pressed. Where do I go from here? I want the key to be set by Use Action 20. Thanks for any help! _UKD = actionKeys "User20"; //MEP_KD = (findDisplay 46) displayAddEventHandler ["KeyDown", "if (_this select 1 == 197) then {_this call earplugAction;};"]; MEP_KD = (findDisplay 46) displayAddEventHandler ["KeyDown", "if (_this select 1 == _UKD) then {hint str _UKD};"]; Link to comment Share on other sites More sharing options...
Stanhope Posted July 21, 2019 Share Posted July 21, 2019 I'm assuming you're getting an undefined error? Because _UKD isn't defined inside the eventhandler scope. Link to comment Share on other sites More sharing options...
Gossler Posted July 21, 2019 Author Share Posted July 21, 2019 Its actually not doing anything. No errors, and no hint display. I tried adding "actionKeys "User 20" directly into the displayAddEventHandler and I got an error saying the type was incorrect. Link to comment Share on other sites More sharing options...
Stanhope Posted July 21, 2019 Share Posted July 21, 2019 That's because actionKeys returns an array of numbers and "==" can't compare a number with an array. 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