Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

killing scripts with workForFaction(faction, "hacking"); in a function #151

Closed
RafnarC opened this issue Oct 10, 2017 · 1 comment
Closed

Comments

@RafnarC
Copy link

RafnarC commented Oct 10, 2017

Ive been having trouble killing a script that has workForFaction(faction, "hacking"); in a function.
I was still trying to debug parts of my script but was having trouble because I could not kill it in a timely manner
Every time i kill it will start the faction work again multiple times then take 15+ minutes to die
The full scrip is below.

function work(faction){
    while (getFactionRep(faction) < rep) {
        if(nonhacking.indexOf(faction)==-1){
            workForFaction(faction, "hacking");
        } else {
            workForFaction(faction,"fieldwork");
        }
        sleep(sleeptime);
    }
}

function workjob(company){
    applyToCompany(company,"software");
    while (getCompanyRep(company) < corprep) {
        workForCompany();
        sleep(sleeptime);
    }```
}

//list of all corp
corps = ["MegaCorp", "Blade Industries", "Four Sigma", "KuaiGong International", "NWO", "OmniTek Incorporated", "ECorp", "Bachman &", "Associates", "Clarke Incorporated", "Fulcrum Technolgies"];
//list of all factions
knownfactions = ["Sector-12", "Aevum", "Tian Di Hui", "Chongqing", "New tokyo", "Ishima", "Volhaven ", "CSEC", "NiteSec ", "The Black Hand", "BitRunners", "Fulcrum Secret Technologies", "Bachman & Associates", "Megacorp", "KuaiGong International", "Clarke Incorporated", "Blade Industries", "Four Sigma", "ECorp", "OmniTek Incorporated ", "Netburners", "Slum Snakes", "Daedalus", "Tetrads", "Illuminati", "The Covenant", "NWO"];
//list of faction that you cant do hacking missions for.
nonhacking = ["Slum Snakes", "Tetrads" ];
// creating the a list of faction your already in 
currentfactions =[];
deletefactions= [];
// other preset veriables
rep = 5000;
maxcorprep = 250000;
corprep = 10000;
corpindex = 0;
sleeptime =240000;
//starting the loop
while (true){
    // check faction invites and accept them then remove them from the knowfacttions list 
    invites = checkFactionInvitations();
    if (invites.length > 0 ){
        for (i=0; i<invites.length;i++){
            joinFaction(invites[i]);
            currentfactions.push(invites[i]);
            index = knownfactions.indexOf(invites[i]);
            if (index > -1){
                knownfactions.splice(index, 1);
            }
        }
    }
    
    
    // check and see if your are already in a faction and add it to the working list 
    i=0;
    for(i=0;i<knownfactions.length;i++){
        if (getFactionRep(knownfactions[i]) > 0){
            //tprint("adding to list "+ knownfactions[i]);
            currentfactions.push(knownfactions[i]);
            deletefactions.push(knownfactions[i]);
        }
    }
    for (i=0;i<deletefactions.length; i++ ){
        
        index = knownfactions.indexOf(deletefactions[i]);
        if (index > -1){
            knownfactions.splice(index, 1);
        }
    }
    
    deletefactions = [];
    //Check if your in a faction to get rep from 
    if(currentfactions.length>0){
            
        // work for faction
        for (i=0;i<currentfactions.length;i++){
            work(currentfactions[i]);
        }
        rep += 10000;
    }
    //work job
    if (corpindex < corps.length){
        workjob(corps[corpindex]);
        corprep += 10000;
        // switching to a new corp if your rep is above 250000 or the set maxcorprep
        if (getCompanyRep(corps[corpindex]) > maxcorprep ){
            corpindex++;
            corprep = 10000;
        }
    }
    //if(getStatLevel('Cha')<1000){
        travelToCity('Volhaven');
        universityCourse('ZB Institute of Technology','Leadership');
        sleep(sleeptime*2);
    //}
    
    
    
}
@danielyxie
Copy link
Owner

Should be fixed in latest update v0.31.0, please let me know if its not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants