Last active
December 18, 2015 21:38
-
-
Save revdancatt/5848587 to your computer and use it in GitHub Desktop.
adarkroom game automated button clicking (for mid resource gathering gameplay).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Handy adarkroom automated button clicking (for mid gameplay) to help stoke | |
// the fire, gather wood and traps (and build new traps if they break). | |
// Attack as often as possible (and eat if need/you can), and dismiss a few | |
// events. | |
// | |
// http://adarkroom.doublespeakgames.com/ | |
// | |
// Paste into the console. | |
// | |
// Stoke fire every 3 minutes | |
setInterval(function() { | |
$('#lightButton').click(); | |
$('#stokeButton').click(); | |
}, 1001 * 60 * 3); | |
// Attack as often as possible | |
setInterval(function() { | |
// dodgy way of checking if we are in 'map' mode. | |
// should robustify this. | |
if ($('#outerSlider').css('left') == '-700px') { | |
// extract the health, work out if we are 10 | |
// below max, in which case attempt to eat. | |
var health = $('#healthCounter').text().split(' ')[1]; | |
var current = parseInt(health.split('/')[0], 10); | |
var max = parseInt(health.split('/')[1], 10); | |
if (current < max - 10) { | |
$('#eat').click(); | |
} | |
// Attack with all the things!! | |
$('#attack_bone-spear').click(); | |
$('#attack_iron-sword').click(); | |
$('#attack_steel-sword').click(); | |
} | |
}, 500); | |
// build a trap whenever we can | |
setInterval(function() { | |
// Build a lodge if we can | |
if (parseInt($('#row_wood .row_val').text(), 10) >= 200 && | |
parseInt($('#row_fur .row_val').text(), 10) >= 10 && | |
parseInt($('#row_meat .row_val').text(), 10) >= 5) { | |
$('#build_lodge').click(); | |
} | |
// Build a hut if we can | |
if (parseInt($('#row_wood .row_val').text(), 10) >= parseInt($('#build_hut .row_val').text(), 10)) { | |
$('#build_hut').click(); | |
} | |
$('#build_cart').click(); | |
if (parseInt($('#row_wood .row_val').text(), 10) >= parseInt($('#build_trap .row_val').text(), 10)) { | |
$('#build_trap').click(); | |
} | |
}, 1003 * 5); | |
// gather wood and check traps | |
setInterval(function() { | |
$('#gatherButton').click(); | |
$('#trapsButton').click(); | |
}, 1004); | |
// dismiss popups | |
setInterval(function() { | |
$('#goodbye').click(); | |
$('#investigate').click(); | |
$('#deny').click(); | |
$('#backinside').click(); | |
// only when we are not on the map | |
if ($('#outerSlider').css('left') == '0px' || $('#outerSlider').css('left') == 'auto') { | |
$('#leave').click(); | |
} | |
}, 1002 * 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment