stingy / Ogame antigame keys

// ==UserScript==
// @name        Ogame antigame keys
// @namespace   ogame
// @description antigame helper
// @include     *.ogame*gameforge.com/game/index.php?page=galaxy
// @version     1
// @grant       none
// ==/UserScript==

var counter = 0;

function timeout() {
    var min = 2186;
    var max = 3123;
    setTimeout(function () {
        if (counter <499){
            submitOnKey(39);
            timeout();
            counter++;
        } else {
            submitOnKey(38);
            counter = 1;
            timeout();
        }
        console.log(counter);
    }, Math.random() * (max - min) + min);
}
timeout();