AutoChallenge (hardcoded to population, no +4 level check)

Automates the challenge functionality of Nationstates, warning works only for level +4 advantage!

< 脚本AutoChallenge (hardcoded to population, no +4 level check)的反馈

提问/评论

§
发表于:2016-07-12

How to reset this script?

This script sems to save the challenger i first challenged. and i can't seem to reset it. Does someone know how to reset this script?


function reloadChallengePage(){


//Acquire proper nation names via first links in challenge screen.
var self = document.getElementsByClassName("nlink")[0].href.split("=")[1]
var target = document.getElementsByClassName("nlink")[1].href.split("=")[1]

var nations = self + "+" + target;
var specialty = "66" //hardcoded to youth rebellion. Check bottom of script for full list of values and their description
var go = "+Go!+";


//Performs a post or get with the specified key/values.
performPost(window.location, {nations:nations,speciality:specialty,go:go});


function performPost(path1, params, method1) {

//console.log(params);
//alert(params);
method1 = method1 || "post"; // Set method to post by default if not specified.

// The rest of this code assumes you are not using a library.
// It can be made less wordy if you use one.
var form = document.createElement("form");
form.setAttribute("method", method1);
form.setAttribute("action", path1);

for(var key in params) {
if(params.hasOwnProperty(key)) {
var hiddenField = document.createElement("input");
hiddenField.setAttribute("type", "hidden");
hiddenField.setAttribute("name", key);
hiddenField.setAttribute("value", params[key]);

form.appendChild(hiddenField);
}
}

document.body.appendChild(form);
form.submit();
}


}

window.onload = function () {


//See if there is a 'Round 1' and click it, then schedule a reload.
var link = document.getElementsByClassName("next-round")[0];
if(link) {
link.click();
//link.click();
setTimeout(reloadChallengePage,3600 + (Math.random() * 200)); //random reload time to avoid raising flags if Nationstates has certain measures in effect.
}

};

发表回复

登录以发表回复。