Board Thread:The Last Sovereign Discussion/@comment-31632839-20170920202133/@comment-29984007-20190516115422

ok, the compiler check of my IDE report this problems

File magic.js:

variables declared two time: "i" and "j"

variables "c1" and "c2" never used

functions resetHiddenStatsValues and resetCharactersRPchange never used

"emptyRowNew" never declared (should be "var emptyRowNew")

(1) if(cost > sections[i].remainingFunds){investmentList[j].children[0].children[0].disabled = true;} else { investmentList[j].children[0].children[0].disabled = false;} can be replaced with investmentList[j].children[0].children[0].disabled = (cost > sections[i].remainingFunds);

(2) if( cost !== 0 && cost > remainingFunds){inputHtmlElement.disabled = true;} else { inputHtmlElement.disabled = false;} can be replaced with inputHtmlElement.disabled = (cost !== 0 && cost > remainingFunds);

(3) if( cost !== 0 && cost > remainingFunds){dropDownOptions[i].disabled = true;} else { dropDownOptions[i].disabled = false;} can be replaced with dropDownOptions[i].disabled = (cost !== 0 && cost > remainingFunds);

File toExpandAddHere.js: unused "sectionID" in many call of nonFinancialBenefit:function(sectionID), investmentReturn:function(sectionID) and specialCostToolTip:function(sectionID) [you can delete the argument]

(1) if(getDropDownSelected('mineQuest')==='people'){return true;}return false; can be replaced with return (getDropDownSelected('mineQuest')==='people') (2) if(!isCheckedAtSection(getSectionIndex('chapter1'),'yhilinMine')){return true;} return false; can be replaced with: return (!isCheckedAtSection(getSectionIndex('chapter1'),'yhilinMine')); same for 'premiumSteel1' and 'specialSupplier'

(3) if(sectionID==='chapter4.2'){if(getCheckboxStatus('finishedCouncil')){return true;}     return false; } return true;}, can be replaced with: if(sectionID==='chapter4.2'){return (getCheckboxStatus('finishedCouncil'));}

file stdtheme.css: "0px" can be only "0"

Other question; you cannot keep track of all hidden variables, otherwise you will end with a copy of my calculator, for the countries score i think two select box (alike country CD after the war). one for the starting value for the section (e.g. new givini value for orc merchant cost and return) and one for the value in the end of the section for open/close some investiment opportunity (e.g. givini teahouse or mage guild)

HQ decoration should be included, yes their price is small compared the other investment, but every penny count, HQ upgrade need to be included. i think you shouldn't include full tables for DF/PDF, they are a fixed quota and many petition cannot be traslated in ProN cost o return in chapter 4. a checkbox for the single investment if they can be done/purchase in chapter 4 it's fine.

for the problem with the code i need more time to delve in the code more

EDIT: Ok, make a first pass.

(sectionID==='chapter4.0'||'chapter4.1'||'chapter4.2'||'chapter4.3')

it's totaly wrong, the correct form is

(sectionID==='chapter4.0'||sectionID==='chapter4.1'||sectionID==='chapter4.2'||sectionID==='chapter4.3')

the logic operator &&, || (logic AND, logic OR) work between boolean variable (variables with only two values, 'true' and 'false') for example

(sectionID==='chapter4.0'||sectionID==='chapter4.1') mean var BOOL1 = (sectionID==='chapter4.0') //true or false var BOOL2 = (sectionID==='chapter4.1') // true or false (BOOL1 || BOOL2) //true if BOOL1 or BOOL2 is true between logic/boolean operator you can have only expression returing "true" or "false". simply write 'chapter4.1' mean 'true' because any non empty string is a boolean true (this is the general behaviour, but you need to check the documentation of language you are using for be sure of it).

EDIT2: available: ['chapter4.0'||'chapter4.1'||'chapter4.2'||'chapter4.3'], should be available: ['chapter4.0', 'chapter4.1', 'chapter4.2', 'chapter4.3'], variables with [] are array, a collection of elements, the 'i-th' element can be access with varName[i]. in the declaration, between each elements of the array must be separate by a comma (usualy, this sort of thing is better check in language documentation if you start to tinker with code in a new language)

EDIT3:

i checked the 'tak'kan mine' breaking the tool.

the problem isn't in the syntax, it's correct, the problem lie in the loading of the page, when the tool check the status of the checkbox the checkbox itself isn't alredy present in the page, this cast the error TypeError: document.getElementById(...) is null (for checking the error, open the console browser, usualy F12, this will give you the exact line of the error and the function calling the line with the problem) if you put the checkbox in the "chapter4.1" section the page works flawless. this is a very crude workaround, becuase the investments with the price reduced by the "infrastructureFunded" checkbox are in the same tab of the checkbox itself, so it should be possibile put all in the same tab, but for now not a clue in a solution for the problem.

EDIT4:

ok i find a solution (Don't Ask Why or How), you must put a tooltip to the buying price

like this: specialCostToolTip:function { return 'Costs 250.000 if Tak\'Kan Major was Flip in the Synod or 500.000 if not'; }, to make the page works.

EDIT5:

ok, analyzed the 'ardan bank' condition, first i change the ardhoeim score select box, you need the default option be one of the option ('5-9' wasn't any valid id) and add the 9- and 50+ id (the first for block bank investment, the latter for the best threshold, before the last two were both '40-49') sectionID:'chapter4.2', id:'ardoheimScore', name:'Hidden Ardoheim Score', impactType:'other', impactTime:, defaultSelected:'9-', options:[{id:'9-',	describer:'less than 10'}, {id:'10-19',	describer:'less than 20'}, {id:'20-29',	describer:'less than 30'}, {id:'30-39',	describer:'less than 40'}, {id:'40-49',	describer:'less than 50'}, {id:'50+',	describer:'more than 50'}]

the condition for show the bank always in the reunion and in the chapter 4.2/4.3 only if attend to the synod with ardoheim score 10+ is:

available: ['reunion', 'chapter4.2', 'chapter4.3'], condition:function(sectionID){ if(sectionID==='reunion'){ return true; }    if(sectionID==='chapter4.2'||sectionID==='chapter4.3'){ return (getDropDownSelected('ardoheimScore')!=='9-' && (getCheckboxStatus('finishedCouncil'))); } },

if you put a condition that condition/function must cover all the section reported in the available array.

if you don't know a good program for coding Notepad++ or Sublime Text are good free choice.