elec0 / bitburner-scripts Goto Github PK
View Code? Open in Web Editor NEWStorage for my bitburner (idle hacking game) scripts
Storage for my bitburner (idle hacking game) scripts
Basically it would die on the up/down one unless you has the upgrade. So I modified the code so it can be used with or without the upgrade, detecting whatever.
{
name: "enter the code",
init: function (screen) {
//state.game.data = "";// →?????????
const h4 = getEl(screen, "h4");
const code = h4[1].textContent;//.match(/.*\/([↑↓←→])$/);
if(code.includes('?')){
state.game.data = "";
} else {
state.game.data = [];
for (let i = 0; i < code.length; i++) {
const s = code[i];
switch (s) {
case "↑":
state.game.data.push("w");
break;
case "↓":
state.game.data.push("s");
break;
case "←":
state.game.data.push("a");
break;
case "→":
state.game.data.push("d");
break;
default:
break;
}
}
}
// since we are upgraded we have to change the bottom
},
play: function (screen) {
if(!Array.isArray(state.game.data)){
const h4 = getEl(screen, "h4");
const code = h4[1].textContent;//.match(/.*\/([↑↓←→])$/);
const last = code.match(/[↑↓←→]/g);
const s = last[last.length-1];
console.log("0 match: " + s + "::" + last + " ff "+ code);
if(state.game.data != "" && code == state.game.data)
return;
state.game.data = code;
console.log("1: " + code);
switch (s) {
case "↑":
pressKey("w");
break;
case "↓":
pressKey("s");
break;
case "←":
pressKey("a");
break;
case "→":
pressKey("d");
break;
default:
break;
}
} else {
if (!state.game.data || !state.game.data.length) {
delete state.game.data;
return;
}
pressKey(state.game.data.shift());
}
/*
const h4 = getEl(screen, "h4");
const code = h4[1].textContent;//.match(/.*\/([↑↓←→])$/);
const last = code.match(/[↑↓←→]/g);
const s = last[last.length-1];
console.log("0 match: " + s + "::" + last + " ff "+ code);
if(state.game.data != "" && code == state.game.data)
return;
state.game.data = code;
console.log("1: " + code);
switch (s) {
case "↑":
pressKey("w");
break;
case "↓":
pressKey("s");
break;
case "←":
pressKey("a");
break;
case "→":
pressKey("d");
break;
default:
break;
}
*/
},
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.