Coder Social home page Coder Social logo

bitburner-scripts's People

Contributors

elec0 avatar

Watchers

 avatar

bitburner-scripts's Issues

Just a fix for the automated-infiltration.

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;
			}

*/


		},

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.