Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to call a function while another is running
    text
    copied!<p>Instead of copying all the code I'm working with, let's just put an example. I have:</p> <pre><code>&lt;body onload="show()" &gt; //while show() is a : setInterval (function(){ thing=thing+1;},500); </code></pre> <p>Then in the HTML I have a button:</p> <pre><code>&lt;button onclick="thingPlus100()"&gt;Upgrade&lt;/button&gt; </code></pre> <p>while <code>thingPlus100()</code> is for instance: </p> <pre><code>function thingPlus100() { thing= thing+100; } </code></pre> <p>outside the loop.</p> <p>This does not work. So how do you in this case make a button that when pressed will sum 100 to the value of thing without breaking the loop? !!!extension: this is the html:</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;title&gt;Index&lt;/title&gt; &lt;link href="gameCSS.css" rel="stylesheet" type="text/css" /&gt; &lt;/head&gt; &lt;script src="PlanetAndStructures.js" type="text/javascript"&gt; &lt;/script&gt; &lt;body onload="show()" &gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;table width="800" border="1"&gt; &lt;tr&gt; &lt;th scope="col"&gt;TGC*&lt;/th&gt; &lt;th scope="col"&gt;Radioactives&lt;/th&gt; &lt;th scope="col"&gt;Organic&lt;/th&gt; &lt;th scope="col"&gt;Metall&lt;/th&gt; &lt;th scope="col"&gt;Manpower&lt;/th&gt; &lt;th scope="col"&gt;Food&lt;/th&gt; &lt;th scope="col"&gt;Militar Power&lt;/th&gt; &lt;th scope="col"&gt;Economy&lt;/th&gt; &lt;th scope="col"&gt;Lvl&lt;/th&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;p id="tottgc"&gt;Loading&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p id="totRadioactives"&gt;Loading&lt;/P&gt;&lt;/td&gt; &lt;td&gt;&lt;p id="totOrganic"&gt;Loading&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p id="totMetal"&gt;Loading&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p id="Manpower"&gt;Loading&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p id="Food"&gt;Loading&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p id="MS"&gt;Loading&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p id="ES"&gt;Loading&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p id="Lvl"&gt;Loading&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;p&gt;Planet geology and info:&lt;/p&gt; &lt;table width="800" border="1"&gt; &lt;tr&gt; &lt;td colspan="7" bgcolor="#00FF99" class="cent"&gt;Info&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td width="128" bgcolor="#00FF99" class="cent"&gt;Gravity&lt;/td&gt; &lt;td width="152" bgcolor="#00FF99" class="cent"&gt;Natural ecosistem&lt;/td&gt; &lt;td width="142" bgcolor="#00FF99" class="cent"&gt;Radioactive&lt;/td&gt; &lt;td width="111" bgcolor="#00FF99" class="cent"&gt;Metal&lt;/td&gt; &lt;td width="113" bgcolor="#00FF99" class="cent"&gt;Organic&lt;/td&gt; &lt;td width="113" bgcolor="#00FF99" class="cent"&gt;Area&lt;/td&gt; &lt;td width="114" bgcolor="#00FF99" class="cent"&gt;Solar&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td bgcolor="#C6FFC6" class="cent"&gt;&lt;p id="grav"&gt;?&lt;/p&gt;&lt;/td&gt; &lt;td bgcolor="#C6FFC6" class="cent"&gt;&lt;p id="natEc"&gt;?&lt;/p&gt;&lt;/td&gt; &lt;td bgcolor="#C6FFC6" class="cent"&gt;&lt;p id="radio"&gt;?&lt;/p&gt;&lt;/td&gt; &lt;td bgcolor="#C6FFC6" class="cent"&gt;&lt;p id="metal"&gt;?&lt;/p&gt;&lt;/td&gt; &lt;td bgcolor="#C6FFC6" class="cent"&gt;&lt;p id="organ"&gt;?&lt;/p&gt;&lt;/td&gt; &lt;td bgcolor="#C6FFC6" class="cent"&gt;&lt;p id="Area"&gt;?&lt;/p&gt;&lt;/td&gt; &lt;td height="23" bgcolor="#C6FFC6" class="cent"&gt;&lt;p id="solar"&gt;?&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Planet indexes &lt;/p&gt; &lt;table width="800" border="1"&gt; &lt;tr&gt; &lt;td colspan="7" bgcolor="#FFFF99" class="cent"&gt;Indexes&lt;/td&gt; &lt;td colspan="6" bgcolor="#FF6600" class="cent"&gt;Resource production&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td bgcolor="#FFFF99" class="cent"&gt;Fuel&lt;/td&gt; &lt;td bgcolor="#FFFF99" class="cent"&gt;Industry&lt;/td&gt; &lt;td bgcolor="#FFFF99" class="cent"&gt;Ecosistem&lt;/td&gt; &lt;td bgcolor="#FFFF99" class="cent"&gt;Research&lt;/td&gt; &lt;td bgcolor="#FFFF99" class="cent"&gt;Anarchy&lt;/td&gt; &lt;td bgcolor="#FFFF99" class="cent"&gt;Production&lt;/td&gt; &lt;td bgcolor="#FFFF99" class="cent"&gt;Construction&lt;/td&gt; &lt;td bgcolor="#FF6600" class="cent"&gt;Food&lt;/td&gt; &lt;td bgcolor="#FF6600" class="cent"&gt;Radioactive&lt;/td&gt; &lt;td bgcolor="#FF6600" class="cent"&gt;Organic&lt;/td&gt; &lt;td bgcolor="#FF6600" class="cent"&gt;Metals&lt;/td&gt; &lt;td bgcolor="#FF6600" class="cent"&gt;Energy &lt;/td&gt; &lt;td bgcolor="#FF6600" class="cent"&gt;TGC's&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td height="23" bgcolor="#FFFFCE" class="cent"&gt;&lt;p id="FI"&gt;?&lt;/p&gt;&lt;/td&gt; &lt;td bgcolor="#FFFFCE" class="cent"&gt;&lt;p id="II"&gt;?&lt;/p&gt;&lt;/td&gt; &lt;td bgcolor="#FFFFCE" class="cent"&gt;&lt;p id="EI"&gt;?&lt;/p&gt;&lt;/td&gt; &lt;td bgcolor="#FFFFCE" class="cent"&gt;&lt;p id="RI"&gt;?&lt;/p&gt;&lt;/td&gt; &lt;td bgcolor="#FFFFCE" class="cent"&gt;&lt;p id="AI"&gt;?&lt;/p&gt;&lt;/td&gt; &lt;td bgcolor="#FFFFCE" class="cent"&gt;&lt;p id="PI"&gt;?&lt;/p&gt;&lt;/td&gt; &lt;td bgcolor="#FFFFCE" class="cent"&gt;&lt;p id="CI"&gt;?&lt;/p&gt;&lt;/td&gt; &lt;td bgcolor="#FFC6A4" class="cent"&gt;&lt;p id="Fp";&lt;/td&gt; &lt;td bgcolor="#FFC6A4" class="cent"&gt;&lt;p id="Rp"&gt;?&lt;/p&gt;&lt;/td&gt; &lt;td bgcolor="#FFC6A4" class="cent"&gt;&lt;p id="Op"&gt;?&lt;/p&gt;&lt;/td&gt; &lt;td bgcolor="#FFC6A4" class="cent"&gt;&lt;p id="Mp"&gt;?&lt;/p&gt;&lt;/td&gt; &lt;td bgcolor="#FFC6A4" class="cent"&gt;&lt;p id="E"&gt;?&lt;/p&gt;&lt;/td&gt; &lt;td bgcolor="#FFC6A4" class="cent"&gt;&lt;p id="TGCp"&gt;?&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;p&gt;Planet structures &lt;/p&gt;&lt;table width="800" border="1"&gt; &lt;tr&gt; &lt;td width="126" height="42"&gt;Solar plants&lt;/td&gt; &lt;td width="423"&gt;Encreases planet energy by solar index.&lt;br /&gt;&lt;span id="lvlCostSol"&gt; ?&lt;/span&gt;&lt;/td&gt; &lt;td width="151"&gt;Energy+&lt;/td&gt; &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; //Im working with this button now---------&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; &lt;td width="72"&gt;&lt;p id="butSol"&gt;&lt;button onclick="SolarLvlPlus()"&gt;Upgrade&lt;/button&gt;&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Plutonium plants&lt;/td&gt; &lt;td&gt;Encreases planet energy by fuel index (needs radioactives to run)&lt;br /&gt;&lt;span id="lvlCostPlut"&gt;?&lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;p&gt;Energy++; radioactives-&lt;/p&gt; &lt;p&gt;Ecosystem --&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p id="butPlut"&gt;&lt;button onclick="plutonLvl+ ()"&gt;Upgrade&lt;/button&gt;&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td height="46"&gt;Mines&lt;/td&gt; &lt;td&gt;Encreases planet resource mining by industry index.&lt;br /&gt;&lt;span id="lvlCostMin"&gt;?&lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;p&gt;[Metal, Organic, Radioactive ]+;&lt;br /&gt; Ecosystem--&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p id="butMin"&gt;&lt;button onclick="minesLvl+ ()"&gt;Upgrade&lt;/button&gt;&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Urbanitzations&lt;/td&gt; &lt;td&gt;Encreases planet manpower growth by industry index.&lt;br /&gt;&lt;span id="lvlCostUrb"&gt;?&lt;/span&gt;&lt;/td&gt; &lt;td&gt;Manpower + ;Ecosystem-&lt;/td&gt; &lt;td&gt;&lt;p id="butUrb"&gt;&lt;button onclick="UrbanLvl+ ()"&gt;Upgrade&lt;/button&gt;&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Storage Facilities&lt;/td&gt; &lt;td&gt;Encreases planet resource storages by industry index.&lt;br /&gt;&lt;span id="lvlCostStor"&gt;?&lt;/span&gt;&lt;/td&gt; &lt;td&gt;Estorage+&lt;/td&gt; &lt;td&gt;&lt;p id="butStor"&gt;&lt;button onclick="storageLvl+ ()"&gt;Upgrade&lt;/button&gt;&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td height="51"&gt;Food productors&lt;/td&gt; &lt;td&gt;Encreases food production by ecosistem Index.&lt;br /&gt; &lt;span id="lvlCostFood"&gt;?&lt;/span&gt;&lt;/td&gt; &lt;td&gt;Food +&lt;/td&gt; &lt;td&gt;&lt;p id="butFood"&gt;&lt;button onclick="foodProdLvl+ ()"&gt;Upgrade&lt;/button&gt;&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;General Factories&lt;/td&gt; &lt;td&gt;Encreases Industry and construction Index.&lt;br /&gt;&lt;span id="lvlCostFac"&gt;?&lt;/span&gt;&lt;/td&gt; &lt;td&gt;Industry+; Construction +, Anarchy +;&lt;/td&gt; &lt;td&gt;&lt;p id="butInd"&gt;&lt;button onclick="industryLvl+ ()"&gt;Upgrade&lt;/button&gt;&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Markets&lt;/td&gt; &lt;td&gt;Encreases TGC production.&lt;br /&gt;&lt;span id="lvlCostMar"&gt;?&lt;/span&gt;&lt;/td&gt; &lt;td&gt;TGC+&lt;/td&gt; &lt;td&gt;&lt;p id="butMark"&gt;&lt;button onclick="marketLvl+ ()"&gt;Upgrade&lt;/button&gt;&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Space industries&lt;/td&gt; &lt;td&gt;Encreases production Index.&lt;br /&gt;&lt;span id="lvlCostSpc"&gt;?&lt;/span&gt;&lt;/td&gt; &lt;td&gt;Production +&lt;/td&gt; &lt;td&gt;&lt;p id="butSpaInd"&gt;&lt;button onclick="spaceIndLvl+ ()"&gt;Upgrade&lt;/button&gt;&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Ecosistem modulators&lt;/td&gt; &lt;td&gt;encreases Ecosistem Index.&lt;br /&gt;&lt;span id="lvlCostEco"&gt;?&lt;/span&gt;&lt;/td&gt; &lt;td&gt;Ecosystem ++&lt;/td&gt; &lt;td&gt;&lt;p id="butEco"&gt;&lt;button onclick="ecoModLvl+ ()"&gt;Upgrade&lt;/button&gt;&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td height="23"&gt;Artificial nutrishment&lt;/td&gt; &lt;td&gt;encreases food production by research and industrial Index.&lt;br /&gt;&lt;span id="lvlCostArtF"&gt;?&lt;/span&gt;&lt;/td&gt; &lt;td&gt;Food ++; Anarchy +&lt;/td&gt; &lt;td&gt;&lt;p id="butArtNut"&gt;&lt;button onclick="artNutLvl+ ()"&gt;Upgrade&lt;/button&gt;&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Order centers &lt;/td&gt; &lt;td&gt;Decreases Anarchy Index.&lt;br /&gt;&lt;span id="lvlCostOrd"&gt;?&lt;/span&gt;&lt;/td&gt; &lt;td&gt;Anarchy --&lt;/td&gt; &lt;td&gt;&lt;p id="butOrd"&gt;&lt;button onclick="OrderLvl+ ()"&gt;Upgrade&lt;/button&gt;&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Particle accelerators&lt;/td&gt; &lt;td&gt;produces radioactive materials.&lt;br /&gt; &lt;span id="lvlCostPart"&gt;?&lt;/span&gt;&lt;/td&gt; &lt;td&gt;Fuel ++, Ecosystem-&lt;/td&gt; &lt;td&gt;&lt;p id="butPart"&gt;&lt;button onclick="particleLvl+ ()"&gt;Upgrade&lt;/button&gt;&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Geomorph&lt;/td&gt; &lt;td&gt;increases usable area.&lt;br /&gt;&lt;span id="lvlCostGeoM"&gt;?&lt;/span&gt;&lt;/td&gt; &lt;td&gt;Area+, Ecosystem -&lt;/td&gt; &lt;td&gt;&lt;p id="butGeo"&gt;&lt;button onclick="geomorphLvl+ ()"&gt;Upgrade&lt;/button&gt;&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Science Investments&lt;/td&gt; &lt;td&gt;Increase research index.&lt;br /&gt;&lt;span id="lvlCostRes"&gt;?&lt;/span&gt;&lt;/td&gt; &lt;td&gt;Research+&lt;/td&gt; &lt;td&gt;&lt;p id="butRes"&gt;&lt;button onclick="researchLvl+ ()"&gt;Upgrade&lt;/button&gt;&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;p id="prodPH"&gt;?&lt;/p&gt; &lt;p&gt;*:Trans-Galactic Crown (money).&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;/html&gt; &lt;/body&gt; </code></pre> <p>and here is the .js:</p> <pre><code> //PLANET UNMOBILE STATISTICS: var plaMetal=Math.floor((Math.random()*10)+5); var plaArea =Math.floor((Math.random()*500)+50); var plaGrav =Math.floor((Math.random()*8)+3); var plaEco =Math.floor((Math.random()*71)+30); var plaRad =Math.floor((Math.random()*10)+3); var plaOrg =Math.floor((Math.random()*10)+4); var plaSol =Math.floor((Math.random()*250)+50); //STRUCTURE LEVELS;; var artifNoutrishmentLvl=0; var ecoModulatorsLvl=0; var foodProductorsLvl=1; var genFactoiesLvl=1; var geomorphLvl=0; var marketLvl=1; var minesLvl=1; var orderCenterLvl=1; var particlesLvl=0; var plutLvl=0; var scienceInvestLvl=1; var solarPlantsLvl=1; var spcIndustriesLvl=1; var storageLvl=1; var urbanitzationLvl=1; //OTHERS var buildings=0; var shipProd=0; var game=1; var solarConstr=0;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;this is the variable!!! //INDEXES: var industryI=(((genFactoiesLvl*3)+(particlesLvl+urbanitzationLvl/2))/4)+1; var fuelI= ((industryI + urbanitzationLvl + particlesLvl)/4)+1; var ecosistemI= plaEco-(plutLvl*3)-(minesLvl*2)- urbanitzationLvl-particlesLvl-geomorphLvl+(ecoModulatorsLvl*4); var researchI=scienceInvestLvl*5; var anarchyI=(genFactoiesLvl*2)+ (artifNoutrishmentLvl*3) +urbanitzationLvl-(orderCenterLvl*4); var Production=(genFactoiesLvl*2)+(spcIndustriesLvl*4); var constructionI=(genFactoiesLvl*5); //RESOURCE PRODUCTION PER HOUR var foodPH=((foodProductorsLvl*plaEco)+ artifNoutrishmentLvl*10)*15/2 ; var radPH=((minesLvl*plaRad*industryI*2)+(particlesLvl*industryI*5)*20)/2; var metPH=((minesLvl*plaMetal*industryI*1.5)*19)/2; var orgPH=((minesLvl*(plaOrg/5)*industryI*3)*20)/2; var tgcPH=(((marketLvl*8)+industryI+urbanitzationLvl)*10)/2; //RESOURCES var energy= Math.round(solarE + plutoniumE - buildings - shipProd); var solarE =Math.round((plaSol*solarPlantsLvl)/10)+5; var plutoniumE=Math.round((plutLvl*fuelI)/3)+10; var radioactive =100; var organics=400; var metals=600; var tgcs =200; var food=500; var manpower =Math.round((urbanitzationLvl*industryI)/10); var energy= Math.round(solarE + plutoniumE - buildings - shipProd); //COSTS: //Metal var artifNoutMCost= Math.round(((artifNoutrishmentLvl^2)/4)*200)+ 500; var ecoModulatorsMCost= Math.round(((ecoModulatorsLvl^2)/2)*350)+80; var foodProductorsMCost= Math.round(((foodProductorsLvl^2)/20)*15)+25; var genFactoiesMCost= Math.round(((genFactoiesLvl^3)/13)*50)+50; var geomorphMCost= Math.round(((geomorphLvl^2)/5)*250)+500; var marketMCost= Math.round(((marketLvl^2)/10)*45)+54; var minesMCost= Math.round(((minesLvl^3)/20)*60)+45; var orderCenterMCost= Math.round(((orderCenterLvl^2)/10)*25)+100; var particlesMCost= Math.round((particlesLvl^4)*50)+550; var plutMCost= Math.round(((plutLvl^3)/25)*12)+100; var scienceInvestMCost= Math.round(((scienceInvestLvl^2)/10)*25)+55; var solarPlantsMCost= Math.round(((solarPlantsLvl^2)/10)*20)+40; var spcIndustriesMCost= Math.round(((spcIndustriesLvl^3)/3)*55)+250; var storageMCost= Math.round(((storageLvl^2)/10)*12)+ 160; var urbanitzationMCost= Math.round(((urbanitzationLvl^2)/12)*25)+45; //ORGANIC var artifNoutOCost= Math.round(((artifNoutrishmentLvl^3)/3)*250)+500; var ecoModulatorsOCost= Math.round(((ecoModulatorsLvl^2)/2)*350)+280; var foodProductorsOCost= Math.round(((foodProductorsLvl^2)/10)*25)+35; var genFactoiesOCost= Math.round(((genFactoiesLvl^3)/15)*30)+30; var geomorphOCost= Math.round(((geomorphLvl^2)/2)*400)+600; var marketOCost= Math.round(((marketLvl^2)/10)*45)+54; var minesOCost= Math.round(((minesLvl^2)/20)*30)+50; var orderCenterOCost= Math.round(((orderCenterLvl^2)/20)*25)+50; var particlesOCost= Math.round((particlesLvl^2)*5)+110; var plutOCost= Math.round(((plutLvl^2)/50)*6); var scienceInvestOCost= Math.round(((scienceInvestLvl^3)/10)*25)+80; var solarPlantsOCost= Math.round(((solarPlantsLvl^2)/19)*15)+20; var spcIndustriesOCost= Math.round(((spcIndustriesLvl^3)/5)*40)+300; var storageOCost= Math.round(((storageLvl^2)/10)*12)+ 160; var urbanitzationOCost= Math.round(((urbanitzationLvl^2)/6)*40)+25; //RADIOACTIVES var artifNoutRCost= 0; var ecoModulatorsRCost= Math.round(((ecoModulatorsLvl^2)/4)*450)+40; var foodProductorsRCost=0; var genFactoiesRCost= Math.round(((genFactoiesLvl^2)/33)*40)+30; var geomorphRCost= Math.round(((geomorphLvl^2)/5)*150)+300; var marketRCost= Math.round(((marketLvl^2)/10)*45)+54; var minesRCost= Math.round(((minesLvl^2)/30)*50)+35; var orderCenterRCost=0; var particlesRCost= Math.round((particlesLvl^4)*110)+750; var plutRCost= Math.round(((plutLvl^3)/15)*42)+240; var scienceInvestRCost= Math.round(((scienceInvestLvl^2)/15)*30)+25; var solarPlantsRCost= Math.round(((solarPlantsLvl^2)/40)*10)+10; var spcIndustriesRCost= Math.round(((spcIndustriesLvl^3)/3)*55)+250; var storageRCost= Math.round(((storageLvl^2)/10)*12)+ 160; var urbanitzationRCost= 0; //TIMES: var solarTime; function show(){ setInterval (function(){ //Planet geology and info table: document.getElementById("metal").innerHTML= plaMetal; document.getElementById("Area").innerHTML= plaArea; document.getElementById("grav").innerHTML= plaGrav; document.getElementById("natEc").innerHTML= plaEco + "%"; document.getElementById("radio").innerHTML= plaRad; document.getElementById("organ").innerHTML= plaOrg; document.getElementById("solar").innerHTML= plaSol; document.getElementById("Area").innerHTML= plaArea; //Planet indexes table document.getElementById("E").innerHTML= Math.round(energy); document.getElementById("Fp").innerHTML= Math.round(food); document.getElementById("Rp").innerHTML= Math.round(radioactive); document.getElementById("Op").innerHTML= Math.round(organics); document.getElementById("Mp").innerHTML= Math.round(metals); document.getElementById("TGCp").innerHTML= Math.round(tgcs); document.getElementById("Manpower").innerHTML= manpower; document.getElementById("FI").innerHTML=Math.round( fuelI); document.getElementById("II").innerHTML=Math.round( industryI); document.getElementById("EI").innerHTML= ecosistemI; document.getElementById("RI").innerHTML= researchI; document.getElementById("AI").innerHTML= anarchyI; document.getElementById("PI").innerHTML= Production; document.getElementById("CI").innerHTML=constructionI; //COSTS AND LVLS document.getElementById("lvlCostArtF").innerHTML="Current Lvl: " + artifNoutrishmentLvl + "Cost: " + artifNoutMCost + "Met; " + artifNoutOCost + "Org; " + artifNoutRCost + "Rad." ; document.getElementById("lvlCostEco").innerHTML="Current Lvl: "+ecoModulatorsLvl+"Cost: "+ecoModulatorsMCost+"Met; "+ecoModulatorsOCost+"Org; "+ecoModulatorsRCost+"Rad."; document.getElementById("lvlCostFood").innerHTML="Current Lvl: "+foodProductorsLvl+"Cost: "+foodProductorsMCost+"Met; "+foodProductorsOCost+"Org; "+foodProductorsRCost+"Rad."; document.getElementById("lvlCostFac").innerHTML="Current Lvl: "+genFactoiesLvl+"Cost: "+genFactoiesMCost+"Met; "+genFactoiesOCost+"Org; "+genFactoiesRCost+"Rad."; document.getElementById("lvlCostGeoM").innerHTML="Current Lvl: "+geomorphLvl+"Cost: "+geomorphMCost+"Met; "+geomorphOCost+"Org; "+geomorphRCost+"Rad."; document.getElementById("lvlCostMar").innerHTML="Current Lvl: "+ marketLvl+"Cost: "+marketMCost+"Met; "+marketOCost+"Org; "+marketRCost+"Rad."; document.getElementById("lvlCostMin").innerHTML="Current Lvl: "+minesLvl+"Cost: "+minesMCost+"Met; "+minesOCost+"Org; "+minesRCost+"Rad."; document.getElementById("lvlCostOrd").innerHTML="Current Lvl: "+orderCenterLvl+"Cost: "+orderCenterMCost+"Met; "+orderCenterOCost+"Org; "+orderCenterRCost+"Rad."; document.getElementById("lvlCostPart").innerHTML="Current Lvl: "+particlesLvl+"Cost: "+particlesMCost+"Met; "+particlesOCost+"Org; "+particlesRCost+"Rad."; document.getElementById("lvlCostPlut").innerHTML="Current Lvl: "+plutLvl+"Cost: "+plutMCost+"Met; "+plutOCost+"Org; "+plutRCost+"Rad."; document.getElementById("lvlCostRes").innerHTML="Current Lvl: "+scienceInvestLvl+"Cost: "+scienceInvestMCost+"Met; "+scienceInvestOCost+"Org; "+scienceInvestRCost+"Rad."; document.getElementById("lvlCostSol").innerHTML="Current Lvl: "+solarPlantsLvl+"Cost: "+solarPlantsMCost+"Met; "+solarPlantsOCost+"Org; "+solarPlantsOCost+"Rad."; document.getElementById("lvlCostSpc").innerHTML="Current Lvl: "+spcIndustriesLvl+"Cost: "+spcIndustriesMCost+"Met; "+spcIndustriesOCost+"Org; "+spcIndustriesRCost+"Rad."; document.getElementById("lvlCostStor").innerHTML="Current Lvl: "+storageLvl+"Cost: "+storageMCost+"Met; "+storageOCost+"Org; "+storageRCost+"Rad."; document.getElementById("lvlCostUrb").innerHTML="Current Lvl: "+urbanitzationLvl+"Cost: "+urbanitzationMCost+"Met; "+urbanitzationOCost+"Org; "+urbanitzationRCost+"Rad."; document.getElementById("prodPH").innerHTML="metal: "+metPH+" organics: "+orgPH+" radioactives: "+radPH+" tgc's: "+tgcPH+" food:"+foodPH; //PRODUCTION ENGINE radioactive=radioactive+(radPH/7200); organics=organics+(orgPH/7200); metals=metals+(metPH/7200); tgcs=tgcs+(tgcPH/7200); food=food+(foodPH/7200); //this is what it should do when the button is pressed if(solarConstr=1){ }else if(metals&gt;=solarPlantsMCost){ }else if(radioactive&gt;=solarPlantsRCost){ }else if (organics&gt;=solarPlantsOCost){ metals=metals-solarPlantsMCost; radioactives=radioactives-solarPlantsRCost; organics=organics-solarPlantsOCost; solarTime=((solarPlantsOCost+solarPlantsRCost+solarPlantsMCost)*500)/constructionI; setTimeout(solarTime); }else if(solarTime&gt;0){ solarTime=-1; }else if(solarTime==0){ solarPlantsLvl=+1; solarConstr=-1; } },500);} //here is the extern function function SolarLvlPlus() { solarConstr=solarConstr+1; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload