Skip to content

Instantly share code, notes, and snippets.

@haykam821
Last active March 22, 2017 23:12
Show Gist options
  • Save haykam821/344c222cf6ceb981d4e57abb8c8fc8f4 to your computer and use it in GitHub Desktop.
Save haykam821/344c222cf6ceb981d4e57abb8c8fc8f4 to your computer and use it in GitHub Desktop.
A TamperMonkey extension to reverse Diep.io's keybinds. This includes 1-8 for stat upgrades, movement using arrow keys and WASD, and C+E.
// ==UserScript==
// @name Reverse Binds for Diep
// @namespace http://reddit.com/user/haykam821/
// @version 0.2
// @description A TamperMonkey extension to reverse Diep.io's keybinds. This includes 1-8 for stat upgrades, movement using arrow keys and WASD, and C+E.
// @author /u/haykam821
// @match http*://diep.io/*
// @grant none
// ==/UserScript==
window.onload=function(){console.log('Yay, Reverse Binds for Diep is alive.');};
var change = {38:40,40:38,37:39,39:37,49:56,50:55,51:54,52:53,53:52,54:51,55:50,56:49,87:83,83:87,65:68,68:65,67:69,69:67};
function changeCodes(e){
if (change[e.keyCode]!==undefined) {
code = change[e.keyCode];
} else {
code = e.keyCode;
}
return code;
}
window.onkeydown=function(e){window.input.keyDown(changeCodes(e));};
window.onkeyup=function(e){window.input.keyUp(changeCodes(e));};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment