Apexx 60 Posted October 12, 2017 Share Posted October 12, 2017 Hello, is there a way to get keys pressed? I would like to have two "keybinds", to my plugin if it is at all possible? Link to comment Share on other sites More sharing options...
arkhan 11 Posted October 12, 2017 Share Posted October 12, 2017 Hello, nerver tried but take a look here: it's talking about _hookKeybindingsSpells Link to comment Share on other sites More sharing options...
Avvi 98 Posted October 12, 2017 Share Posted October 12, 2017 18 minutes ago, Apexx said: Hello, is there a way to get keys pressed? I would like to have two "keybinds", to my plugin if it is at all possible? Can you explain a little more on what you mean? If you're asking if it's possible to Press a Keybind from a Plugin , the answer is yes. If your question is: Is it possible to click a WoW macro by using a Keybind from a plugin, then answer is yes :). Link to comment Share on other sites More sharing options...
Apexx 60 Posted October 12, 2017 Author Share Posted October 12, 2017 I would like to have the ability to add or remove the nearest WoW game object to the collections list for my WRadar plugin using hotkeys, like "Shift+Insert" and "Shift+Delete". Link to comment Share on other sites More sharing options...
Apexx 60 Posted October 12, 2017 Author Share Posted October 12, 2017 I just keep getting the following in log Quote [D] 13:26:25 - [Keyboard Hook] Couldn’t register the hot key. Link to comment Share on other sites More sharing options...
reapler 154 Posted October 12, 2017 Share Posted October 12, 2017 Hello, you may decompile my plugin which uses keyboardhook & gui: https://wrobot.eu/files/file/1213-aoebutton/ I hope it's self-explaining, since it's quite old and can't remember anything ;) Avvi 1 Link to comment Share on other sites More sharing options...
Apexx 60 Posted October 12, 2017 Author Share Posted October 12, 2017 I will take a look @reapler Link to comment Share on other sites More sharing options...
Apexx 60 Posted October 12, 2017 Author Share Posted October 12, 2017 I looked into the code and it seems you had used your own form events handling. I am using the WRobot's settings window from inside the class itself. I don't think the InputHook catches anything while the game window has focus. I guess I am trying to catch the even from WRobot directly. Link to comment Share on other sites More sharing options...
reapler 154 Posted October 12, 2017 Share Posted October 12, 2017 19 minutes ago, Apexx said: I looked into the code and it seems you had used your own form events handling. I am using the WRobot's settings window from inside the class itself. I don't think the InputHook catches anything while the game window has focus. I guess I am trying to catch the even from WRobot directly. I initially implemented it, because sometimes i had a bug from WRobot's keyboard class which didn't hooked my keys, dunno if it's fully working now. Link to comment Share on other sites More sharing options...
Apexx 60 Posted October 12, 2017 Author Share Posted October 12, 2017 Yeah I cannot get WRobot's keyboard class to work either. Seen the examples throughout the forums though. public class Main : IPlugin { private Wradar.InputHook.KeyboardHook _hook; private Keys _keyAdd = Keys.None; private Keys _keyRemove = Keys.None; public void Initialize() { _keyAdd = Keys.F5; _keyRemove = Keys.F6; _hook = new Wradar.InputHook.KeyboardHook(true); // Strange it doesn't work with this set as Global _hook.KeyDown += HookOnKeyDown; _isLaunched = true; } private void HookOnKeyDown(Keys key, bool shift, bool ctrl, bool alt) { Logging.WriteDebug("key = " + key); if (key == _keyAdd) { try { Logging.WriteDebug("Would you like to add ____ object to the collections list?"); } catch (Exception ex) { Logging.WriteError("HookOnKeyDown _keyAdd Error:\n" + ex); } } else if(key == _keyRemove) { try { Logging.WriteDebug("Would you like to remove ____ object from the collections list?"); } catch (Exception ex) { Logging.WriteError("HookOnKeyDown _keyRemove Error:\n" + ex); } } } public void Dispose() { try { if (_hook != null) { _hook.KeyDown -= HookOnKeyDown; _hook.Dispose(); } } catch { } _isLaunched = false; } } Link to comment Share on other sites More sharing options...
Droidz 2738 Posted October 13, 2017 Share Posted October 13, 2017 Do you have look this: https://wrobot.eu/forums/topic/12-how-to-create-an-fight-class-developer-only/?do=findComment&comment=6778 Link to comment Share on other sites More sharing options...
Apexx 60 Posted October 13, 2017 Author Share Posted October 13, 2017 5 hours ago, Droidz said: Do you have look this: https://wrobot.eu/forums/topic/12-how-to-create-an-fight-class-developer-only/?do=findComment&comment=6778 Yes I did. I have searched and tried everything from the forums that returned anything to do with keyboard events. I will double check the .Net framework version in a bit. Link to comment Share on other sites More sharing options...
Apexx 60 Posted October 13, 2017 Author Share Posted October 13, 2017 Would it be easier to create a small addon for WoW directly that communicates with the plugin? I don't have much knowledge integrated an addon with WRobot. How would one get/set variables from WRobot plugin data to an addon? Link to comment Share on other sites More sharing options...
Apexx 60 Posted October 14, 2017 Author Share Posted October 14, 2017 Yeah I don't think KeyboardHook is working. I have tried using Target framework .NET Framework 4.5 as well as other later versions and it still cannot register hot key. I also tried many different variations of hot key combinations. Link to comment Share on other sites More sharing options...
Droidz 2738 Posted October 15, 2017 Share Posted October 15, 2017 On 13/10/2017 at 5:03 PM, Apexx said: Yes I did. I have searched and tried everything from the forums that returned anything to do with keyboard events. I will double check the .Net framework version in a bit. In your code you don't "RegisterHotKey" Link to comment Share on other sites More sharing options...
Apexx 60 Posted October 15, 2017 Author Share Posted October 15, 2017 No that was code from checking out reapler's project file and trying his Keyboard Hook class. I have attached my log file, and an example plugin that uses the same code found by you on other threads to activate spells via key bind 15 Oct 2017 10H07.log.html KeyboardHook.cs Link to comment Share on other sites More sharing options...
Apexx 60 Posted October 17, 2017 Author Share Posted October 17, 2017 bump Link to comment Share on other sites More sharing options...
iMod 99 Posted October 17, 2017 Share Posted October 17, 2017 readonly KeyboardHook _hookKeybinding = new KeyboardHook(); public InitMethod() { _hookKeybinding.KeyPressed += (object sender, KeyPressedEventArgs e) => { Logging.Write("Key was pressed!"); }; _hookKeybinding.RegisterHotKey(ModifierKeys.Shift, Keys.Insert); } Something like this is not working for you? Link to comment Share on other sites More sharing options...
Apexx 60 Posted October 17, 2017 Author Share Posted October 17, 2017 No, still not working. Link to comment Share on other sites More sharing options...
Avvi 98 Posted October 17, 2017 Share Posted October 17, 2017 2 hours ago, Apexx said: No, still not working. Just to be sure, did you call the InitMethod() from your Plugin Initializer? Link to comment Share on other sites More sharing options...
Apexx 60 Posted October 17, 2017 Author Share Posted October 17, 2017 13 minutes ago, Avvi said: Just to be sure, did you call the InitMethod() from your Plugin Initializer? Yes, I did. Link to comment Share on other sites More sharing options...
iMod 99 Posted October 17, 2017 Share Posted October 17, 2017 3 hours ago, Apexx said: No, still not working. Any errors? Link to comment Share on other sites More sharing options...
Apexx 60 Posted October 17, 2017 Author Share Posted October 17, 2017 No errors, just the same [Keyboard Hook] Couldn’t register the hot key. Link to comment Share on other sites More sharing options...
iMod 99 Posted October 17, 2017 Share Posted October 17, 2017 Just now, Apexx said: No errors, just the same [Keyboard Hook] Couldn’t register the hot key. Oh damn i had the same problems y.y thats why i switched over to lua ingame detection. This will be a part for Driodz. Apexx 1 Link to comment Share on other sites More sharing options...
Apexx 60 Posted October 17, 2017 Author Share Posted October 17, 2017 Yeah I don't know. I somewhat give up on it for now. People will just have to pause/stop the bot and go to Plugin Settings to add/remove items from the collections list for now. Thanks though, @iMod 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