holic 238 Posted July 13, 2020 Hey all, I've been going through the javadocs tirelessly trying to find any sort of pressKey or holdKey type functions with no luck. I know not everything DreamBot is in the docs (like setDrawMouse) so I thought I'd ask about it. If there isn't a method with the current API, is there something along the lines of this that I could do instead? (new KeyboardEvent(getClient().getInstance(), "", false)).pressSpecialKey(KeyEvent.VK_CONTROL); I want to be able to hold control and click at the same time to sprint.
Stoned 52 Posted July 13, 2020 You may be able to use something similar to this, though I haven't been able to test it. Instance instance = getClient().getInstance(); Canvas canvas = instance.getCanvas(); Inventory inventory = getInventory(); instance.setKeyboardInputEnabled(true); mouse.getMouseSettings(); canvas.dispatchEvent(new KeyEvent(canvas, KeyEvent.KEY_PRESSED, System.currentTimeMillis(), 0, KeyEvent.VK_CONTROL, KeyEvent.CHAR_UNDEFINED)); //code canvas.dispatchEvent(new KeyEvent(canvas, KeyEvent.KEY_RELEASED, System.currentTimeMillis(), 0, KeyEvent.VK_CONTROL, KeyEvent.CHAR_UNDEFINED)); instance.setKeyboardInputEnabled(false);
holic 238 Author Posted July 13, 2020 1 hour ago, StonedFarmer said: You may be able to use something similar to this, though I haven't been able to test it. Thanks StonedFarmer, that gives me a good starting point. I'll report back if I figure out a working method.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.