Last active
July 21, 2020 21:51
-
-
Save brfreeman36/24876f4beba4e2a4e0f52770fdc1d355 to your computer and use it in GitHub Desktop.
Space Company Script
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
// Build UI | |
var linebreak1 = document.createElement("BR"); | |
var linebreak2 = document.createElement("BR"); | |
var linebreak3 = document.createElement("BR"); | |
var linebreak4 = document.createElement("BR"); | |
var EMCConversionSpan = document.createElement('SPAN'); | |
var EMCConversionTextBox = document.createElement('INPUT'); | |
var EMCConversionText = document.createTextNode('Resource to convert through EMC: \xa0\xa0\xa0\xa0\xa0'); | |
EMCConversionTextBox.setAttribute('type', 'text'); | |
EMCConversionSpan.appendChild(EMCConversionText); | |
EMCConversionSpan.appendChild(EMCConversionTextBox); | |
EMCConversionSpan.appendChild(linebreak1); | |
document.getElementById('donatingTab').appendChild(EMCConversionSpan); | |
var minimumPlasmaSpan = document.createElement('SPAN'); | |
var minimumPlasmaTextBox = document.createElement('INPUT'); | |
var minimumPlasmaText = document.createTextNode('Minimum Plasma in Storage: \xa0\xa0\xa0\xa0\xa0'); | |
minimumPlasmaTextBox.setAttribute('type', 'text'); | |
minimumPlasmaSpan.appendChild(minimumPlasmaText); | |
minimumPlasmaSpan.appendChild(minimumPlasmaTextBox); | |
minimumPlasmaSpan.appendChild(linebreak2); | |
document.getElementById('donatingTab').appendChild(minimumPlasmaSpan); | |
var ringsAndSwarms = document.createElement('SPAN'); | |
var ringsAndSwarmsCheckbox = document.createElement('INPUT'); | |
var ringsAndSwarmsText = document.createTextNode('Build Rings and Swarms \xa0\xa0\xa0\xa0\xa0'); | |
ringsAndSwarmsCheckbox.setAttribute('type', 'checkbox'); | |
ringsAndSwarms.appendChild(ringsAndSwarmsText); | |
ringsAndSwarms.appendChild(ringsAndSwarmsCheckbox); | |
ringsAndSwarms.appendChild(linebreak3); | |
document.getElementById('donatingTab').appendChild(ringsAndSwarms); | |
var spherePush = document.createElement('SPAN'); | |
var spherePushCheckbox = document.createElement('INPUT'); | |
var spherePushText = document.createTextNode('Build Spheres \xa0\xa0\xa0\xa0\xa0 '); | |
spherePushCheckbox.setAttribute('type', 'checkbox'); | |
spherePush.appendChild(spherePushText); | |
spherePush.appendChild(spherePushCheckbox); | |
spherePush.appendChild(linebreak4); | |
document.getElementById('donatingTab').appendChild(spherePush); | |
var achievementBuilder = document.createElement('SPAN'); | |
var achievementBuilderCheckbox = document.createElement('INPUT'); | |
var achievementBuilderText = document.createTextNode('Build Machines for Achievements \xa0\xa0\xa0\xa0\xa0'); | |
achievementBuilderCheckbox.setAttribute('type', 'checkbox'); | |
achievementBuilder.appendChild(achievementBuilderText); | |
achievementBuilder.appendChild(achievementBuilderCheckbox); | |
document.getElementById('donatingTab').appendChild(achievementBuilder); | |
EMCConversionTextBox.value = 'silicon'; | |
minimumPlasmaTextBox.value = '10200'; | |
// Create variables for building resource machines for higher Achievement Rank | |
var tierOneBuildingAmount = 100; // Tier 1 resource machines to build | |
var tierTwoBuildingAmount = 50; | |
var tierThreeBuildingAmount = 50; | |
var tierFourBuildingAmount = 10; | |
// Create variables for storage upgrades. className will be used. | |
var uraniumFull = document.getElementById('uranium'); | |
var lavaFull = document.getElementById('lava'); | |
var oilFull = document.getElementById('oil'); | |
var metalFull = document.getElementById('metal'); | |
var gemFull = document.getElementById('gem'); | |
var charcoalFull = document.getElementById('charcoal'); | |
var woodFull = document.getElementById('wood'); | |
var siliconFull = document.getElementById('silicon'); | |
var lunariteFull = document.getElementById('lunarite'); | |
var methaneFull = document.getElementById('methane'); | |
var titaniumFull = document.getElementById('titanium'); | |
var goldFull = document.getElementById('gold'); | |
var silverFull = document.getElementById('silver'); | |
var hydrogenFull = document.getElementById('hydrogen'); | |
var heliumFull = document.getElementById('helium'); | |
var iceFull = document.getElementById('ice'); | |
var meteoriteFull = document.getElementById('meteorite'); | |
// Main loop | |
var loop = setInterval(function() { | |
upgradeStorage(); | |
increaseResources(); | |
convertEnergyAndPlasma(); | |
buildDysonStuff(); | |
engineBuilder(); | |
}, 1) ; | |
// Increase resources | |
function increaseResources() { | |
var minimumPlasma = ~~minimumPlasmaTextBox.value; // Minimum Plasma level to be maintained at all times | |
if (document.getElementById('plasmaNav').className != 'sideTab hidden') { | |
gainResource('plasma'); // Game defined function | |
} | |
if (document.getElementById('uraniumNav').className != 'sideTab hidden') { | |
gainResource('uranium'); | |
} | |
if (document.getElementById('lavaNav').className != 'sideTab hidden') { | |
gainResource('lava'); | |
} | |
if (document.getElementById('oilNav').className != 'sideTab hidden') { | |
gainResource('oil'); | |
} | |
gainResource('metal'); | |
gainResource('gem'); | |
gainResource('wood'); | |
if (document.getElementById('siliconNav').className != 'sideTab hidden') { | |
gainResource('silicon'); | |
} | |
if (document.getElementById('lunariteNav').className != 'sideTab hidden') { | |
gainResource('lunarite'); | |
} | |
if (document.getElementById('methaneNav').className != 'sideTab hidden') { | |
gainResource('methane'); | |
} | |
if (document.getElementById('titaniumNav').className != 'sideTab hidden') { | |
gainResource('titanium'); | |
} | |
if (document.getElementById('goldNav').className != 'sideTab hidden') { | |
gainResource('gold'); | |
} | |
if (document.getElementById('silverNav').className != 'sideTab hidden') { | |
gainResource('silver'); | |
} | |
if (document.getElementById('hydrogenNav').className != 'sideTab hidden') { | |
gainResource('hydrogen'); | |
} | |
if (document.getElementById('heliumNav').className != 'sideTab hidden') { | |
gainResource('helium'); | |
} | |
if (document.getElementById('iceNav').className != 'sideTab hidden') { | |
gainResource('ice'); | |
} | |
if (plasma > minimumPlasma && document.getElementById('meteoriteNav').className != 'sideTab hidden' ) { | |
gainResource('meteorite'); // Game definied function for clicking gain button | |
} | |
} | |
/* Upgrade storage. Full storage is indicated by green text | |
which is changed using class. | |
*/ | |
function upgradeStorage() { | |
if (Game.tech.isPurchased('unlockStorage')) { | |
if (uraniumFull.className == 'green') { | |
upgradeUraniumStorage(); // Game defined function | |
} | |
if (lavaFull.className == 'green') { | |
upgradeLavaStorage(); | |
} | |
if (oilFull.className == 'green') { | |
upgradeOilStorage(); | |
} | |
if (metalFull.className == 'green') { | |
upgradeMetalStorage(); | |
} | |
if (gemFull.className == 'green') { | |
upgradeGemStorage(); | |
} | |
if (charcoalFull.className == 'green') { | |
upgradeCharcoalStorage(); | |
} | |
if (woodFull.className == 'green') { | |
upgradeWoodStorage(); | |
} | |
if (siliconFull.className == 'green') { | |
upgradeSiliconStorage(); | |
} | |
if (lunariteFull.className == 'green') { | |
upgradeLunariteStorage(); | |
} | |
if (methaneFull.className == 'green') { | |
upgradeMethaneStorage(); | |
} | |
if (titaniumFull.className == 'green') { | |
upgradeTitaniumStorage(); | |
} | |
if (goldFull.className == 'green') { | |
upgradeGoldStorage(); | |
} | |
if (silverFull.className == 'green') { | |
upgradeSilverStorage(); | |
} | |
if (hydrogenFull.className == 'green') { | |
upgradeHydrogenStorage(); | |
} | |
if (heliumFull.className == 'green') { | |
upgradeHeliumStorage(); | |
} | |
if (iceFull.className == 'green') { | |
upgradeIceStorage(); | |
} | |
if (meteoriteFull.className == 'green') { | |
upgradeMeteoriteStorage(); | |
} | |
} | |
} | |
function buildDysonStuff() { | |
if (spherePushCheckbox.checked == true && Game.tech.isPurchased('unlockDysonSphere') != true || sphere > Game.interstellar.stars.systemsConquered || swarm < 35 ) { | |
spherePushCheckbox.checked = false; | |
} | |
if (ringsAndSwarmsCheckbox.checked == true && spherePushCheckbox.checked != true) { | |
if (Game.tech.isPurchased('unlockDyson')) { | |
if (ring < 3 && titanium > 7000000 && gold > 2500000 && silicon > 4700000 && meteorite > 23000 && ice > 2500000) { | |
buildDysonTo(50); // Game defined function | |
buildRing(); // Game defined function | |
} | |
if (Game.tech.isPurchased('unlockDysonSphere')) { | |
if (ring >= 3 && energyps < 5000000 && titanium > 25000000 && gold > 900000 && silicon > 17000000 && meteorite > 85000 && ice > 9000000) { | |
buildDysonTo(100); // Game defined function | |
buildSwarm(); // Game defined function | |
} else if (ring >= 3 && titanium > 100000000 && gold > 3600000 && silicon > 51000000 && meteorite > 340000 && ice > 3600000) { | |
buildDysonTo(100); // Game defined function | |
buildSwarm(); // Game defined function | |
} | |
} | |
} | |
} else if (Game.tech.isPurchased('unlockDysonSphere') && spherePushCheckbox.checked == true) { | |
getDyson(); | |
if (dyson == 250) { | |
buildSphere(); // Game defined function | |
spherePushCheckbox.checked = false; | |
} | |
} | |
} | |
function convertEnergyAndPlasma() { | |
var resourceToConvertEMC = EMCConversionTextBox.value; // Resource that you want to convert using the EMC | |
var offsetEnergyFlux; // Needed due to energy fluctuations near MaxEnergy | |
if (getMaxEnergy() < 1000000) { | |
offsetEnergyFlux = 1000; | |
} else { | |
offsetEnergyFlux = 100000; | |
} | |
if (Game.tech.isPurchased('unlockEmc')) { | |
if ((getMaxEnergy() - offsetEnergyFlux) < energy) { | |
convertEnergy(resourceToConvertEMC); // Game defined function | |
} | |
if ((getMaxPlasma() - 1000) < plasma) { | |
convertPlasma('meteorite'); // Game defined function | |
} | |
} | |
} | |
function engineBuilder() { | |
if (achievementBuilderCheckbox.checked == true){ | |
ringsAndSwarmsCheckbox.checked = false; | |
spherePushCheckbox.checked = false; | |
if (pump < tierOneBuildingAmount) { | |
getPump(); | |
} | |
if (grinder < tierOneBuildingAmount) { | |
getGrinder(); | |
} | |
if (crucible < tierOneBuildingAmount) { | |
getCrucible(); | |
} | |
if (miner < tierOneBuildingAmount) { | |
getMiner(); | |
} | |
if (gemMiner < tierOneBuildingAmount) { | |
getGemMiner(); | |
} | |
if (woodburner < tierOneBuildingAmount) { | |
getWoodburner(); | |
} | |
if (woodcutter < tierOneBuildingAmount) { | |
getWoodcutter(); | |
} | |
if (blowtorch < tierOneBuildingAmount) { | |
getBlowtorch(); | |
} | |
if (moonWorker < tierOneBuildingAmount) { | |
getMoonWorker(); | |
} | |
if (vacuum < tierOneBuildingAmount) { | |
getVacuum(); | |
} | |
if (explorer < tierOneBuildingAmount) { | |
getExplorer(); | |
} | |
if (droid < tierOneBuildingAmount) { | |
getDroid(); | |
} | |
if (scout < tierOneBuildingAmount) { | |
getScout(); | |
} | |
if (collector < tierOneBuildingAmount) { | |
getCollector(); | |
} | |
if (drone < tierOneBuildingAmount) { | |
getDrone(); | |
} | |
if (icePick < tierOneBuildingAmount) { | |
getIcePick(); | |
} | |
if (cubic < tierTwoBuildingAmount) { | |
getCubic(); | |
} | |
if (extractor < tierTwoBuildingAmount) { | |
getExtractor(); | |
} | |
if (pumpjack < tierTwoBuildingAmount) { | |
getPumpjack(); | |
} | |
if (heavyDrill < tierTwoBuildingAmount) { | |
getHeavyDrill(); | |
} | |
if (advancedDrill < tierTwoBuildingAmount) { | |
getAdvancedDrill(); | |
} | |
if (furnace < tierTwoBuildingAmount) { | |
getFurnace(); | |
} | |
if (laserCutter < tierTwoBuildingAmount) { | |
getLaserCutter(); | |
} | |
if (scorcher < tierTwoBuildingAmount) { | |
getScorcher(); | |
} | |
if (moonDrill < tierTwoBuildingAmount) { | |
getMoonDrill(); | |
} | |
if (suctionExcavator < tierTwoBuildingAmount) { | |
getSuctionExcavator(); | |
} | |
if (lunariteDrill < tierTwoBuildingAmount) { | |
getLunariteDrill(); | |
} | |
if (destroyer < tierTwoBuildingAmount) { | |
getDestroyer(); | |
} | |
if (spaceLaser < tierTwoBuildingAmount) { | |
getSpaceLaser(); | |
} | |
if (magnet < tierTwoBuildingAmount) { | |
getMagnet(); | |
} | |
if (tanker < tierTwoBuildingAmount) { | |
getTanker(); | |
} | |
if (iceDrill < tierTwoBuildingAmount) { | |
getIceDrill(); | |
} | |
if (enricher < tierThreeBuildingAmount) { | |
getEnricher(); | |
} | |
if (extruder < tierThreeBuildingAmount) { | |
getExtruder(); | |
} | |
if (oilField < tierThreeBuildingAmount) { | |
getOilField(); | |
} | |
if (gigaDrill < tierThreeBuildingAmount) { | |
getGigaDrill(); | |
} | |
if (diamondDrill < tierThreeBuildingAmount) { | |
getDiamondDrill(); | |
} | |
if (kiln < tierThreeBuildingAmount) { | |
getKiln(); | |
} | |
if (deforester < tierThreeBuildingAmount) { | |
getDeforester(); | |
} | |
if (annihilator < tierThreeBuildingAmount) { | |
getAnnihilator(); | |
} | |
if (moonQuarry < tierThreeBuildingAmount) { | |
getMoonQuarry(); | |
} | |
if (spaceCow < tierThreeBuildingAmount) { | |
getSpaceCow(); | |
} | |
if (pentaDrill < tierThreeBuildingAmount) { | |
getPentaDrill(); | |
} | |
if (deathStar < tierThreeBuildingAmount) { | |
getDeathStar(); | |
} | |
if (bertha < tierThreeBuildingAmount) { | |
getBertha(); | |
} | |
if (eCell < tierThreeBuildingAmount) { | |
getECell(); | |
} | |
if (compressor < tierThreeBuildingAmount) { | |
getCompressor(); | |
} | |
if (freezer < tierThreeBuildingAmount) { | |
getFreezer(); | |
} | |
if (recycler < tierFourBuildingAmount) { | |
getRecycler(); | |
} | |
if (veluptuator < tierFourBuildingAmount) { | |
getVeluptuator(); | |
} | |
if (oilRig < tierFourBuildingAmount) { | |
getOilRig(); | |
} | |
if (quantumDrill < tierFourBuildingAmount) { | |
getQuantumDrill(); | |
} | |
if (carbyneDrill < tierFourBuildingAmount) { | |
getCarbyneDrill(); | |
} | |
if (fryer < tierFourBuildingAmount) { | |
getFryer(); | |
} | |
if (infuser < tierFourBuildingAmount) { | |
getInfuser(); | |
} | |
if (desert < tierFourBuildingAmount) { | |
getDesert(); | |
} | |
if (planetExcavator < tierFourBuildingAmount) { | |
getPlanetExcavator(); | |
} | |
if (vent < tierFourBuildingAmount) { | |
getVent(); | |
} | |
if (titanDrill < tierFourBuildingAmount) { | |
getTitanDrill(); | |
} | |
if (actuator < tierFourBuildingAmount) { | |
getActuator(); | |
} | |
if (cannon < tierFourBuildingAmount) { | |
getCannon(); | |
} | |
if (hindenburg < tierFourBuildingAmount) { | |
getHindenburg(); | |
} | |
if (skimmer < tierFourBuildingAmount) { | |
getSkimmer(); | |
} | |
if (mrFreeze < tierFourBuildingAmount) { | |
getMrFreeze(); | |
} | |
//Energy Production Buidling | |
if (charcoalEngine < tierOneBuildingAmount) { | |
getCharcoalEngine(); | |
} | |
if (solarPanel < tierOneBuildingAmount) { | |
getSolarPanel(); | |
} | |
if (methaneStation < tierTwoBuildingAmount) { | |
getMethaneStation(); | |
} | |
if (nuclearStation < tierThreeBuildingAmount) { | |
getNuclearStation(); | |
} | |
if (magmatic < tierThreeBuildingAmount) { | |
getMagmatic(); | |
} | |
if (fusionReactor < tierThreeBuildingAmount) { | |
getFusionReactor(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I still think the values for checking Dyson rings and swarms are incorrect. Taken from "https://www.reddit.com/r/SpaceCompany/wiki/solcentertab"
RING
Titanium: 25, 373,795
Gold: 8,457,916
Silicon: 16.915.856
Meteorite: 84,555
Ice: 8,457,916
SWARM
Titanium: 93,669,640
Gold: 31,223,182
Silicon: 62,446,413
Meteorite: 312,182
Ice: 31,223,182