Skip to content

Instantly share code, notes, and snippets.

@Noobgam
Last active February 26, 2018 20:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Noobgam/aed9750dd0cc1196cfdd5fb30facff65 to your computer and use it in GitHub Desktop.
Save Noobgam/aed9750dd0cc1196cfdd5fb30facff65 to your computer and use it in GitHub Desktop.
var arrival = new Date(2018, 1, 26, 23, 27, 0, 0);
btn = document.getElementById("troop_confirm_go");
x = 1;
y = 5;
dist = Math.sqrt(x * x + y * y);
speed = 18;
//speed = 10.256410635108494;
game_speed = 1.5
troop_speed = 0.65
multiplier = 0.9096822222222225
//multiplier = 0.9089710480133807;
//multiplier = 0.9091126874443135
//multiplier = 0.9091111776859832
//42:47
//2:22:38
time_to_go = dist * ((speed / game_speed / troop_speed) * multiplier) * 60 * 1000;
console.log(time_to_go);
dt = new Date();
setTimeout( function() {
//btn.click();
}, arrival - dt - time_to_go);
console.log('Waiting');
console.log(arrival - dt);
console.log(time_to_go);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment