Jueix Posted May 23, 2020 Share Posted May 23, 2020 So in my bot I need the bot to press key 2 (To make an item, can't be asked getting the widget shit for it) I know the keyboard key type for space is 32 but how can I find out the keyboard type for 2? E.G Space is getKeyboard().typeKey((char) 32); Quote Link to comment Share on other sites More sharing options...
D9BLADEE Posted May 23, 2020 Share Posted May 23, 2020 http://www.asciitable.com/ 2 would be 50 2 Quote Link to comment Share on other sites More sharing options...
Lol_marcus Posted May 23, 2020 Share Posted May 23, 2020 (edited) A simpler method would be to use: keyboard.typeString("2"); for 2 keyboard.typeString(" "); for space Another example: public void example() throws InterruptedException { if (//something) { keyboard.typeString("2"); new ConditionalSleep(200, 200) { @Override public boolean condition() { return //somethingelse; } }.sleep(); } } or if you want to use widgets: public void example2() throws InterruptedException { RS2Widget test= getWidgets().get(458, 1); if (test!= null && test.isVisible()) { keyboard.typeString("2"); new ConditionalSleep(200, 200) { @Override public boolean condition() { return (//something); } }.sleep(); } } Edited May 23, 2020 by Lol_marcus Quote Link to comment Share on other sites More sharing options...
Gunman Posted May 23, 2020 Share Posted May 23, 2020 Could also go here and press the key https://keycode.info/ 1 Quote Link to comment Share on other sites More sharing options...
Nbacon Posted May 25, 2020 Share Posted May 25, 2020 I would use getKeyboard().typeKey(KeyEvent.VK_SPACE); and getKeyboard().typeKey(KeyEvent.VK_2); or getKeyboard().typeKey(' '); and getKeyboard().typeKey('2'); I don't see why you would hardcode it with a value that is not 100% obvious (to you in a few weeks of not working on it and others tring to read your code). Quote Link to comment Share on other sites More sharing options...