Jump to content

Recommended Posts

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 :).

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 ;)

 

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.

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.

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;
    }
}

 

5 hours ago, Droidz 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.

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?

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.

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"

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

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?

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...