problems with if researchFinished
Posted: 22 Dec 2011, 16:53
Since there is no easy way for one research topic to remove another one after it has been researched, I've tried to do it via a script where the actual research topic doesn't actually enable any other research upon completion. Instead, if it is researched, the script will make the research topics available and research the other research topic at the same time (thus removing the unneeded one from the research menu). No matter what I've tried with researchFinished so far, it has always given me an error: (top line of my script is line 100)
I've tried looking at Nexus.slo
where it corresponds to a technology in Nexus.vlo, e.g.:
This is my second time delving into the scripting, so apologies if it's some rookie mistake. 
Code: Select all
info |02:36:30: [loadPlayerScript] Syntax error in multiplay/skirmish/rules.js line 100: Expected `;', `)'Code: Select all
if ((researchFinished(RESEARCH "Tech-Enabler-F1", me)) and (not researchFinished(RESEARCH "Tech-Enabler-F2", me)))
{
enableResearch("F1R-Sys-Sensor-Turret01", playnum);
enableResearch("F1R-Wpn-MG1Mk1", playnum);
enableResearch("F1R-Sys-Engineering01", playnum);
completeResearch("Tech-Enabler-F2", playnum);
enableStructure("F1ResearchFacility", playnum);
}
else if ((researchFinished(RESEARCH "Tech-Enabler-F2", me)) and (not researchFinished(RESEARCH "Tech-Enabler-F1", me)))
{
enableResearch("F2R-Sys-Sensor-Turret01", playnum);
enableResearch("F2R-Wpn-MG1Mk1", playnum);
enableResearch("F2R-Sys-Engineering01", playnum);
completeResearch("Tech-Enabler-F1", playnum);
enableStructure("F2ResearchFacility", playnum);
}Code: Select all
while(_result < techCount[_techTree])
{
if((not researchFinished(tech[_techTree][_result], me)) and (not researchStarted(tech[_techTree][_result], me)))
{
return _result; //found research
}
_result++;
}Code: Select all
tech[1][0] RESEARCHSTAT "R-Struc-VTOLFactory"