// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://hordes.io/play
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
document.addEventListener('keydown', function(evt) {
if (evt.key === "N") {
element.dispatchEvent(new KeyboardEvent('keydown', {'key': '2'}));
element.dispatchEvent(new KeyboardEvent('keydown', {'key': '3'}));
element.dispatchEvent(new KeyboardEvent('keydown', {'key': '5'}));
element.dispatchEvent(new KeyboardEvent('keydown', {'key': '6'}));
}
});
I want to make the code stimulate pressing keys on the keyboard (2, 3, 5, and 6) when I press the key "N". This is a Tampermonkey script, if that information is helpful. I'm having trouble finding what I should define the variable "element" as. Thank you! :)
Also, does anyone know a website that tells me all the keycodes for the keyboard keys?